ente/src/components/ExportFinished.tsx

56 lines
2.3 KiB
TypeScript
Raw Normal View History

2021-07-06 11:23:13 +00:00
import React from 'react';
import { Button } from 'react-bootstrap';
import { ExportStats } from 'services/exportService';
2021-07-06 11:23:13 +00:00
import { formatDateTime } from 'utils/file';
import constants from 'utils/strings/constants';
import { Label, Row, Value } from './Container';
import { ComfySpan } from './ExportInProgress';
import InProgressIcon from './icons/InProgressIcon';
2021-07-07 07:44:52 +00:00
interface Props {
show: boolean
onHide: () => void
exportFolder: string
exportSize: string
lastExportTime: number
exportStats: ExportStats
updateExportFolder: (newFolder: string) => void;
2021-07-12 09:15:08 +00:00
exportFiles: () => void;
retryFailed: () => void;
2021-07-07 07:44:52 +00:00
}
export default function ExportFinished(props: Props) {
const totalFiles = props.exportStats.failed + props.exportStats.success;
2021-07-06 11:23:13 +00:00
return (
2021-07-07 09:20:59 +00:00
<>
2021-07-06 11:23:13 +00:00
<div style={{ borderBottom: '1px solid #444', marginBottom: '20px', padding: '0 5%' }}>
<Row>
<Label width="40%">{constants.LAST_EXPORT_TIME}</Label>
2021-07-07 07:44:52 +00:00
<Value width="60%">{formatDateTime(props.lastExportTime)}</Value>
2021-07-06 11:23:13 +00:00
</Row>
<Row>
<Label width="60%">{constants.SUCCESSFULLY_EXPORTED_FILES}</Label>
<Value width="35%"><ComfySpan>{props.exportStats.success} / {totalFiles}</ComfySpan></Value>
2021-07-06 11:23:13 +00:00
</Row>
<Row>
<Label width="60%">{constants.FAILED_EXPORTED_FILES}</Label>
<Value width="35%">
<ComfySpan>{props.exportStats.failed} / {totalFiles}</ComfySpan>
2021-07-06 11:23:13 +00:00
</Value>
2021-07-07 07:44:52 +00:00
{props.exportStats.failed !== 0 &&
<Value width="5%">
2021-07-12 12:05:29 +00:00
<InProgressIcon disabled onClick={props.retryFailed} />
2021-07-07 07:44:52 +00:00
</Value>
}
2021-07-06 11:23:13 +00:00
</Row>
</div>
<div style={{ width: '100%', display: 'flex', justifyContent: 'space-around' }}>
2021-07-07 07:44:52 +00:00
<Button block variant={'outline-secondary'} onClick={props.onHide}>{constants.CLOSE}</Button>
2021-07-06 11:23:13 +00:00
<div style={{ width: '30px' }} />
2021-07-12 09:15:08 +00:00
<Button block variant={'outline-success'} onClick={props.exportFiles}>{constants.EXPORT_AGAIN}</Button>
2021-07-06 11:23:13 +00:00
</div>
2021-07-07 09:20:59 +00:00
</>
2021-07-06 11:23:13 +00:00
);
}