Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(UploadProgressDetails):update-heading-to-prevent-duplication

Aswin Asokbb3fdc5a8d7c
diff --git a/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx b/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
index 09f07af001..165dac5f82 100644
--- a/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/UploadProgressDialog.tsx
@@ -4,6 +4,7 @@ import {
Box,
Dialog,
IconButton,
+ keyframes,
LinearProgress,
Stack,
Typography,
@@ -90,42 +91,66 @@ function UploadProgressV2Header() {
function UploadProgressV2Summary() {
const context = useUploadProgressContext();
const { uploadPhase, percentComplete } = context;
+ const isUploading = uploadPhase == "uploading";
+ const isDeterminate = isUploading || uploadPhase == "readingMetadata";
const progress = normalizePercent(percentComplete);
- const headline =
+ const headline = isUploading
+ ? `${progress.toLocaleString()}% uploaded`
+ : uploadStatusText(uploadPhase);
+ const supportingText =
+ uploadPhase == "preparing"
+ ? "Getting your upload ready"
+ : uploadPhase == "cancelling"
+ ? "Finishing active uploads safely"
+ : uploadCountsText(context);
+ const progressCaption =
uploadPhase == "readingMetadata"
- ? uploadStatusText(uploadPhase)
- : `${progress.toLocaleString()}% uploaded`;
+ ? "Reading file information"
+ : uploadPhase == "cancelling"
+ ? "This may take a moment"
+ : isUploading
+ ? uploadStatusText(uploadPhase)
+ : undefined;
return (
<Box sx={summaryLayoutSx}>
<Stack sx={{ gap: 2, minWidth: 0 }}>
<Stack sx={{ minWidth: 0, gap: "4px" }}>
- <Typography component="p" sx={titleTextSx}>
+ <Typography
+ component="p"
+ sx={[titleTextSx, !isDeterminate && waitingTitleSx]}
+ >
{headline}
</Typography>
- <Typography sx={mutedBodySx}>
- {uploadCountsText(context)}
- </Typography>
+ <Typography sx={mutedBodySx}>{supportingText}</Typography>
</Stack>
<Stack sx={{ gap: "10px" }}>
<LinearProgress
variant="determinate"
- value={progress}
+ value={isDeterminate ? progress : 0}
sx={mainProgressSx}
/>
- <Stack
- direction="row"
- sx={{
- justifyContent: "space-between",
- alignItems: "baseline",
- gap: 2,
- }}
- >
- <Typography sx={mutedCaptionSx}>
- {uploadStatusText(uploadPhase)}
- </Typography>
- <Typography sx={mutedCaptionSx}>{"100%"}</Typography>
- </Stack>
+ {(progressCaption || isDeterminate) && (
+ <Stack
+ direction="row"
+ sx={{
+ justifyContent: "space-between",
+ alignItems: "baseline",
+ gap: 2,
+ }}
+ >
+ {progressCaption && (
+ <Typography sx={mutedCaptionSx}>
+ {progressCaption}
+ </Typography>
+ )}
+ {isDeterminate && (
+ <Typography sx={mutedCaptionSx}>
+ {"100%"}
+ </Typography>
+ )}
+ </Stack>
+ )}
</Stack>
</Stack>
<Box
@@ -203,6 +228,22 @@ const headerActionButtonSx = (theme: Theme) => ({
}),
});
const titleTextSx = { fontSize: 24, lineHeight: "32px", fontWeight: 600 };
+const waitingDotsAnimation = keyframes`
+ 0% { content: "."; }
+ 33% { content: ".."; }
+ 66%, 100% { content: "..."; }
+`;
+const waitingTitleSx = {
+ "&::after": {
+ display: "inline-block",
+ width: "1.5em",
+ content: '""',
+ animation: `${waitingDotsAnimation} 1.2s steps(1, end) infinite`,
+ },
+ "@media (prefers-reduced-motion: reduce)": {
+ "&::after": { animation: "none", content: '"..."' },
+ },
+};
const uploadTitleSx = { ...ellipsisSx, ...titleTextSx };
const summaryLayoutSx = {
pl: "8px",
diff --git a/web/packages/gallery/components/upload-progress-v2/UploadProgressV2.tsx b/web/packages/gallery/components/upload-progress-v2/UploadProgressV2.tsx
index 40d66ce16d..1972c3cf1c 100644
--- a/web/packages/gallery/components/upload-progress-v2/UploadProgressV2.tsx
+++ b/web/packages/gallery/components/upload-progress-v2/UploadProgressV2.tsx
@@ -59,7 +59,7 @@ function UploadProgress({
* showStopConfirmation: If the user tries to close the upload, we show
* a confirmation modal, and this variable is the decider for that.
*/
- const [expanded, setExpanded] = useState(false);
+ const [expanded, setExpanded] = useState(true);
const [dragPosition, setDragPosition] = useState<DragPosition>();
const [showStopConfirmation, setShowStopConfirmation] = useState(false);
const [summaryMode, setSummaryMode] = useState<"review" | "cancelling">();