import moment from 'moment';
import PropTypes from 'prop-types';
import React from 'react';
import Icon from 'Components/Icon';
import { icons, kinds } from 'Helpers/Props';
function QueueDetails(props) {
const {
title,
size,
sizeleft,
estimatedCompletionTime,
status,
trackedDownloadState,
trackedDownloadStatus,
errorMessage,
progressBar
} = props;
const progress = (100 - sizeleft / size * 100);
if (status === 'pending') {
return (
);
}
if (status === 'completed') {
if (errorMessage) {
return (
);
}
if (trackedDownloadStatus === 'warning') {
return (
);
}
if (trackedDownloadState === 'importPending') {
return (
);
}
if (trackedDownloadState === 'importing') {
return (
);
}
}
if (errorMessage) {
return (
);
}
if (status === 'failed') {
return (
);
}
if (status === 'warning') {
return (
);
}
if (progress < 5) {
return (
);
}
return progressBar;
}
QueueDetails.propTypes = {
title: PropTypes.string.isRequired,
size: PropTypes.number.isRequired,
sizeleft: PropTypes.number.isRequired,
estimatedCompletionTime: PropTypes.string,
status: PropTypes.string.isRequired,
trackedDownloadState: PropTypes.string.isRequired,
trackedDownloadStatus: PropTypes.string.isRequired,
errorMessage: PropTypes.string,
progressBar: PropTypes.node.isRequired
};
export default QueueDetails;