Skip to content

Commit b66b683

Browse files
committed
fix: lint
1 parent 9d544a6 commit b66b683

File tree

6 files changed

+67
-59
lines changed

6 files changed

+67
-59
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,67 @@
1-
import React, { useCallback, useEffect, useState } from 'react'
2-
import PropTypes from 'prop-types'
3-
import _ from 'lodash'
1+
import React, { useCallback, useEffect, useState } from 'react';
2+
import PropTypes from 'prop-types';
3+
import _ from 'lodash';
44

55
import { Modal } from 'topcoder-react-ui-kit';
66
import LoadingIndicator from 'components/LoadingIndicator';
77
import IconClose from 'assets/images/icon-close-green.svg';
88

99

10-
import styles from './styles.scss'
10+
import styles from './styles.scss';
1111

1212
const theme = {
1313
container: styles.modalContainer,
1414
overlay: styles.modalOverlay,
1515
};
1616

1717
const SystemReviewers = {
18-
Default: 'TC System'
18+
Default: 'TC System',
1919
};
2020

21-
export const RatingsListModal = ({ onCancel, submissionId, challengeId, getReviewTypesList, getChallengeResources, getSubmissionInformation }) => {
22-
const [reviews, setReviews] = useState([])
23-
const [loading, setLoading] = useState(false)
21+
const RatingsListModal = ({
22+
onCancel,
23+
submissionId,
24+
challengeId,
25+
getReviewTypesList,
26+
getChallengeResources,
27+
getSubmissionInformation,
28+
}) => {
29+
const [reviews, setReviews] = useState([]);
30+
const [loading, setLoading] = useState(false);
2431

2532
const enrichSources = useCallback(async (submissionReviews, reviewSummation) => {
26-
27-
const reviewTypes = await getReviewTypesList()
28-
const resources = await getChallengeResources(challengeId)
33+
const reviewTypes = await getReviewTypesList();
34+
const resources = await getChallengeResources(challengeId);
2935

3036
const finalReview = {
3137
reviewType: 'Final score',
3238
reviewer: '',
3339
score: reviewSummation ? reviewSummation.aggregateScore : 'N/A',
34-
isPassing: reviewSummation ? reviewSummation.isPassing : undefined
35-
}
40+
isPassing: reviewSummation ? reviewSummation.isPassing : undefined,
41+
};
3642

37-
return [...submissionReviews.map(review => {
38-
const reviewType = reviewTypes.find(rt => rt.id === review.typeId)
39-
const reviewer = resources.find(resource => resource.memberHandle === review.reviewerId) || SystemReviewers.Default
43+
return [...submissionReviews.map((review) => {
44+
const reviewType = reviewTypes.find(rt => rt.id === review.typeId);
45+
const reviewer = resources
46+
.find(resource => resource.memberHandle === review.reviewerId) || SystemReviewers.Default;
4047
return {
4148
...review,
4249
reviewType: reviewType ? reviewType.name : '',
43-
reviewer
44-
}
45-
}), finalReview]
46-
}, [challengeId, getReviewTypesList, getChallengeResources])
50+
reviewer,
51+
};
52+
}), finalReview];
53+
}, [challengeId, getReviewTypesList, getChallengeResources]);
4754

4855
const getSubmission = useCallback(async () => {
49-
const submissionInfo = await getSubmissionInformation(submissionId)
50-
setReviews(await enrichSources(submissionInfo.review, submissionInfo.reviewSummation[0]))
51-
setLoading(false)
52-
}, [submissionId, getSubmissionInformation, enrichSources])
56+
const submissionInfo = await getSubmissionInformation(submissionId);
57+
setReviews(await enrichSources(submissionInfo.review, submissionInfo.reviewSummation[0]));
58+
setLoading(false);
59+
}, [submissionId, getSubmissionInformation, enrichSources]);
5360

5461
useEffect(() => {
55-
setLoading(true)
56-
getSubmission()
57-
}, [submissionId, getSubmission])
62+
setLoading(true);
63+
getSubmission();
64+
}, [submissionId, getSubmission]);
5865

