From 187ae03440c18a59f08c06114442fcc423e37d51 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 3 Mar 2023 18:15:34 +1100 Subject: [PATCH 1/3] Lint fixes https://topcoder.atlassian.net/browse/PROD-4153 --- .eslintrc | 5 +- .../Contentful/AppComponent/index.jsx | 62 ++++++++++++------- .../components/Contentful/Viewport/index.jsx | 2 +- .../components/Gigs/ReferralCode/index.jsx | 2 +- .../Account/LinkedAccount/ExistingLink.jsx | 12 +++- .../Header/TabSelector/index.jsx | 4 +- .../ChallengeCard/Prize/index.jsx | 15 ++--- .../tc-communities/AccessDenied/index.jsx | 3 +- .../communities/wipro/Home/index.jsx | 3 +- src/shared/containers/ErrorIcons/index.jsx | 4 +- 10 files changed, 69 insertions(+), 43 deletions(-) diff --git a/.eslintrc b/.eslintrc index 02ace66fc8..c323322f56 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,10 +4,7 @@ "jsx-a11y/anchor-is-valid": false, "import/no-cycle": [2, { "maxDepth": 1 }], "react/forbid-prop-types": false, - "react/no-unknown-property": false, - "react/jsx-no-bind": false, - "react/destructuring-assignment": false, - "react/no-array-index-key": false + "react/no-unknown-property": ["error", { "ignore": ["styleName"] }] }, "env": { "browser": true diff --git a/src/shared/components/Contentful/AppComponent/index.jsx b/src/shared/components/Contentful/AppComponent/index.jsx index a012fb82e9..f1d84bcd03 100644 --- a/src/shared/components/Contentful/AppComponent/index.jsx +++ b/src/shared/components/Contentful/AppComponent/index.jsx @@ -18,41 +18,59 @@ import PathSelector from 'components/MemberPath/PathSelector'; const { fireErrorMessage } = errors; export function AppComponentSwitch(appComponent) { - if (appComponent.fields.type === 'TCO-Leaderboard') { + const { + fields: { + type, + theme, + props, + props: { + leaderboardApiUrl, + title, + podiumSpots, + isCopilot, + hasChallengeHistory, + tcoPointsApiUrl, + memberLimit, + isAlgo, + }, + }, + sys: { id }, + } = appComponent; + if (type === 'TCO-Leaderboard') { return ( ); } - if (appComponent.fields.type === 'RecruitCRM-Jobs') { - return ; + if (type === 'RecruitCRM-Jobs') { + return ; } - if (appComponent.fields.type === 'EmailSubscribeForm') { - return ; + if (type === 'EmailSubscribeForm') { + return ; } - if (appComponent.fields.type === 'GSheet') { - return ; + if (type === 'GSheet') { + return ; } - if (appComponent.fields.type === 'MemberPath') { + if (type === 'MemberPath') { return ( ); } - fireErrorMessage(`Unsupported app component type ${appComponent.fields.type}`, ''); + fireErrorMessage(`Unsupported app component type ${type}`, ''); return null; } diff --git a/src/shared/components/Contentful/Viewport/index.jsx b/src/shared/components/Contentful/Viewport/index.jsx index 30d3a78e28..cf89dec2ac 100644 --- a/src/shared/components/Contentful/Viewport/index.jsx +++ b/src/shared/components/Contentful/Viewport/index.jsx @@ -272,7 +272,7 @@ export function ViewportLoader(props) { } if (query) { - queries.push({ ...props.query, content_type: 'viewport' }); + queries.push({ ...query, content_type: 'viewport' }); } return ( diff --git a/src/shared/components/Gigs/ReferralCode/index.jsx b/src/shared/components/Gigs/ReferralCode/index.jsx index 1ed5597794..1de0976d45 100644 --- a/src/shared/components/Gigs/ReferralCode/index.jsx +++ b/src/shared/components/Gigs/ReferralCode/index.jsx @@ -25,7 +25,7 @@ function ReferralCode(props) { const [growSurfState, setGrowSurfState] = useState(growSurf); const [copyBtnText, setCopyBtnText] = useState('COPY'); useEffect(() => { - setGrowSurfState(props.growSurf); + setGrowSurfState(growSurf); }, [growSurf]); return ( diff --git a/src/shared/components/Settings/Account/LinkedAccount/ExistingLink.jsx b/src/shared/components/Settings/Account/LinkedAccount/ExistingLink.jsx index c0654a5b43..27fb7c9019 100644 --- a/src/shared/components/Settings/Account/LinkedAccount/ExistingLink.jsx +++ b/src/shared/components/Settings/Account/LinkedAccount/ExistingLink.jsx @@ -64,7 +64,15 @@ export default function ExistingLink(props) { return (
openLink(e, link)}>
-
onConfirmDeleteLink(e, link)} styleName={`ext-link-tile_edit-header_delete ${link.deleting ? 'ext-link-tile_edit-header_delete--disabled' : ''}`} prevent-event-propagation="true" /> +
{ + e.preventDefault(); + e.stopPropagation(); + onConfirmDeleteLink(e, link); + }} + styleName={`ext-link-tile_edit-header_delete ${link.deleting ? 'ext-link-tile_edit-header_delete--disabled' : ''}`} + />
@@ -94,7 +102,7 @@ export default function ExistingLink(props) {

Loading data. This will take a few minutes.

- + {prependProtocol(link.URL)}
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx index dcdc49f122..f7c9d104f1 100644 --- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx +++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx @@ -404,9 +404,9 @@ export default function ChallengeViewSelector(props) {
{ - sortOptions.map((option, index) => ( + sortOptions.map(option => (
{ setSelectedSortOption(option.name); diff --git a/src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx b/src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx index c7fdc50fb3..9e24240759 100644 --- a/src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx +++ b/src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx @@ -6,7 +6,7 @@ import PT from 'prop-types'; import React from 'react'; -import Tooltip from 'components/Tooltip'; +import Tooltip from '../../../Tooltip'; import Tip from './Tip'; import './style.scss'; @@ -35,11 +35,6 @@ export default function Prize({
); - function placeArrow(TooltipNode) { - const arrow = TooltipNode.querySelector('.rc-tooltip-arrow'); - arrow.style.left = '33%'; - } - const component = (
{((onlyShowTooltipForPrize && !withoutTooltip) ? ( - + { + const arrow = TooltipNode.querySelector('.rc-tooltip-arrow'); + arrow.style.left = '33%'; + }} + > {prizeUI} ) diff --git a/src/shared/components/tc-communities/AccessDenied/index.jsx b/src/shared/components/tc-communities/AccessDenied/index.jsx index 61923073f6..a5730d6d97 100644 --- a/src/shared/components/tc-communities/AccessDenied/index.jsx +++ b/src/shared/components/tc-communities/AccessDenied/index.jsx @@ -24,6 +24,7 @@ export default function AccessDenied(props) { spaceName, environment, viewportId, + children, } = props; if (viewportId) { @@ -67,7 +68,7 @@ export default function AccessDenied(props) {
You are not authorized to access this page.
- {props.children} + {children}
); case CAUSE.HAVE_NOT_SUBMITTED_TO_THE_CHALLENGE: diff --git a/src/shared/components/tc-communities/communities/wipro/Home/index.jsx b/src/shared/components/tc-communities/communities/wipro/Home/index.jsx index 9d316ff1ec..4246468661 100644 --- a/src/shared/components/tc-communities/communities/wipro/Home/index.jsx +++ b/src/shared/components/tc-communities/communities/wipro/Home/index.jsx @@ -123,6 +123,7 @@ const settings = { export default function Home(props) { const { userId, + resetChallengeListing, } = props; return ( @@ -199,7 +200,7 @@ export default function Home(props) { >
props.resetChallengeListing()} + onClick={() => resetChallengeListing()} styleName="ImageTextStyles.link" to="challenges?communityId=" > diff --git a/src/shared/containers/ErrorIcons/index.jsx b/src/shared/containers/ErrorIcons/index.jsx index d85672a765..5ca7fe755a 100644 --- a/src/shared/containers/ErrorIcons/index.jsx +++ b/src/shared/containers/ErrorIcons/index.jsx @@ -25,8 +25,8 @@ function Tip({ errors, clear }) { ⨯ { - errors.map(({ title, message }, i) => ( -
+ errors.map(({ title, message }) => ( +
{title}
From 9536487075c4d8c60489911531910a1e533a8583 Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Fri, 3 Mar 2023 18:15:57 +1100 Subject: [PATCH 2/3] Lint fixes --- .eslintrc | 5 +- .../Contentful/AppComponent/index.jsx | 62 ++++++++++++------- .../components/Contentful/Viewport/index.jsx | 2 +- .../components/Gigs/ReferralCode/index.jsx | 2 +- .../Account/LinkedAccount/ExistingLink.jsx | 12 +++- .../Header/TabSelector/index.jsx | 4 +- .../ChallengeCard/Prize/index.jsx | 15 ++--- .../tc-communities/AccessDenied/index.jsx | 3 +- .../communities/wipro/Home/index.jsx | 3 +- src/shared/containers/ErrorIcons/index.jsx | 4 +- 10 files changed, 69 insertions(+), 43 deletions(-) diff --git a/.eslintrc b/.eslintrc index 02ace66fc8..c323322f56 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,10 +4,7 @@ "jsx-a11y/anchor-is-valid": false, "import/no-cycle": [2, { "maxDepth": 1 }], "react/forbid-prop-types": false, - "react/no-unknown-property": false, - "react/jsx-no-bind": false, - "react/destructuring-assignment": false, - "react/no-array-index-key": false + "react/no-unknown-property": ["error", { "ignore": ["styleName"] }] }, "env": { "browser": true diff --git a/src/shared/components/Contentful/AppComponent/index.jsx b/src/shared/components/Contentful/AppComponent/index.jsx index a012fb82e9..f1d84bcd03 100644 --- a/src/shared/components/Contentful/AppComponent/index.jsx +++ b/src/shared/components/Contentful/AppComponent/index.jsx @@ -18,41 +18,59 @@ import PathSelector from 'components/MemberPath/PathSelector'; const { fireErrorMessage } = errors; export function AppComponentSwitch(appComponent) { - if (appComponent.fields.type === 'TCO-Leaderboard') { + const { + fields: { + type, + theme, + props, + props: { + leaderboardApiUrl, + title, + podiumSpots, + isCopilot, + hasChallengeHistory, + tcoPointsApiUrl, + memberLimit, + isAlgo, + }, + }, + sys: { id }, + } = appComponent; + if (type === 'TCO-Leaderboard') { return ( ); } - if (appComponent.fields.type === 'RecruitCRM-Jobs') { - return ; + if (type === 'RecruitCRM-Jobs') { + return ; } - if (appComponent.fields.type === 'EmailSubscribeForm') { - return ; + if (type === 'EmailSubscribeForm') { + return ; } - if (appComponent.fields.type === 'GSheet') { - return ; + if (type === 'GSheet') { + return ; } - if (appComponent.fields.type === 'MemberPath') { + if (type === 'MemberPath') { return ( ); } - fireErrorMessage(`Unsupported app component type ${appComponent.fields.type}`, ''); + fireErrorMessage(`Unsupported app component type ${type}`, ''); return null; } diff --git a/src/shared/components/Contentful/Viewport/index.jsx b/src/shared/components/Contentful/Viewport/index.jsx index 30d3a78e28..cf89dec2ac 100644 --- a/src/shared/components/Contentful/Viewport/index.jsx +++ b/src/shared/components/Contentful/Viewport/index.jsx @@ -272,7 +272,7 @@ export function ViewportLoader(props) { } if (query) { - queries.push({ ...props.query, content_type: 'viewport' }); + queries.push({ ...query, content_type: 'viewport' }); } return ( diff --git a/src/shared/components/Gigs/ReferralCode/index.jsx b/src/shared/components/Gigs/ReferralCode/index.jsx index 1ed5597794..1de0976d45 100644 --- a/src/shared/components/Gigs/ReferralCode/index.jsx +++ b/src/shared/components/Gigs/ReferralCode/index.jsx @@ -25,7 +25,7 @@ function ReferralCode(props) { const [growSurfState, setGrowSurfState] = useState(growSurf); const [copyBtnText, setCopyBtnText] = useState('COPY'); useEffect(() => { - setGrowSurfState(props.growSurf); + setGrowSurfState(growSurf); }, [growSurf]); return ( diff --git a/src/shared/components/Settings/Account/LinkedAccount/ExistingLink.jsx b/src/shared/components/Settings/Account/LinkedAccount/ExistingLink.jsx index c0654a5b43..27fb7c9019 100644 --- a/src/shared/components/Settings/Account/LinkedAccount/ExistingLink.jsx +++ b/src/shared/components/Settings/Account/LinkedAccount/ExistingLink.jsx @@ -64,7 +64,15 @@ export default function ExistingLink(props) { return (
openLink(e, link)}>
-
onConfirmDeleteLink(e, link)} styleName={`ext-link-tile_edit-header_delete ${link.deleting ? 'ext-link-tile_edit-header_delete--disabled' : ''}`} prevent-event-propagation="true" /> +
{ + e.preventDefault(); + e.stopPropagation(); + onConfirmDeleteLink(e, link); + }} + styleName={`ext-link-tile_edit-header_delete ${link.deleting ? 'ext-link-tile_edit-header_delete--disabled' : ''}`} + />
@@ -94,7 +102,7 @@ export default function ExistingLink(props) {

Loading data. This will take a few minutes.

- + {prependProtocol(link.URL)}
diff --git a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx index dcdc49f122..f7c9d104f1 100644 --- a/src/shared/components/challenge-detail/Header/TabSelector/index.jsx +++ b/src/shared/components/challenge-detail/Header/TabSelector/index.jsx @@ -404,9 +404,9 @@ export default function ChallengeViewSelector(props) {
{ - sortOptions.map((option, index) => ( + sortOptions.map(option => (
{ setSelectedSortOption(option.name); diff --git a/src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx b/src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx index c7fdc50fb3..9e24240759 100644 --- a/src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx +++ b/src/shared/components/challenge-listing/ChallengeCard/Prize/index.jsx @@ -6,7 +6,7 @@ import PT from 'prop-types'; import React from 'react'; -import Tooltip from 'components/Tooltip'; +import Tooltip from '../../../Tooltip'; import Tip from './Tip'; import './style.scss'; @@ -35,11 +35,6 @@ export default function Prize({
); - function placeArrow(TooltipNode) { - const arrow = TooltipNode.querySelector('.rc-tooltip-arrow'); - arrow.style.left = '33%'; - } - const component = (
{((onlyShowTooltipForPrize && !withoutTooltip) ? ( - + { + const arrow = TooltipNode.querySelector('.rc-tooltip-arrow'); + arrow.style.left = '33%'; + }} + > {prizeUI} ) diff --git a/src/shared/components/tc-communities/AccessDenied/index.jsx b/src/shared/components/tc-communities/AccessDenied/index.jsx index 61923073f6..a5730d6d97 100644 --- a/src/shared/components/tc-communities/AccessDenied/index.jsx +++ b/src/shared/components/tc-communities/AccessDenied/index.jsx @@ -24,6 +24,7 @@ export default function AccessDenied(props) { spaceName, environment, viewportId, + children, } = props; if (viewportId) { @@ -67,7 +68,7 @@ export default function AccessDenied(props) {
You are not authorized to access this page.
- {props.children} + {children}
); case CAUSE.HAVE_NOT_SUBMITTED_TO_THE_CHALLENGE: diff --git a/src/shared/components/tc-communities/communities/wipro/Home/index.jsx b/src/shared/components/tc-communities/communities/wipro/Home/index.jsx index 9d316ff1ec..4246468661 100644 --- a/src/shared/components/tc-communities/communities/wipro/Home/index.jsx +++ b/src/shared/components/tc-communities/communities/wipro/Home/index.jsx @@ -123,6 +123,7 @@ const settings = { export default function Home(props) { const { userId, + resetChallengeListing, } = props; return ( @@ -199,7 +200,7 @@ export default function Home(props) { >
props.resetChallengeListing()} + onClick={() => resetChallengeListing()} styleName="ImageTextStyles.link" to="challenges?communityId=" > diff --git a/src/shared/containers/ErrorIcons/index.jsx b/src/shared/containers/ErrorIcons/index.jsx index d85672a765..5ca7fe755a 100644 --- a/src/shared/containers/ErrorIcons/index.jsx +++ b/src/shared/containers/ErrorIcons/index.jsx @@ -25,8 +25,8 @@ function Tip({ errors, clear }) { ⨯ { - errors.map(({ title, message }, i) => ( -
+ errors.map(({ title, message }) => ( +
{title}
From ca81f7df18a702e095e219400b3482dfe4824e9a Mon Sep 17 00:00:00 2001 From: Justin Gasper Date: Sat, 4 Mar 2023 07:00:11 +1100 Subject: [PATCH 3/3] Revert "RDM submission download support" This reverts commit 1128d523982b6e535594e4b2ad679e58b0b59c0d. --- .../SubmissionRow/SubmissionHistoryRow/index.jsx | 4 +--- .../Submissions/SubmissionRow/index.jsx | 7 ++----- .../components/challenge-detail/Submissions/index.jsx | 6 ++---- .../challenge-detail/Winners/Winner/index.jsx | 4 +--- .../components/challenge-detail/Winners/index.jsx | 6 +----- src/shared/containers/challenge-detail/index.jsx | 4 +--- src/shared/utils/challenge.js | 10 ---------- 7 files changed, 8 insertions(+), 33 deletions(-) diff --git a/src/shared/components/challenge-detail/Submissions/SubmissionRow/SubmissionHistoryRow/index.jsx b/src/shared/components/challenge-detail/Submissions/SubmissionRow/SubmissionHistoryRow/index.jsx index 5510ef4741..750458887b 100644 --- a/src/shared/components/challenge-detail/Submissions/SubmissionRow/SubmissionHistoryRow/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/SubmissionRow/SubmissionHistoryRow/index.jsx @@ -21,7 +21,6 @@ const { getService } = services.submissions; export default function SubmissionHistoryRow({ isMM, - isRDM, submission, finalScore, provisionalScore, @@ -82,7 +81,7 @@ export default function SubmissionHistoryRow({
{ - isLoggedIn && (isMM || isRDM) + isLoggedIn && isMM && (numWinners > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED) && (
Action
@@ -122,7 +121,6 @@ SubmissionHistoryRow.defaultProps = { SubmissionHistoryRow.propTypes = { isMM: PT.bool.isRequired, - isRDM: PT.bool.isRequired, submission: PT.number.isRequired, finalScore: PT.oneOfType([ PT.number, diff --git a/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx b/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx index b2fc9cca9b..f4a61b11bb 100644 --- a/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx @@ -19,7 +19,7 @@ import SubmissionHistoryRow from './SubmissionHistoryRow'; import style from './style.scss'; export default function SubmissionRow({ - isMM, isRDM, openHistory, member, submissions, score, toggleHistory, challengeStatus, + isMM, openHistory, member, submissions, score, toggleHistory, challengeStatus, isReviewPhaseComplete, finalRank, provisionalRank, onShowPopup, rating, viewAsTable, numWinners, auth, isLoggedIn, }) { @@ -166,8 +166,7 @@ export default function SubmissionRow({ Time
{ - (isMM || isRDM) - && (numWinners > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED) && ( + isMM && (numWinners > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED) && (
Action
@@ -186,7 +185,6 @@ export default function SubmissionRow({ 0 || challenge.status === CHALLENGE_STATUS.COMPLETED) - && (isMM || isRDM) && isLoggedIn) && ( + && isMM && isLoggedIn) && (