From ec9cbfdd703bcae8172d88dd2ae9a2f2aa54a5e8 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Fri, 16 Oct 2020 20:50:44 +0700 Subject: [PATCH 01/14] fix: #5082 blank page on clicking challenges tab from stats history page --- src/shared/components/ChallengeTile/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/shared/components/ChallengeTile/index.jsx b/src/shared/components/ChallengeTile/index.jsx index c1611df3dd..23810f1ed6 100644 --- a/src/shared/components/ChallengeTile/index.jsx +++ b/src/shared/components/ChallengeTile/index.jsx @@ -2,6 +2,7 @@ * Challenge tile. */ /* eslint-env browser */ +import _ from 'lodash'; import React from 'react'; import PT from 'prop-types'; import { Link } from 'react-router-dom'; @@ -315,7 +316,7 @@ class ChallengeTile extends React.Component { Role:   - { listRoles(challenge.userDetails.roles) } + { listRoles(_.get(challenge, 'userDetails.roles')) } ) } From 3c4498a8ddc5eddde9d39ebde45d2f63660b609e Mon Sep 17 00:00:00 2001 From: gets0ul Date: Mon, 19 Oct 2020 23:19:15 +0700 Subject: [PATCH 02/14] fix: hide roles section if challenge does not have roles data --- src/shared/components/ChallengeTile/index.jsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/shared/components/ChallengeTile/index.jsx b/src/shared/components/ChallengeTile/index.jsx index 23810f1ed6..0dbc7b7a22 100644 --- a/src/shared/components/ChallengeTile/index.jsx +++ b/src/shared/components/ChallengeTile/index.jsx @@ -75,6 +75,7 @@ class ChallengeTile extends React.Component { } = this.props; const { track, type } = challenge; + const roles = _.get(challenge, 'userDetails.roles'); const outStyleName = `challenge tile-view ${track.replace(' ', '-').toLowerCase()}`; const extraStyle = { @@ -308,19 +309,22 @@ class ChallengeTile extends React.Component { ) } -

