From fd1bd05bbd274fcd2b9fdea55f6b8fcc55b7c273 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Mon, 1 Apr 2024 23:40:43 +0000 Subject: [PATCH 1/7] Hide download buttons for submissions that come from Topcrowd (TOP-655) --- .../SubmissionManagement/Submission/index.jsx | 14 ++++++++++++ .../SubmissionManagement/index.jsx | 2 ++ .../SubmissionsTable/index.jsx | 3 +++ .../MySubmissions/SubmissionsList/index.jsx | 22 ++++++++++++------- .../challenge-detail/MySubmissions/index.jsx | 8 +------ 5 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/shared/components/SubmissionManagement/Submission/index.jsx b/src/shared/components/SubmissionManagement/Submission/index.jsx index 0bc769ed7a..02919206cd 100644 --- a/src/shared/components/SubmissionManagement/Submission/index.jsx +++ b/src/shared/components/SubmissionManagement/Submission/index.jsx @@ -27,6 +27,7 @@ import './styles.scss'; export default function Submission(props) { const { + challenge, submissionObject, showScreeningDetails, track, @@ -40,6 +41,16 @@ export default function Submission(props) { const onDownloadSubmission = onDownload.bind(1, submissionObject.id); const safeForDownloadCheck = safeForDownload(submissionObject.url); + // Determine if a challenge is for Topcrowd so we can edit the UI accordingly + let isTopCrowdChallenge = false; + const isTopCrowdChallengeData = _.find(challenge.metadata, { name: 'is_platform' }); + if (isTopCrowdChallengeData) { + isTopCrowdChallenge = isTopCrowdChallengeData.value; + } + else { + isTopCrowdChallenge = false; + } + return ( @@ -72,12 +83,14 @@ export default function Submission(props) { }
+ { !isTopCrowdChallenge ? + : } { /* TODO: At the moment we just fetch downloads from the legacy Topcoder Studio API, and we don't need any JS code to this. @@ -121,6 +134,7 @@ Submission.defaultProps = { }; Submission.propTypes = { + challenge: PT.shape().isRequired, submissionObject: PT.shape({ id: PT.string, legacySubmissionId: PT.string, diff --git a/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx b/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx index a467381a39..bd62794483 100644 --- a/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx +++ b/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx @@ -171,6 +171,7 @@ export default function SubmissionManagement(props) { {!loadingSubmissions && (
@@ -432,6 +442,7 @@ class SubmissionsListView extends React.Component { {moment(mySubmission.submissionTime).format('MMM DD, YYYY HH:mm:ss')}
+ { !isTopCrowdChallenge ? + + : } - : } + { !isTopCrowdChallenge + ? ( + + ) + : } { /* TODO: At the moment we just fetch downloads from the legacy Topcoder Studio API, and we don't need any JS code to this. diff --git a/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx b/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx index bd62794483..5217eb3419 100644 --- a/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx +++ b/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx @@ -220,7 +220,6 @@ SubmissionManagement.propTypes = { helpPageUrl: PT.string, onDownload: PT.func, onShowDetails: PT.func, - challenge: PT.shape().isRequired, submissions: PT.arrayOf(PT.shape()), loadingSubmissions: PT.bool, challengeUrl: PT.string, diff --git a/src/shared/components/challenge-detail/MySubmissions/SubmissionsList/index.jsx b/src/shared/components/challenge-detail/MySubmissions/SubmissionsList/index.jsx index efbd198121..f1dfce87ef 100644 --- a/src/shared/components/challenge-detail/MySubmissions/SubmissionsList/index.jsx +++ b/src/shared/components/challenge-detail/MySubmissions/SubmissionsList/index.jsx @@ -192,8 +192,7 @@ class SubmissionsListView extends React.Component { const isTopCrowdChallengeData = _.find(challenge.metadata, { name: 'is_platform' }); if (isTopCrowdChallengeData) { isTopCrowdChallenge = isTopCrowdChallengeData.value; - } - else { + } else { isTopCrowdChallenge = false; } @@ -442,27 +441,29 @@ class SubmissionsListView extends React.Component { {moment(mySubmission.submissionTime).format('MMM DD, YYYY HH:mm:ss')}
- { !isTopCrowdChallenge ? - - : } + { !isTopCrowdChallenge + ? ( + + ) + : }