Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Inline

Manav Rathi854610dd4827
diff --git a/web/apps/photos/src/components/Export.tsx b/web/apps/photos/src/components/Export.tsx
index 78daa8b87b..c7bf0dcca3 100644
--- a/web/apps/photos/src/components/Export.tsx
+++ b/web/apps/photos/src/components/Export.tsx
@@ -3,6 +3,7 @@ import {
Box,
Button,
Dialog,
+ DialogActions,
DialogContent,
DialogTitle,
Divider,
@@ -21,11 +22,15 @@ import { EllipsizedTypography } from "ente-base/components/Typography";
import { SpacedRow } from "ente-base/components/containers";
import type { ButtonishProps } from "ente-base/components/mui";
import { DialogCloseIconButton } from "ente-base/components/mui/DialogCloseIconButton";
+import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
import { useBaseContext } from "ente-base/context";
import { ensureElectron } from "ente-base/electron";
+import { formattedNumber } from "ente-base/i18n";
+import { formattedDateTime } from "ente-base/i18n-date";
import log from "ente-base/log";
import { EnteFile } from "ente-media/file";
+import { SpaceBetweenFlex } from "ente-shared/components/Container";
import { CustomError } from "ente-shared/error";
import { t } from "i18next";
import { useEffect, useState } from "react";
@@ -37,9 +42,9 @@ import exportService, {
type ExportProgress,
type ExportSettings,
} from "services/export";
-import ExportFinished from "./ExportFinished";
import ExportInProgress from "./ExportInProgress";
import ExportInit from "./ExportInit";
+import ExportPendingList from "./ExportPendingList";
type ExportProps = ModalVisibilityProps & {
allCollectionsNameByID: Map<number, string>;
@@ -334,10 +339,10 @@ const ExportDynamicContent = ({
case ExportStage.finished:
return (
<ExportFinished
- onHide={onHide}
- lastExportTime={lastExportTime}
pendingExports={pendingExports}
+ lastExportTime={lastExportTime}
allCollectionsNameByID={allCollectionsNameByID}
+ onClose={onHide}
onResync={() => startExport({ resync: true })}
/>
);
@@ -346,3 +351,83 @@ const ExportDynamicContent = ({
return <></>;
}
};
+
+interface ExportFinishedProps {
+ pendingExports: EnteFile[];
+ lastExportTime: number;
+ allCollectionsNameByID: Map<number, string>;
+ onClose: () => void;
+ /**
+ * Called when the user presses the "Resync" button.
+ */
+ onResync: () => void;
+}
+
+const ExportFinished: React.FC<ExportFinishedProps> = ({
+ pendingExports,
+ lastExportTime,
+ allCollectionsNameByID,
+ onClose,
+ onResync,
+}) => {
+ const [pendingFileListView, setPendingFileListView] =
+ useState<boolean>(false);
+
+ const openPendingFileList = () => {
+ setPendingFileListView(true);
+ };
+
+ const closePendingFileList = () => {
+ setPendingFileListView(false);
+ };
+ return (
+ <>
+ <DialogContent>
+ <Stack sx={{ pr: 2 }}>
+ <SpaceBetweenFlex minHeight={"48px"}>
+ <Typography sx={{ color: "text.muted" }}>
+ {t("pending_items")}
+ </Typography>
+ {pendingExports.length ? (
+ <LinkButton onClick={openPendingFileList}>
+ {formattedNumber(pendingExports.length)}
+ </LinkButton>
+ ) : (
+ <Typography>
+ {formattedNumber(pendingExports.length)}
+ </Typography>
+ )}
+ </SpaceBetweenFlex>
+ <SpaceBetweenFlex minHeight={"48px"}>
+ <Typography sx={{ color: "text.muted" }}>
+ {t("last_export_time")}
+ </Typography>
+ <Typography>
+ {lastExportTime
+ ? formattedDateTime(new Date(lastExportTime))
+ : t("never")}
+ </Typography>
+ </SpaceBetweenFlex>
+ </Stack>
+ </DialogContent>
+ <DialogActions>
+ <FocusVisibleButton
+ fullWidth
+ color="secondary"
+ onClick={onClose}
+ >
+ {t("close")}
+ </FocusVisibleButton>
+ <FocusVisibleButton fullWidth onClick={onResync}>
+ {t("export_again")}
+ </FocusVisibleButton>
+ </DialogActions>
+ <ExportPendingList
+ pendingExports={pendingExports}
+ allCollectionsNameByID={allCollectionsNameByID}
+ isOpen={pendingFileListView}
+ onClose={closePendingFileList}
+ />
+ </>
+ );
+};
diff --git a/web/apps/photos/src/components/ExportFinished.tsx b/web/apps/photos/src/components/ExportFinished.tsx
deleted file mode 100644
index 5a87e612ac..0000000000
--- a/web/apps/photos/src/components/ExportFinished.tsx
+++ /dev/null
@@ -1,84 +0,0 @@
-import { DialogActions, DialogContent, Stack, Typography } from "@mui/material";
-import { LinkButton } from "ente-base/components/LinkButton";
-import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
-import { formattedNumber } from "ente-base/i18n";
-import { formattedDateTime } from "ente-base/i18n-date";
-import { EnteFile } from "ente-media/file";
-import { SpaceBetweenFlex } from "ente-shared/components/Container";
-import { t } from "i18next";
-import { useState } from "react";
-import ExportPendingList from "./ExportPendingList";
-
-interface Props {
- pendingExports: EnteFile[];
- allCollectionsNameByID: Map<number, string>;
- onHide: () => void;
- lastExportTime: number;
- /** Called when the user presses the "Resync" button. */
- onResync: () => void;
-}
-
-export default function ExportFinished(props: Props) {
- const { lastExportTime } = props;
-
- const [pendingFileListView, setPendingFileListView] =
- useState<boolean>(false);
-
- const openPendingFileList = () => {
- setPendingFileListView(true);
- };
-
- const closePendingFileList = () => {
- setPendingFileListView(false);
- };
- return (
- <>
- <DialogContent>
- <Stack sx={{ pr: 2 }}>
- <SpaceBetweenFlex minHeight={"48px"}>
- <Typography sx={{ color: "text.muted" }}>
- {t("pending_items")}
- </Typography>
- {props.pendingExports.length ? (
- <LinkButton onClick={openPendingFileList}>
- {formattedNumber(props.pendingExports.length)}
- </LinkButton>
- ) : (
- <Typography>
- {formattedNumber(props.pendingExports.length)}
- </Typography>
- )}
- </SpaceBetweenFlex>
- <SpaceBetweenFlex minHeight={"48px"}>
- <Typography sx={{ color: "text.muted" }}>
- {t("last_export_time")}
- </Typography>
- <Typography>
- {lastExportTime
- ? formattedDateTime(new Date(lastExportTime))
- : t("never")}
- </Typography>
- </SpaceBetweenFlex>
- </Stack>
- </DialogContent>
- <DialogActions>
- <FocusVisibleButton
- fullWidth
- color="secondary"
- onClick={props.onHide}
- >
- {t("close")}
- </FocusVisibleButton>
- <FocusVisibleButton fullWidth onClick={props.onResync}>
- {t("export_again")}
- </FocusVisibleButton>
- </DialogActions>
- <ExportPendingList
- pendingExports={props.pendingExports}
- allCollectionsNameByID={props.allCollectionsNameByID}
- isOpen={pendingFileListView}
- onClose={closePendingFileList}
- />
- </>
- );
-}