- { track !== COMPETITION_TRACKS.DS + { !_.isEmpty(roles) + && ( +

+ { track !== COMPETITION_TRACKS.DS && ( Role:   - { listRoles(_.get(challenge, 'userDetails.roles')) } + { listRoles(roles) } ) } -

+

+ ) } From 38957f2201881eaf9ab67c6d30a6a57d37b3fe38 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Mon, 19 Oct 2020 23:28:08 +0700 Subject: [PATCH 03/14] fix: test snapshot --- .../components/ChallengeTile/__snapshots__/index.jsx.snap | 3 --- 1 file changed, 3 deletions(-) diff --git a/__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap b/__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap index c733309a43..9fe1f038fa 100644 --- a/__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/ChallengeTile/__snapshots__/index.jsx.snap @@ -241,9 +241,6 @@ exports[`renders marathon 1`] = `

-

From b455299b63ad278a3e3cef018fddc4bdf98dd074 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Tue, 20 Oct 2020 01:30:38 +0700 Subject: [PATCH 04/14] fix: reset review opportunity filter --- .../challenge-listing/Filters/FiltersPanel/index.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx b/src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx index ed61187a59..0d1288115f 100644 --- a/src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx +++ b/src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx @@ -328,9 +328,10 @@ export default function FiltersPanel({ autoBlur clearable={false} id="review-type-select" - onChange={ - value => setFilterState(Filter.setReviewOpportunityType(filterState, value)) - } + onChange={(value) => { + const reviewOpportunityType = value === 0 ? undefined : value; + setFilterState({ ..._.clone(filterState), reviewOpportunityType }); + }} options={[ { label: 'All', value: 0 }, // 0 value deactivates above filter ...Object.entries(REVIEW_OPPORTUNITY_TYPES) @@ -434,6 +435,7 @@ export default function FiltersPanel({ endDateStart: null, startDateEnd: null, status: 'All', + reviewOpportunityType: undefined, }); selectCommunity(defaultCommunityId); setSearchText(''); From 3aecb56dd0e7c7d21c81f44334246a847e492146 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Tue, 20 Oct 2020 01:39:57 +0700 Subject: [PATCH 05/14] fix: remove unused code --- .../components/challenge-listing/Filters/FiltersPanel/index.jsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx b/src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx index 0d1288115f..07d9f4d206 100644 --- a/src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx +++ b/src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx @@ -22,7 +22,6 @@ /* eslint-disable jsx-a11y/label-has-for */ import _ from 'lodash'; -import { challenge as challengeUtils } from 'topcoder-react-lib'; import React from 'react'; import PT from 'prop-types'; import Select from 'components/Select'; @@ -38,7 +37,6 @@ import DateRangePicker from '../DateRangePicker'; import style from './style.scss'; import UiSimpleRemove from '../../Icons/ui-simple-remove.svg'; -const Filter = challengeUtils.filter; export default function FiltersPanel({ communityFilters, From 40040323b875f1a3118f553ff9507ce84cacc4f4 Mon Sep 17 00:00:00 2001 From: gets0ul Date: Tue, 20 Oct 2020 04:58:31 +0700 Subject: [PATCH 06/14] fix: toggle checkpoint feedback --- src/shared/actions/page/challenge-details.js | 2 +- .../challenge-detail/Checkpoints/index.jsx | 4 ++-- .../containers/challenge-detail/index.jsx | 14 ++++++++++++-- src/shared/reducers/page/challenge-details.js | 17 +++-------------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/shared/actions/page/challenge-details.js b/src/shared/actions/page/challenge-details.js index 20faf4c0d8..3312b33bb7 100644 --- a/src/shared/actions/page/challenge-details.js +++ b/src/shared/actions/page/challenge-details.js @@ -59,7 +59,7 @@ function setSpecsTabState(state) { * @param {Boolean} open * @return {Object} */ -function toggleCheckpointFeedback(id, open) { +function toggleCheckpointFeedback(id, open = false) { return { id, open }; } diff --git a/src/shared/components/challenge-detail/Checkpoints/index.jsx b/src/shared/components/challenge-detail/Checkpoints/index.jsx index cc7f5a62c8..37de8dc40a 100644 --- a/src/shared/components/challenge-detail/Checkpoints/index.jsx +++ b/src/shared/components/challenge-detail/Checkpoints/index.jsx @@ -27,7 +27,7 @@ function Checkpoints(props) { document .getElementsByClassName(style['challenge-checkpoint-winners'])[index] .scrollIntoView(true); - toggleCheckpointFeedback(index, true); + toggleCheckpointFeedback(item.submissionId, true); }} type="button" > @@ -52,7 +52,7 @@ function Checkpoints(props) { { /* TODO: At the moment we just fetch downloads from the legacy Topcoder Studio API, and we don't need any JS code to this. @@ -136,4 +149,5 @@ Submission.propTypes = { onShowDetails: PT.func, status: PT.string.isRequired, allowDelete: PT.bool.isRequired, + auth: PT.shape().isRequired, }; diff --git a/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx b/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx index 0692d888ff..37931a9530 100644 --- a/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx +++ b/src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx @@ -26,6 +26,7 @@ import style from './styles.scss'; export default function SubmissionManagement(props) { const { + auth, challenge, submissions, loadingSubmissions, @@ -156,6 +157,7 @@ export default function SubmissionManagement(props) { {!loadingSubmissions && ( Date: Tue, 20 Oct 2020 19:57:08 +0700 Subject: [PATCH 10/14] fix: refactor code --- .../SubmissionManagement/Submission/index.jsx | 23 ++++--------------- .../SubmissionManagement/index.jsx | 3 --- .../SubmissionsTable/index.jsx | 3 --- .../containers/SubmissionManagement/index.jsx | 18 +++++++++++++-- 4 files changed, 20 insertions(+), 27 deletions(-) diff --git a/src/shared/components/SubmissionManagement/Submission/index.jsx b/src/shared/components/SubmissionManagement/Submission/index.jsx index 85869d1e2e..7f3ef1114f 100644 --- a/src/shared/components/SubmissionManagement/Submission/index.jsx +++ b/src/shared/components/SubmissionManagement/Submission/index.jsx @@ -14,7 +14,7 @@ import _ from 'lodash'; import moment from 'moment'; import React from 'react'; -import { services } from 'topcoder-react-lib'; +import { config } from 'topcoder-react-utils'; import { COMPETITION_TRACKS, CHALLENGE_STATUS } from 'utils/tc'; import PT from 'prop-types'; @@ -26,20 +26,19 @@ import ScreeningStatus from '../ScreeningStatus'; import './styles.scss'; -const { getService } = services.submissions; - export default function Submission(props) { const { - auth, submissionObject, showScreeningDetails, track, + onDownload, onDelete, onShowDetails, status, allowDelete, } = props; const formatDate = date => moment(+new Date(date)).format('MMM DD, YYYY hh:mm A'); + const onDownloadSubmission = onDownload.bind(1, submissionObject.id); return ( @@ -70,20 +69,7 @@ export default function Submission(props) {