ente/src/components/ExportInit.tsx

44 lines
1.3 KiB
TypeScript
Raw Normal View History

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-07 05:31:48 +00:00
import { ExportState } 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;
updateExportState: (newState: ExportState) => void;
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();
props.updateExportState(ExportState.INPROGRESS);
};
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
);
}