Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(Upload):update-ux

Aswin Asok680288c4f752
diff --git a/web/apps/photos/package.json b/web/apps/photos/package.json
index a1f85fa7cc..ebd56d8037 100644
--- a/web/apps/photos/package.json
+++ b/web/apps/photos/package.json
@@ -6,7 +6,7 @@
"test": "vitest --run"
},
"dependencies": {
- "@fontsource/outfit": "5.2.8",
+ "@fontsource-variable/outfit": "5.2.8",
"@hugeicons/core-free-icons": "1.2.1",
"@hugeicons/react": "1.1.6",
"chrono-node": "2.9.1",
diff --git a/web/apps/photos/src/components/DefaultOptionsV2.tsx b/web/apps/photos/src/components/DefaultOptionsV2.tsx
index e4fea4b0a5..9382eb7363 100644
--- a/web/apps/photos/src/components/DefaultOptionsV2.tsx
+++ b/web/apps/photos/src/components/DefaultOptionsV2.tsx
@@ -7,6 +7,7 @@ import {
Box,
CircularProgress,
IconButton,
+ Link,
Stack,
Typography,
} from "@mui/material";
@@ -24,6 +25,47 @@ interface DefaultOptionsV2Props {
onSelectFolder: () => void;
}
+const importHelp = (
+ <Typography
+ sx={{
+ color: "text.faint",
+ fontSize: "14px",
+ fontWeight: 500,
+ lineHeight: "20px",
+ textAlign: "center",
+ }}
+ >
+ <Link
+ href="https://ente.com/help/photos/migration/#import-your-photos-into-ente"
+ target="_blank"
+ rel="noopener"
+ sx={{
+ color: "accent.main",
+ fontWeight: 500,
+ textDecoration: "underline",
+ }}
+ >
+ Need help?
+ </Link>{" "}
+ <span style={{ opacity: 0.7 }}>Not seeing your provider</span>
+ </Typography>
+);
+
+const dragAndDropHint = (
+ <Typography
+ sx={{
+ color: "text.faint",
+ fontSize: "12px",
+ fontWeight: 500,
+ lineHeight: "16px",
+ opacity: 0.7,
+ textAlign: "center",
+ }}
+ >
+ Or just drag and drop here
+ </Typography>
+);
+
export function DefaultOptionsV2({
intent,
isFileSelectionPending,
@@ -41,7 +83,7 @@ export function DefaultOptionsV2({
<SpacedRow>
<Typography
sx={{
- fontFamily: "'Outfit', sans-serif",
+ fontFamily: "'Outfit Variable', sans-serif",
fontSize: "24px",
fontWeight: 600,
lineHeight: "32px",
@@ -67,7 +109,13 @@ export function DefaultOptionsV2({
</SpacedRow>
{intent == "import" ? (
- <ImportOptions {...{ onSelectGooglePhotos }} />
+ <ImportOptions
+ {...{
+ isFolderSelectionPending,
+ onSelectGooglePhotos,
+ onSelectFolder,
+ }}
+ />
) : (
<UploadOptions
{...{
@@ -83,24 +131,45 @@ export function DefaultOptionsV2({
);
}
-type ImportOptionsProps = Pick<DefaultOptionsV2Props, "onSelectGooglePhotos">;
+type ImportOptionsProps = Pick<
+ DefaultOptionsV2Props,
+ "isFolderSelectionPending" | "onSelectGooglePhotos" | "onSelectFolder"
+>;
function ImportOptions({
+ isFolderSelectionPending,
onSelectGooglePhotos,
+ onSelectFolder,
}: ImportOptionsProps): React.JSX.Element {
return (
- <Stack direction="row" sx={{ gap: "10px", pb: "12px" }}>
- <ImportProviderButton
- icon={
- <HugeiconsIcon
- icon={Album02Icon}
- size={22}
- color="var(--mui-palette-text-muted)"
- />
- }
- label="Google Photos"
- onClick={onSelectGooglePhotos}
- />
+ <Stack sx={{ gap: "20px" }}>
+ <Stack direction="row" sx={{ gap: "10px" }}>
+ <ImportProviderButton
+ icon={
+ <HugeiconsIcon
+ icon={Album02Icon}
+ size={22}
+ color="var(--mui-palette-text-muted)"
+ />
+ }
+ label="Google Photos"
+ onClick={onSelectGooglePhotos}
+ />
+ <ImportProviderButton
+ icon={
+ <HugeiconsIcon
+ icon={Folder01Icon}
+ size={22}
+ color="var(--mui-palette-text-muted)"
+ />
+ }
+ label="Folder"
+ pending={isFolderSelectionPending}
+ onClick={onSelectFolder}
+ />
+ </Stack>
+ {dragAndDropHint}
+ {importHelp}
</Stack>
);
}
@@ -122,7 +191,7 @@ function UploadOptions({
onSelectFolder,
}: UploadOptionsProps): React.JSX.Element {
return (
- <Stack sx={{ gap: "36px" }}>
+ <Stack sx={{ gap: "24px" }}>
<ImportSection title="Upload from">
<Stack direction="row" sx={{ gap: "10px" }}>
<ImportProviderButton
@@ -150,6 +219,7 @@ function UploadOptions({
onClick={onSelectFolder}
/>
</Stack>
+ {dragAndDropHint}
</ImportSection>
<ImportSection title="Import from" gap="20px">
@@ -163,6 +233,7 @@ function UploadOptions({
onClick={onSelectGooglePhotos}
/>
</ImportSection>
+ {importHelp}
</Stack>
);
}
diff --git a/web/apps/photos/src/components/TakeoutOptionsV2.tsx b/web/apps/photos/src/components/TakeoutOptionsV2.tsx
index 6f4ff496a4..dc1dea9ddb 100644
--- a/web/apps/photos/src/components/TakeoutOptionsV2.tsx
+++ b/web/apps/photos/src/components/TakeoutOptionsV2.tsx
@@ -4,6 +4,7 @@ import ArrowBackIcon from "@mui/icons-material/ArrowBack";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import CloseIcon from "@mui/icons-material/Close";
import { Box, IconButton, Link, Stack, Typography } from "@mui/material";
+import { isDesktop } from "ente-base/app";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import React from "react";
@@ -40,7 +41,7 @@ export function TakeoutOptionsV2({
</IconButton>
<Typography
sx={{
- fontFamily: "'Outfit', sans-serif",
+ fontFamily: "'Outfit Variable', sans-serif",
fontSize: "24px",
fontWeight: 600,
lineHeight: "32px",
@@ -77,25 +78,40 @@ export function TakeoutOptionsV2({
<TakeoutOptionButton
icon={<HugeiconsIcon icon={FileZipIcon} size={18} />}
label="ZIP files"
- description="Select your ZIPs, we'll unzip them for you"
+ description={
+ isDesktop
+ ? "Select your ZIPs, we'll unzip them for you"
+ : "Desktop only"
+ }
+ disabled={!isDesktop}
onClick={onSelectZips}
/>
</Stack>
- <Link
- href="https://ente.com/help/photos/migration/from-google-photos/"
- target="_blank"
- rel="noopener"
+ <Typography
sx={{
alignSelf: "center",
- color: "accent.main",
+ color: "text.faint",
fontSize: "14px",
fontWeight: 500,
lineHeight: "20px",
- textDecoration: "underline",
}}
>
- Need help?
- </Link>
+ <span style={{ opacity: 0.7 }}>
+ Still have confusions?{" "}
+ </span>
+ <Link
+ href="https://ente.com/help/photos/migration/from-google-photos/"
+ target="_blank"
+ rel="noopener"
+ sx={{
+ color: "accent.main",
+ fontWeight: 500,
+ textDecoration: "underline",
+ }}
+ >
+ We&apos;re here to help
+ </Link>
+ </Typography>
</Stack>
</Stack>
);
@@ -105,6 +121,7 @@ interface TakeoutOptionButtonProps {
icon: React.ReactNode;
label: string;
description: string;
+ disabled?: boolean;
onClick: () => void;
}
@@ -112,11 +129,13 @@ function TakeoutOptionButton({
icon,
label,
description,
+ disabled,
onClick,
}: TakeoutOptionButtonProps): React.JSX.Element {
return (
<FocusVisibleButton
fullWidth
+ disabled={disabled}
onClick={onClick}
sx={(theme) => ({
height: "60px",
@@ -128,6 +147,11 @@ function TakeoutOptionButton({
...theme.applyStyles("dark", {
backgroundColor: "secondary.main",
}),
+ "&.Mui-disabled": {
+ backgroundColor: "secondary.main",
+ color: "text.faint",
+ opacity: 0.55,
+ },
})}
>
<Stack
@@ -170,18 +194,20 @@ function TakeoutOptionButton({
{description}
</Typography>
</Stack>
- <Box
- sx={{
- display: "flex",
- width: "48px",
- height: "36px",
- flexShrink: 0,
- alignItems: "center",
- justifyContent: "center",
- }}
- >
- <ChevronRightIcon sx={{ fontSize: "18px" }} />
- </Box>
+ {!disabled && (
+ <Box
+ sx={{
+ display: "flex",
+ width: "48px",
+ height: "36px",
+ flexShrink: 0,
+ alignItems: "center",
+ justifyContent: "center",
+ }}
+ >
+ <ChevronRightIcon sx={{ fontSize: "18px" }} />
+ </Box>
+ )}
</Stack>
</FocusVisibleButton>
);
diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx
index cf5c5db11a..d49432cdaf 100644
--- a/web/apps/photos/src/pages/_app.tsx
+++ b/web/apps/photos/src/pages/_app.tsx
@@ -1,7 +1,7 @@
import { useDesktopAppLockRoute } from "@/components/utils/use-app-lock-route";
import { photosLogout } from "@/services/logout";
import "@fontsource-variable/inter";
-import "@fontsource/outfit/700.css";
+import "@fontsource-variable/outfit";
import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
import { CssBaseline, Typography } from "@mui/material";
import { styled, ThemeProvider } from "@mui/material/styles";
diff --git a/web/package-lock.json b/web/package-lock.json
index f88d61b852..f2ef7f2472 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -277,7 +277,7 @@
"apps/photos": {
"version": "0.0.0",
"dependencies": {
- "@fontsource/outfit": "5.2.8",
+ "@fontsource-variable/outfit": "5.2.8",
"@hugeicons/core-free-icons": "1.2.1",
"@hugeicons/react": "1.1.6",
"chrono-node": "2.9.1",
@@ -1076,6 +1076,15 @@
"url": "https://github.com/sponsors/ayuhito"
}
},
+ "node_modules/@fontsource-variable/outfit": {
+ "version": "5.2.8",
+ "resolved": "https://registry.npmjs.org/@fontsource-variable/outfit/-/outfit-5.2.8.tgz",
+ "integrity": "sha512-4oUDCZx/Tcz6HZP423w/niqEH31Gks5IsqHV2ZZz1qKHaVIZdj2f0/S1IK2n8jl6Xo0o3N+3RjNHlV9R73ozQA==",
+ "license": "OFL-1.1",
+ "funding": {
+ "url": "https://github.com/sponsors/ayuhito"
+ }
+ },
"node_modules/@fontsource/gochi-hand": {
"version": "5.2.8",
"resolved": "https://registry.npmjs.org/@fontsource/gochi-hand/-/gochi-hand-5.2.8.tgz",
@@ -1094,15 +1103,6 @@
"url": "https://github.com/sponsors/ayuhito"
}
},
- "node_modules/@fontsource/outfit": {
- "version": "5.2.8",
- "resolved": "https://registry.npmjs.org/@fontsource/outfit/-/outfit-5.2.8.tgz",
- "integrity": "sha512-rXC6g0MqD7cOBjht0bMqc43qM6lRqDLML9KXsmg9uykz0wLQhy8Z/ajrMG6iyoT3NJR+MYgU+OEHp7uHoTb+Yw==",
- "license": "OFL-1.1",
- "funding": {
- "url": "https://github.com/sponsors/ayuhito"
- }
- },
"node_modules/@fontsource/space-grotesk": {
"version": "5.2.10",
"resolved": "https://registry.npmjs.org/@fontsource/space-grotesk/-/space-grotesk-5.2.10.tgz",
diff --git a/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx b/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
index f58d5328a6..b54abf8c98 100644
--- a/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
+++ b/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
@@ -6,7 +6,7 @@ import { EnteLogo } from "ente-base/components/EnteLogo";
import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
import type { UploadTypeSelectorIntent } from "ente-gallery/components/Upload";
import { t } from "i18next";
-import React from "react";
+import React, { useEffect, useState } from "react";
import { Trans } from "react-i18next";
interface GalleryEmptyStateV2Props {
@@ -24,6 +24,22 @@ interface GalleryEmptyStateV2Props {
const galleryEmptyStateShelfTiles = Array.from({ length: 20 }, (_, i) => i);
const galleryEmptyStateGridTiles = Array.from({ length: 56 }, (_, i) => i);
+const memoriesPreservedCountEndpoint = "https://api.ente.com/files/count";
+const memoriesPreservedCountRefreshInterval = 15_000;
+
+const parseMemoriesPreservedCount = (response: unknown) =>
+ typeof response == "object" &&
+ response != null &&
+ "count" in response &&
+ typeof response.count == "number" &&
+ Number.isFinite(response.count)
+ ? Math.trunc(response.count)
+ : undefined;
+
+const memoriesPreservedSince = (
+ initialCount: number | undefined,
+ nextCount: number,
+) => Math.max(0, nextCount - (initialCount ?? nextCount));
export function GalleryEmptyStateV2({
isUploadInProgress,
@@ -59,15 +75,16 @@ export function GalleryEmptyStateV2({
flexDirection: "column",
alignItems: "center",
width: "min(600px, 100%)",
- height: { xs: 428, sm: 512 },
+ height: { xs: 478, sm: 538 },
flexShrink: 0,
mt: { xs: "72px", sm: "88px" },
- transform: "translateY(-16px)",
+ transform: "translateY(-28px)",
px: { xs: 2.5, sm: 4 },
- pt: { xs: "150px", sm: "232px" },
- pb: { xs: 4, sm: "44px" },
+ pt: { xs: "180px", sm: "232px" },
+ pb: "20px",
borderRadius: { xs: "30px", sm: "42px" },
bgcolor: "background.paper",
+ boxShadow: "0 12px 24px -18px rgba(0 0 0 / 0.08)",
zIndex: 2,
}}
>
@@ -79,7 +96,7 @@ export function GalleryEmptyStateV2({
<Stack
sx={{
alignItems: "center",
- gap: "24px",
+ gap: "28px",
mt: { xs: "6px", sm: "8px" },
textAlign: "center",
userSelect: "none",
@@ -93,14 +110,14 @@ export function GalleryEmptyStateV2({
justifyContent: "center",
gap: { xs: "6px", sm: "8px" },
color: "text.base",
- fontFamily: "'Outfit', sans-serif",
- fontSize: { xs: "26px", sm: "34px" },
- lineHeight: { xs: "20px", sm: "26px" },
+ fontFamily: "'Outfit Variable', sans-serif",
+ fontSize: { xs: "28px", sm: "36px" },
+ lineHeight: { xs: "22px", sm: "28px" },
fontWeight: 700,
svg: {
color: "text.base",
- height: { xs: 18, sm: "22.592px" },
- width: { xs: 61, sm: 76 },
+ height: { xs: 19, sm: 24 },
+ width: { xs: 64, sm: 80 },
flexShrink: 0,
transform: {
xs: "translateY(1px)",
@@ -137,7 +154,7 @@ export function GalleryEmptyStateV2({
disabled={isUploadInProgress}
startIcon={<FileDownloadIcon />}
>
- Import your existing library
+ Upload your existing library
</GalleryEmptyStateButton>
<GalleryEmptyStateButton
color="secondary"
@@ -154,11 +171,69 @@ export function GalleryEmptyStateV2({
{t("upload_first_photo")}
</GalleryEmptyStateButton>
</Stack>
+ <MemoriesPreservedCount />
</Paper>
</Stack>
);
}
+function MemoriesPreservedCount(): React.JSX.Element | null {
+ const [count, setCount] = useState<number>();
+
+ useEffect(() => {
+ const abortController = new AbortController();
+ let initialCount: number | undefined;
+
+ const refreshCount = () => {
+ void fetch(memoriesPreservedCountEndpoint, {
+ signal: abortController.signal,
+ })
+ .then((response) => (response.ok ? response.json() : undefined))
+ .then((response: unknown) => {
+ const nextCount = parseMemoriesPreservedCount(response);
+ if (nextCount == undefined) return;
+
+ setCount(memoriesPreservedSince(initialCount, nextCount));
+ initialCount ??= nextCount;
+ })
+ .catch(() => undefined);
+ };
+
+ refreshCount();
+ const initialRefreshTimeoutID = window.setTimeout(refreshCount, 4_000);
+ const intervalID = window.setInterval(() => {
+ if (!document.hidden) refreshCount();
+ }, memoriesPreservedCountRefreshInterval);
+
+ return () => {
+ abortController.abort();
+ window.clearTimeout(initialRefreshTimeoutID);
+ window.clearInterval(intervalID);
+ };
+ }, []);
+
+ return count == undefined ? null : (
+ <Typography
+ sx={{
+ mt: "32px",
+ width: "100%",
+ color: "text.faint",
+ fontFamily: "'Outfit Variable', sans-serif",
+ fontSize: "13px",
+ fontWeight: 500,
+ fontVariantNumeric: "tabular-nums",
+ lineHeight: "18px",
+ opacity: 0.65,
+ textAlign: "center",
+ userSelect: "none",
+ }}
+ >
+ {count.toLocaleString("en-US")} {count == 1 ? "memory" : "memories"}{" "}
+ secured since you came here
+ </Typography>
+ );
+}
+
function GalleryEmptyStateSkeleton(): React.JSX.Element {
return (
<GalleryEmptyStateSkeletonRoot aria-hidden>
@@ -199,6 +274,10 @@ const GalleryEmptyStateSkeletonRoot = styled("div")(({ theme }) => {
boxSizing: "border-box",
display: "flex",
flexDirection: "column",
+ maskImage:
+ "linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.1) 100%)",
+ WebkitMaskImage:
+ "linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.1) 100%)",
".skeleton-albums": { marginTop: 0 },
".skeleton-gallery": {
display: "flex",
@@ -268,7 +347,7 @@ const GalleryEmptyStateSkeletonOverlay = styled("div")(({ theme }) => ({
inset: 0,
zIndex: 1,
pointerEvents: "none",
- opacity: 0.72,
+ opacity: 0.6,
background: theme.vars.palette.background.default,
}));
@@ -279,12 +358,12 @@ const GalleryEmptyStateButton = styled(FocusVisibleButton)(({ theme }) => ({
paddingInline: 24,
fontSize: theme.typography.small.fontSize,
lineHeight: "20px",
- fontWeight: theme.typography.fontWeightMedium,
+ fontWeight: 500,
"&.MuiButton-containedAccent:not(.Mui-disabled)": {
backgroundColor: "#08C225",
"&:hover": { backgroundColor: "#08C225" },
},
- "& .MuiButton-startIcon": { marginRight: 8, "& > svg": { fontSize: 20 } },
+ "& .MuiButton-startIcon": { marginRight: 14, "& > svg": { fontSize: 20 } },
}));
/**
@@ -294,11 +373,11 @@ const GalleryEmptyStateButton = styled(FocusVisibleButton)(({ theme }) => ({
const NonDraggableImage = styled("img")(({ theme }) => ({
position: "absolute",
top: -96,
- width: 310,
+ width: 300,
maxWidth: "calc(100% - 48px)",
aspectRatio: "351 / 305.183",
height: "auto",
pointerEvents: "none",
userSelect: "none",
- [theme.breakpoints.down("sm")]: { top: -80, width: 264 },
+ [theme.breakpoints.down("sm")]: { top: -80, width: 256 },
}));