Skip to content

Commit

Permalink
Submission delete button changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jmgasper committed Aug 18, 2022
1 parent a7757dd commit 8f90827
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default function Submission(props) {
*/ }
{status !== CHALLENGE_STATUS.COMPLETED
&& track === COMPETITION_TRACKS.DES
&& (
&& safeForDownloadCheck === true && (
<button
styleName="delete-icon"
onClick={() => onDelete(submissionObject.id)}
Expand All @@ -99,8 +99,8 @@ export default function Submission(props) {
>
<DeleteIcon />
</button>
)
}
)
}
<button
styleName={`expand-icon ${(showScreeningDetails ? 'expanded' : '')}`}
onClick={() => onShowDetails(submissionObject.id)}
Expand Down
26 changes: 26 additions & 0 deletions src/shared/containers/SubmissionManagement/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import LoadingIndicator from 'components/LoadingIndicator';
import SubmissionManagement from 'components/SubmissionManagement/SubmissionManagement';
import React from 'react';
import PT from 'prop-types';
import { safeForDownload } from 'utils/tc';
import { connect } from 'react-redux';
import { Modal, PrimaryButton } from 'topcoder-react-ui-kit';
import { config } from 'topcoder-react-utils';
Expand All @@ -28,6 +29,14 @@ const theme = {

// The container component
class SubmissionManagementPageContainer extends React.Component {
constructor(props) {
super(props);

this.state = {
needReload: false,
};
}

componentDidMount() {
const {
authTokens,
Expand All @@ -48,6 +57,23 @@ class SubmissionManagementPageContainer extends React.Component {
}
}

componentWillReceiveProps(nextProps) {
const {
loadMySubmissions, authTokens, challengeId, mySubmissions,
} = nextProps;
const { needReload } = this.state;

if (needReload === false && mySubmissions) {
if (mySubmissions.find(item => safeForDownload(item.url) !== true)) {
this.setState({ needReload: true });
setTimeout(() => {
loadMySubmissions(authTokens, challengeId);
this.setState({ needReload: false });
}, 2000);
}
}
}

componentDidUpdate(prevProps) {
const {
loadMySubmissions, authTokens, deletionSucceed, challengeId,
Expand Down

0 comments on commit 8f90827

Please sign in to comment.