5966
return (
6067
<Modal onCancel={() => onCancel()} theme={theme}>
@@ -69,12 +76,12 @@ export const RatingsListModal = ({ onCancel, submissionId, challengeId, getRevie
6976
<div styleName="header-item">Score</div>
7077
<div styleName="header-item">Status</div>
7178
</div>
72-
{reviews.map(review => {
73-
const { isPassing } = review
74-
const isFailed = isPassing === false
75-
const isPassed = isPassing === true
76-
const statusIsDefined = isPassed || isFailed
77-
const status = isPassing ? 'Passed' : 'Failed'
79+
{reviews.map((review) => {
80+
const { isPassing } = review;
81+
const isFailed = isPassing === false;
82+
const isPassed = isPassing === true;
83+
const statusIsDefined = isPassed || isFailed;
84+
const status = isPassing ? 'Passed' : 'Failed';
7885

7986
return (
8087
<div styleName="list-item">
@@ -91,7 +98,7 @@ export const RatingsListModal = ({ onCancel, submissionId, challengeId, getRevie
9198
{statusIsDefined ? status : 'N/A'}
9299
</div>
93100
</div>
94-
)
101+
);
95102
})}
96103
</div>
97104

@@ -100,24 +107,25 @@ export const RatingsListModal = ({ onCancel, submissionId, challengeId, getRevie
100107
}
101108
</div>
102109
</Modal>
103-
)
104-
}
110+
);
111+
};
105112

106113
RatingsListModal.defaultProps = {
107114
onCancel: () => {},
108115
submissionId: '',
109116
challengeId: '',
110117
getReviewTypesList: _.noop,
111118
getChallengeResources: _.noop,
112-
getSubmissionInformation: _.noop
113-
}
119+
getSubmissionInformation: _.noop,
120+
};
114121

115122
RatingsListModal.propTypes = {
116123
onCancel: PropTypes.func,
117-
token: PropTypes.string,
118124
submissionId: PropTypes.string,
119125
challengeId: PropTypes.string,
120126
getReviewTypesList: PropTypes.func,
121127
getChallengeResources: PropTypes.func,
122-
getSubmissionInformation: PropTypes.func
123-
}
128+
getSubmissionInformation: PropTypes.func,
129+
};
130+
131+
export default RatingsListModal;

src/shared/components/SubmissionManagement/Submission/index.jsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import { COMPETITION_TRACKS, CHALLENGE_STATUS, safeForDownload } from 'utils/tc'
1818

1919
import PT from 'prop-types';
2020

21+
import Tooltip from 'components/Tooltip';
2122
import DeleteIcon from '../Icons/IconTrashSimple.svg';
2223
import DownloadIcon from '../Icons/IconSquareDownload.svg';
2324
import ArtifactsDownloadIcon from '../Icons/IconDownloadArtifacts.svg';
2425
import ReviewRatingListIcon from '../Icons/IconReviewRatingList.svg';
2526
import ExpandIcon from '../Icons/IconMinimalDown.svg';
2627
import ScreeningStatus from '../ScreeningStatus';
27-
import Tooltip from 'components/Tooltip';
2828

2929
import './styles.scss';
3030

@@ -104,26 +104,26 @@ export default function Submission(props) {
104104
: <span /> }
105105
{ !isTopCrowdChallenge
106106
? (
107-
<Tooltip content={() => <div styleName="tooltip-content">Download Submission Artifacts</div>}>
107+
<Tooltip content={() => <div styleName="tooltip-content">Download Submission Artifacts</div>}>
108108
<button
109109
onClick={() => onDownloadArtifacts()}
110110
type="button"
111111
styleName="download-artifacts-button"
112112
>
113-
{ safeForDownloadCheck === true ? <ArtifactsDownloadIcon /> : <span /> }
113+
{safeForDownloadCheck === true && <ArtifactsDownloadIcon />}
114114
</button>
115115
</Tooltip>
116116
)
117117
: <span /> }
118118
{ !isTopCrowdChallenge
119119
? (
120-
<Tooltip content={() => <div styleName="tooltip-content">Show Scores</div>}>
120+
<Tooltip content={() => <div styleName="tooltip-content">Show Scores</div>}>
121121
<button
122122
onClick={() => onOpenRatingsList()}
123123
type="button"
124124
styleName="download-artifacts-button"
125125
>
126-
{ safeForDownloadCheck === true ? <ReviewRatingListIcon /> : <span /> }
126+
{safeForDownloadCheck === true && <ReviewRatingListIcon />}
127127
</button>
128128
</Tooltip>
129129
)

src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* onOpenOnlineReview(submissionId); onHelp(submissionId);
1212
* onShowDetails(submissionId);
1313
* onSubmit() - to trigger when user clicks Add Submission button.
14-
**/
14+
*/
1515

1616
import _ from 'lodash';
1717
import LoadingIndicator from 'components/LoadingIndicator';

src/shared/components/SubmissionManagement/SubmissionsTable/index.jsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* onOpenOnlineReview(submissionId);
1313
* onHelp(submissionId);
1414
* onShowDetails(submissionId).
15-
**/
15+
*/
1616

1717
import _ from 'lodash';
1818
import React, { useState } from 'react';
@@ -23,7 +23,7 @@ import { COMPETITION_TRACKS } from 'utils/tc';
2323
import ScreeningDetails from '../ScreeningDetails';
2424
import DownloadArtifactsModal from '../DownloadArtifactsModal';
2525
import Submission from '../Submission';
26-
import { RatingsListModal } from '../RatingsListModal';
26+
import RatingsListModal from '../RatingsListModal';
2727

2828
import './styles.scss';
2929

@@ -143,7 +143,7 @@ export default function SubmissionsTable(props) {
143143
</tbody>
144144
</table>
145145
{showDownloadArtifactsModal && (
146-
<DownloadArtifactsModal
146+
<DownloadArtifactsModal
147147
onCancel={() => {
148148
setSubmissionId('');
149149
setShowDownloadArtifactsModal(false);
@@ -164,7 +164,8 @@ export default function SubmissionsTable(props) {
164164
submissionId={submissionId}
165165
challengeId={challenge.id}
166166
getSubmissionInformation={getSubmissionInformation}
167-
/>)}
167+
/>
168+
)}
168169
</div>
169170
);
170171
}

src/shared/containers/SubmissionManagement/index.jsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { connect } from 'react-redux';
1616
import { Modal, PrimaryButton } from 'topcoder-react-ui-kit';
1717
import { config } from 'topcoder-react-utils';
1818
import { actions, services } from 'topcoder-react-lib';
19-
import { getReviewTypes } from 'services/reviewTypes';
19+
import getReviewTypes from 'services/reviewTypes';
2020

2121
import style from './styles.scss';
2222
import smpActions from '../../actions/page/submission_management';
@@ -181,9 +181,9 @@ class SubmissionManagementPageContainer extends React.Component {
181181
const reviewTypes = getReviewTypes(authTokens.tokenV3);
182182
return reviewTypes;
183183
},
184-
getChallengeResources: (challengeId) => {
184+
getChallengeResources: (cId) => {
185185
const membersService = getMemberService(authTokens.tokenV3);
186-
return membersService.getChallengeResources(challengeId);
186+
return membersService.getChallengeResources(cId);
187187
},
188188
getSubmissionInformation: (submissionId) => {
189189
const submissionsService = getService(authTokens.tokenV3);

src/shared/services/reviewTypes.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@ import { config } from 'topcoder-react-utils';
33
const baseUrl = config.URL.REVIEW_API_URL;
44
const v5ApiUrl = config.API.V5;
55

6-
export const getReviewTypes = (tokenV3) => (
7-
fetch(`${v5ApiUrl}${baseUrl}?perPage=500&page=1`, {
6+
export default function getReviewTypes(tokenV3) {
7+
return fetch(`${v5ApiUrl}${baseUrl}?perPage=500&page=1`, {
88
method: 'GET',
99
headers: new Headers({
1010
Authorization: `Bearer ${tokenV3}`,
1111
}),
12-
},)
13-
.then(res => res.json())
14-
);
12+
}).then(res => res.json());
13+
}

0 commit comments

Comments
 (0)