diff --git a/web/apps/photos/src/components/Export.tsx b/web/apps/photos/src/components/Export.tsx index 1fe4708d79..3864dc02e2 100644 --- a/web/apps/photos/src/components/Export.tsx +++ b/web/apps/photos/src/components/Export.tsx @@ -51,7 +51,9 @@ export const Export: React.FC = ({ allCollectionsNameByID, }) => { const { showMiniDialog } = useBaseContext(); - const [exportStage, setExportStage] = useState(ExportStage.INIT); + const [exportStage, setExportStage] = useState( + ExportStage.init, + ); const [exportFolder, setExportFolder] = useState(""); const [continuousExport, setContinuousExport] = useState(false); const [exportProgress, setExportProgress] = useState({ @@ -224,8 +226,8 @@ function ExportDirectory({ exportFolder, changeExportDirectory, exportStage }) { {exportFolder ? ( <> - {exportStage === ExportStage.FINISHED || - exportStage === ExportStage.INIT ? ( + {exportStage === ExportStage.finished || + exportStage === ExportStage.init ? ( @@ -303,15 +305,15 @@ const ExportDynamicContent = ({ allCollectionsNameByID: Map; }) => { switch (exportStage) { - case ExportStage.INIT: + case ExportStage.init: return ; - case ExportStage.MIGRATION: - case ExportStage.STARTING: - case ExportStage.EXPORTING_FILES: - case ExportStage.RENAMING_COLLECTION_FOLDERS: - case ExportStage.TRASHING_DELETED_FILES: - case ExportStage.TRASHING_DELETED_COLLECTIONS: + case ExportStage.migration: + case ExportStage.starting: + case ExportStage.exportingFiles: + case ExportStage.renamingCollectionFolders: + case ExportStage.trashingDeletedFiles: + case ExportStage.trashingDeletedCollections: return ( ); - case ExportStage.FINISHED: + case ExportStage.finished: return ( { return ( - props.exportStage === ExportStage.STARTING || - props.exportStage === ExportStage.MIGRATION || - props.exportStage === ExportStage.RENAMING_COLLECTION_FOLDERS || - props.exportStage === ExportStage.TRASHING_DELETED_FILES || - props.exportStage === ExportStage.TRASHING_DELETED_COLLECTIONS + props.exportStage === ExportStage.starting || + props.exportStage === ExportStage.migration || + props.exportStage === ExportStage.renamingCollectionFolders || + props.exportStage === ExportStage.trashingDeletedFiles || + props.exportStage === ExportStage.trashingDeletedCollections ); }; return ( @@ -35,18 +35,18 @@ export default function ExportInProgress(props: Props) { - {props.exportStage === ExportStage.STARTING ? ( + {props.exportStage === ExportStage.starting ? ( t("export_starting") - ) : props.exportStage === ExportStage.MIGRATION ? ( + ) : props.exportStage === ExportStage.migration ? ( t("preparing") ) : props.exportStage === - ExportStage.RENAMING_COLLECTION_FOLDERS ? ( + ExportStage.renamingCollectionFolders ? ( t("renaming_album_folders") ) : props.exportStage === - ExportStage.TRASHING_DELETED_FILES ? ( + ExportStage.trashingDeletedFiles ? ( t("trashing_deleted_files") ) : props.exportStage === - ExportStage.TRASHING_DELETED_COLLECTIONS ? ( + ExportStage.trashingDeletedCollections ? ( t("trashing_deleted_albums") ) : ( ; export const NULL_EXPORT_RECORD: ExportRecord = { version: 3, lastAttemptTimestamp: null, - stage: ExportStage.INIT, + stage: ExportStage.init, fileExportNames: {}, collectionExportNames: {}, }; @@ -239,23 +241,23 @@ class ExportService { async preExport(exportFolder: string) { await this.verifyExportFolderExists(exportFolder); const exportRecord = await this.getExportRecord(exportFolder); - await this.updateExportStage(ExportStage.MIGRATION); + await this.updateExportStage(ExportStage.migration); await this.runMigration( exportFolder, exportRecord, this.updateExportProgress.bind(this), ); - await this.updateExportStage(ExportStage.STARTING); + await this.updateExportStage(ExportStage.starting); } async postExport() { try { const exportFolder = this.getExportSettings()?.folder; if (!(await this.exportFolderExists(exportFolder))) { - this.uiUpdater.setExportStage(ExportStage.INIT); + this.uiUpdater.setExportStage(ExportStage.init); return; } - await this.updateExportStage(ExportStage.FINISHED); + await this.updateExportStage(ExportStage.finished); await this.updateLastExportTime(Date.now()); const exportRecord = await this.getExportRecord(exportFolder); @@ -401,7 +403,7 @@ class ExportService { }); }; if (renamedCollections?.length > 0) { - this.updateExportStage(ExportStage.RENAMING_COLLECTION_FOLDERS); + this.updateExportStage(ExportStage.renamingCollectionFolders); log.info(`renaming ${renamedCollections.length} collections`); await this.collectionRenamer( exportFolder, @@ -412,7 +414,7 @@ class ExportService { } if (removedFileUIDs?.length > 0) { - this.updateExportStage(ExportStage.TRASHING_DELETED_FILES); + this.updateExportStage(ExportStage.trashingDeletedFiles); log.info(`trashing ${removedFileUIDs.length} files`); await this.fileTrasher( exportFolder, @@ -422,7 +424,7 @@ class ExportService { ); } if (filesToExport?.length > 0) { - this.updateExportStage(ExportStage.EXPORTING_FILES); + this.updateExportStage(ExportStage.exportingFiles); log.info(`exporting ${filesToExport.length} files`); await this.fileExporter( filesToExport, @@ -435,9 +437,7 @@ class ExportService { ); } if (deletedExportedCollections?.length > 0) { - this.updateExportStage( - ExportStage.TRASHING_DELETED_COLLECTIONS, - ); + this.updateExportStage(ExportStage.trashingDeletedCollections); log.info( `removing ${deletedExportedCollections.length} collections`, ); @@ -1449,7 +1449,7 @@ const parseLivePhotoExportName = ( }; const isExportInProgress = (exportStage: ExportStage) => - exportStage > ExportStage.INIT && exportStage < ExportStage.FINISHED; + exportStage > ExportStage.init && exportStage < ExportStage.finished; /** * Move {@link fileName} in {@link collectionName} to the special per-collection