import React from 'react'; import { Alert, Button, Modal, ProgressBar } from 'react-bootstrap'; import { UPLOAD_STAGES } from 'services/uploadService'; import constants from 'utils/strings/constants'; interface Props { fileCounter; uploadStage; now; closeModal; fileProgress: Map; show; } export default function UploadProgress(props: Props) { let fileProgressStatuses = []; if (props.fileProgress) { for (let [fileName, progress] of props.fileProgress) { fileProgressStatuses.push({ fileName, progress }); } fileProgressStatuses.sort((a, b) => { if (b.progress !== -1 && a.progress === -1) return 1; }); } return (

{props.uploadStage == UPLOAD_STAGES.UPLOADING ? props.fileCounter.total > 1 && constants.UPLOAD[props.uploadStage]( props.fileCounter ) : constants.UPLOAD[props.uploadStage]}

{props.now === 100 ? ( fileProgressStatuses.length !== 0 && ( {constants.FAILED_UPLOAD_FILE_LIST} ) ) : ( )} {fileProgressStatuses?.length > 0 && (
    {fileProgressStatuses.map(({ fileName, progress }) => (
  • {props.now === 100 ? fileName : constants.FILE_UPLOAD_PROGRESS( fileName, progress )}
  • ))}
)} {props.now === 100 && ( )}
); }