Skip to content

Commit 8979873

Browse files
committed
Submission delete button changes
#6614
1 parent fbd2824 commit 8979873

File tree

2 files changed

+29
-3
lines changed
  • src/shared
    • components/SubmissionManagement/Submission
    • containers/SubmissionManagement

2 files changed

+29
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default function Submission(props) {
9090
*/ }
9191
{status !== CHALLENGE_STATUS.COMPLETED
9292
&& track === COMPETITION_TRACKS.DES
93-
&& (
93+
&& safeForDownloadCheck === true && (
9494
<button
9595
styleName="delete-icon"
9696
onClick={() => onDelete(submissionObject.id)}
@@ -99,8 +99,8 @@ export default function Submission(props) {
9999
>
100100
<DeleteIcon />
101101
</button>
102-
)
103-
}
102+
)
103+
}
104104
<button
105105
styleName={`expand-icon ${(showScreeningDetails ? 'expanded' : '')}`}
106106
onClick={() => onShowDetails(submissionObject.id)}

src/shared/containers/SubmissionManagement/index.jsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import LoadingIndicator from 'components/LoadingIndicator';
1111
import SubmissionManagement from 'components/SubmissionManagement/SubmissionManagement';
1212
import React from 'react';
1313
import PT from 'prop-types';
14+
import { safeForDownload } from 'utils/tc';
1415
import { connect } from 'react-redux';
1516
import { Modal, PrimaryButton } from 'topcoder-react-ui-kit';
1617
import { config } from 'topcoder-react-utils';
@@ -28,6 +29,14 @@ const theme = {
2829

2930
// The container component
3031
class SubmissionManagementPageContainer extends React.Component {
32+
constructor(props) {
33+
super(props);
34+
35+
this.state = {
36+
needReload: false,
37+
};
38+
}
39+
3140
componentDidMount() {
3241
const {
3342
authTokens,
@@ -48,6 +57,23 @@ class SubmissionManagementPageContainer extends React.Component {
4857
}
4958
}
5059

60+
componentWillReceiveProps(nextProps) {
61+
const {
62+
loadMySubmissions, authTokens, challengeId, mySubmissions,
63+
} = nextProps;
64+
const { needReload } = this.state;
65+
66+
if (needReload === false && mySubmissions) {
67+
if (mySubmissions.find(item => safeForDownload(item.url) !== true)) {
68+
this.setState({ needReload: true });
69+
setTimeout(() => {
70+
loadMySubmissions(authTokens, challengeId);
71+
this.setState({ needReload: false });
72+
}, 2000);
73+
}
74+
}
75+
}
76+
5177
componentDidUpdate(prevProps) {
5278
const {
5379
loadMySubmissions, authTokens, deletionSucceed, challengeId,

0 commit comments

Comments
 (0)