2021-07-06 09:20:15 +00:00
|
|
|
import { DeadCenter } from 'pages/gallery';
|
|
|
|
import React from 'react';
|
|
|
|
import { Button } from 'react-bootstrap';
|
|
|
|
import constants from 'utils/strings/constants';
|
2021-07-08 06:42:28 +00:00
|
|
|
import { ExportStage } from './ExportModal';
|
2021-07-06 09:20:15 +00:00
|
|
|
|
2021-07-07 05:31:48 +00:00
|
|
|
interface Props {
|
|
|
|
show: boolean
|
|
|
|
onHide: () => void
|
|
|
|
updateExportFolder: (newFolder: string) => void;
|
2021-07-08 06:42:28 +00:00
|
|
|
updateExportStage: (newState: ExportStage) => void;
|
2021-07-07 05:31:48 +00:00
|
|
|
exportFolder: string
|
|
|
|
exportFiles: () => void
|
|
|
|
exportSize: string;
|
2021-07-07 09:20:59 +00:00
|
|
|
selectExportDirectory: () => void
|
2021-07-07 05:31:48 +00:00
|
|
|
}
|
|
|
|
export default function ExportInit(props: Props) {
|
|
|
|
const startExport = async () => {
|
|
|
|
if (!props.exportFolder) {
|
2021-07-07 09:20:59 +00:00
|
|
|
await props.selectExportDirectory();
|
2021-07-07 05:31:48 +00:00
|
|
|
}
|
|
|
|
props.exportFiles();
|
2021-07-08 06:42:28 +00:00
|
|
|
props.updateExportStage(ExportStage.INPROGRESS);
|
2021-07-07 05:31:48 +00:00
|
|
|
};
|
2021-07-06 09:20:15 +00:00
|
|
|
return (
|
2021-07-07 09:20:59 +00:00
|
|
|
<>
|
2021-07-06 09:20:15 +00:00
|
|
|
<DeadCenter >
|
2021-07-07 05:31:48 +00:00
|
|
|
<Button
|
|
|
|
variant="outline-success"
|
|
|
|
size="lg"
|
|
|
|
style={{
|
|
|
|
padding: '6px 3em',
|
|
|
|
margin: '0 20px',
|
|
|
|
marginBottom: '20px',
|
|
|
|
flex: 1,
|
|
|
|
whiteSpace: 'nowrap',
|
|
|
|
}}
|
|
|
|
onClick={startExport}
|
|
|
|
>{constants.START}</Button>
|
2021-07-06 09:20:15 +00:00
|
|
|
</DeadCenter>
|
2021-07-07 09:20:59 +00:00
|
|
|
</>
|
2021-07-06 09:20:15 +00:00
|
|
|
);
|
|
|
|
}
|