import React, { Fragment } from 'react'; import PropTypes from 'prop-types'; import { gettext } from '../../utils/constants'; import UploadListItem from './upload-list-item'; const propTypes = { uploadBitrate: PropTypes.string.isRequired, totalProgress: PropTypes.number.isRequired, uploadFileList: PropTypes.array.isRequired, onCloseUploadDialog: PropTypes.func.isRequired, onCancelAllUploading: PropTypes.func.isRequired, onUploadCancel: PropTypes.func.isRequired, }; class UploadProgressDialog extends React.Component { constructor(props) { super(props); this.state = { isMinimized: false }; } onCancelAllUploading = () => { this.props.onCancelAllUploading(); } onMinimizeUpload = (e) => { e.nativeEvent.stopImmediatePropagation(); this.setState({isMinimized: !this.state.isMinimized}); } onCloseUpload = (e) => { e.nativeEvent.stopImmediatePropagation(); this.props.onCloseUploadDialog(); } render() { let uploadedMessage = gettext('File Upload'); let uploadingMessage = gettext('File Uploading...') + ' ' + this.props.totalProgress + '%' + ' (' + this.props.uploadBitrate + ')'; let uploadingOptions = (); let uploadedOptions = ( ); let totalProgress = this.props.totalProgress; return (
{totalProgress === 100 ? uploadedMessage : uploadingMessage}
{totalProgress === 100 ? uploadedOptions : uploadingOptions}
{(this.props.totalProgress !== 100) && } { this.props.uploadFileList.map((item, index) => { return ( ); }) }
{gettext('name')} {gettext('progress')} {gettext('state')}
{gettext('Cancel All')}
); } } UploadProgressDialog.propTypes = propTypes; export default UploadProgressDialog;