From d55912f9d81c7ff85a9e747a6775b3e9b89394c9 Mon Sep 17 00:00:00 2001 From: prakashdurlabhji Date: Wed, 22 Jul 2020 03:52:35 +0530 Subject: [PATCH 1/3] issue 4552 fix --- .../Submissions/SubmissionRow/index.jsx | 9 ++++----- .../Submissions/SubmissionRow/style.scss | 20 +++++++++++++++++++ .../challenge-detail/Submissions/index.jsx | 8 ++++---- .../challenge-detail/Submissions/style.scss | 20 +++++++++++++++++++ 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx b/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx index c074465e48..b3d6e9ff03 100644 --- a/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx @@ -6,6 +6,7 @@ import React from 'react'; import PT from 'prop-types'; import _ from 'lodash'; +import { getRatingLevel } from 'utils/tc'; import moment from 'moment'; import ArrowNext from '../../../../../assets/images/arrow-next.svg'; @@ -17,7 +18,7 @@ import SubmissionHistoryRow from './SubmissionHistoryRow'; import './style.scss'; export default function SubmissionRow({ - isMM, openHistory, member, submissions, score, toggleHistory, colorStyle, + isMM, openHistory, member, submissions, score, toggleHistory, isReviewPhaseComplete, finalRank, provisionalRank, onShowPopup, rating, }) { const { @@ -74,7 +75,7 @@ export default function SubmissionRow({ ) : null }
- + {rating || '-'} {member || '-'} @@ -164,7 +165,6 @@ export default function SubmissionRow({ SubmissionRow.defaultProps = { toggleHistory: () => {}, - colorStyle: {}, score: {}, isReviewPhaseComplete: false, finalRank: null, @@ -205,7 +205,6 @@ SubmissionRow.propTypes = { }), rating: PT.number, toggleHistory: PT.func, - colorStyle: PT.shape(), isReviewPhaseComplete: PT.bool, finalRank: PT.number, provisionalRank: PT.number, diff --git a/src/shared/components/challenge-detail/Submissions/SubmissionRow/style.scss b/src/shared/components/challenge-detail/Submissions/SubmissionRow/style.scss index 0186d002ae..146b858707 100644 --- a/src/shared/components/challenge-detail/Submissions/SubmissionRow/style.scss +++ b/src/shared/components/challenge-detail/Submissions/SubmissionRow/style.scss @@ -193,3 +193,23 @@ margin: 10px 10px 0 10px; padding-top: 5px; } + +.level-1 { + color: $member-gray !important; +} + +.level-2 { + color: $member-green !important; +} + +.level-3 { + color: $member-blue !important; +} + +.level-4 { + color: $member-yellow !important; +} + +.level-5 { + color: $member-red !important; +} \ No newline at end of file diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index 5dc0d35abe..81020e28e1 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -7,6 +7,7 @@ import React from 'react'; import PT from 'prop-types'; import moment from 'moment'; import { isMM as checkIsMM } from 'utils/challenge'; +import { getRatingLevel } from 'utils/tc'; import _ from 'lodash'; import { connect } from 'react-redux'; import { config } from 'topcoder-react-utils'; @@ -316,7 +317,7 @@ class SubmissionsComponent extends React.Component { href={`${window.origin}/members/${s.createdBy}`} target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`} rel="noopener noreferrer" - style={_.get(s, 'colorStyle')} + styleName={`level-${getRatingLevel(_.get(s.registrant, 'rating', 0))}`} > {s.createdBy} @@ -707,7 +708,7 @@ class SubmissionsComponent extends React.Component {
{ !isF2F && !isBugHunt && ( -
+
{ (s.registrant && !_.isNil(s.registrant.rating)) ? s.registrant.rating : '-'}
) @@ -717,8 +718,7 @@ class SubmissionsComponent extends React.Component { href={`${window.origin}/members/${s.createdBy}`} target={`${_.includes(window.origin, 'www') ? '_self' : '_blank'}`} rel="noopener noreferrer" - styleName="handle" - style={s.colorStyle} + styleName={`handle level-${getRatingLevel(_.get(s.registrant, 'rating', 0))}`} > {s.createdBy} diff --git a/src/shared/components/challenge-detail/Submissions/style.scss b/src/shared/components/challenge-detail/Submissions/style.scss index 54ae3d4ea2..5343a42cd9 100644 --- a/src/shared/components/challenge-detail/Submissions/style.scss +++ b/src/shared/components/challenge-detail/Submissions/style.scss @@ -355,3 +355,23 @@ margin-top: 25px !important; align-self: center; } + +.level-1 { + color: $member-gray !important; +} + +.level-2 { + color: $member-green !important; +} + +.level-3 { + color: $member-blue !important; +} + +.level-4 { + color: $member-yellow !important; +} + +.level-5 { + color: $member-red !important; +} \ No newline at end of file From bc33e76df8ec7a0c63f4c91bbc471624864cdc44 Mon Sep 17 00:00:00 2001 From: prakashdurlabhji Date: Wed, 22 Jul 2020 04:12:17 +0530 Subject: [PATCH 2/3] tests fix --- .../challenge-detail/Submissions/SubmissionRow/index.jsx | 3 +-- src/shared/components/challenge-detail/Submissions/index.jsx | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx b/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx index b3d6e9ff03..81a3081e20 100644 --- a/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/SubmissionRow/index.jsx @@ -79,11 +79,10 @@ export default function SubmissionRow({ {rating || '-'} {member || '-'} diff --git a/src/shared/components/challenge-detail/Submissions/index.jsx b/src/shared/components/challenge-detail/Submissions/index.jsx index 81020e28e1..27221b068d 100644 --- a/src/shared/components/challenge-detail/Submissions/index.jsx +++ b/src/shared/components/challenge-detail/Submissions/index.jsx @@ -7,7 +7,6 @@ import React from 'react'; import PT from 'prop-types'; import moment from 'moment'; import { isMM as checkIsMM } from 'utils/challenge'; -import { getRatingLevel } from 'utils/tc'; import _ from 'lodash'; import { connect } from 'react-redux'; import { config } from 'topcoder-react-utils'; @@ -19,7 +18,7 @@ import { PrimaryButton } from 'topcoder-react-ui-kit'; import sortList from 'utils/challenge-detail/sort'; import challengeDetailsActions from 'actions/page/challenge-details'; import LoadingIndicator from 'components/LoadingIndicator'; -import { goToLogin } from 'utils/tc'; +import { goToLogin, getRatingLevel } from 'utils/tc'; import Lock from '../icons/lock.svg'; import SubmissionRow from './SubmissionRow'; import SubmissionInformationModal from './SubmissionInformationModal'; @@ -708,7 +707,7 @@ class SubmissionsComponent extends React.Component {
{ !isF2F && !isBugHunt && ( -
+
{ (s.registrant && !_.isNil(s.registrant.rating)) ? s.registrant.rating : '-'}
) From b6b7aed433a5ba359d4cadd739cffaeb6e307f19 Mon Sep 17 00:00:00 2001 From: prakashdurlabhji Date: Wed, 22 Jul 2020 04:21:16 +0530 Subject: [PATCH 3/3] css fix --- .../challenge-detail/Submissions/SubmissionRow/style.scss | 2 +- src/shared/components/challenge-detail/Submissions/style.scss | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/components/challenge-detail/Submissions/SubmissionRow/style.scss b/src/shared/components/challenge-detail/Submissions/SubmissionRow/style.scss index 146b858707..4f6023b3f1 100644 --- a/src/shared/components/challenge-detail/Submissions/SubmissionRow/style.scss +++ b/src/shared/components/challenge-detail/Submissions/SubmissionRow/style.scss @@ -212,4 +212,4 @@ .level-5 { color: $member-red !important; -} \ No newline at end of file +} diff --git a/src/shared/components/challenge-detail/Submissions/style.scss b/src/shared/components/challenge-detail/Submissions/style.scss index 5343a42cd9..85a3c7b5e8 100644 --- a/src/shared/components/challenge-detail/Submissions/style.scss +++ b/src/shared/components/challenge-detail/Submissions/style.scss @@ -374,4 +374,4 @@ .level-5 { color: $member-red !important; -} \ No newline at end of file +}