Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(Upload):update-v2-modal-dark-mode-colors

Aswin Asoke1b20ab5e1b8
diff --git a/web/apps/photos/src/components/DefaultOptionsV2.tsx b/web/apps/photos/src/components/DefaultOptionsV2.tsx
index e5f6daab92..e4fea4b0a5 100644
--- a/web/apps/photos/src/components/DefaultOptionsV2.tsx
+++ b/web/apps/photos/src/components/DefaultOptionsV2.tsx
@@ -1,8 +1,4 @@
-import {
- Album02Icon,
- File01Icon,
- Folder01Icon,
-} from "@hugeicons/core-free-icons";
+import { Album02Icon, Folder01Icon } from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import CloseIcon from "@mui/icons-material/Close";
@@ -56,25 +52,22 @@ export function DefaultOptionsV2({
<IconButton
aria-label="Close"
onClick={onClose}
- sx={{
- width: "40px",
- height: "40px",
+ sx={(theme) => ({
+ width: "38px",
+ height: "38px",
backgroundColor: "background.paper",
"&:hover": { backgroundColor: "secondary.hover" },
- }}
+ ...theme.applyStyles("dark", {
+ backgroundColor: "secondary.main",
+ }),
+ })}
>
<CloseIcon sx={{ fontSize: "18px" }} />
</IconButton>
</SpacedRow>
{intent == "import" ? (
- <ImportOptions
- {...{
- isFolderSelectionPending,
- onSelectGooglePhotos,
- onSelectFolder,
- }}
- />
+ <ImportOptions {...{ onSelectGooglePhotos }} />
) : (
<UploadOptions
{...{
@@ -90,46 +83,25 @@ export function DefaultOptionsV2({
);
}
-type ImportOptionsProps = Pick<
- DefaultOptionsV2Props,
- "isFolderSelectionPending" | "onSelectGooglePhotos" | "onSelectFolder"
->;
+type ImportOptionsProps = Pick<DefaultOptionsV2Props, "onSelectGooglePhotos">;
function ImportOptions({
- isFolderSelectionPending,
onSelectGooglePhotos,
- onSelectFolder,
}: ImportOptionsProps): React.JSX.Element {
return (
- <>
- <ImportSection title="Import from">
- <Stack direction="row" sx={{ gap: "10px" }}>
- <ImportProviderButton
- icon={
- <HugeiconsIcon
- icon={Album02Icon}
- size={22}
- color="var(--mui-palette-text-muted)"
- />
- }
- label="Google Photos"
- onClick={onSelectGooglePhotos}
+ <Stack direction="row" sx={{ gap: "10px", pb: "12px" }}>
+ <ImportProviderButton
+ icon={
+ <HugeiconsIcon
+ icon={Album02Icon}
+ size={22}
+ color="var(--mui-palette-text-muted)"
/>
- </Stack>
- </ImportSection>
-
- <ImportSection title="Import from other providers" gap="20px">
- <Stack sx={{ gap: 1 }}>
- <OptionRowButton
- icon={<HugeiconsIcon icon={File01Icon} size={18} />}
- label="Files + JSON"
- description="Use when each photo has a matching .json sidecar file"
- pending={isFolderSelectionPending}
- onClick={onSelectFolder}
- />
- </Stack>
- </ImportSection>
- </>
+ }
+ label="Google Photos"
+ onClick={onSelectGooglePhotos}
+ />
+ </Stack>
);
}
@@ -235,16 +207,19 @@ function ImportProviderButton({
<FocusVisibleButton
fullWidth
onClick={onClick}
- sx={{
+ sx={(theme) => ({
flex: 1,
minWidth: 0,
- height: "76px",
+ height: "74px",
p: "12px",
borderRadius: "16px",
backgroundColor: "background.paper",
color: "text.base",
"&:hover": { backgroundColor: "secondary.hover" },
- }}
+ ...theme.applyStyles("dark", {
+ backgroundColor: "secondary.main",
+ }),
+ })}
>
<Stack sx={{ alignItems: "center", gap: 1 }}>
{pending ? <PendingIndicator /> : icon}
@@ -281,14 +256,17 @@ function OptionRowButton({
<FocusVisibleButton
fullWidth
onClick={onClick}
- sx={{
+ sx={(theme) => ({
height: "60px",
p: "12px",
borderRadius: "20px",
backgroundColor: "background.paper",
color: "text.base",
"&:hover": { backgroundColor: "secondary.hover" },
- }}
+ ...theme.applyStyles("dark", {
+ backgroundColor: "secondary.main",
+ }),
+ })}
>
<Stack
direction="row"
diff --git a/web/apps/photos/src/components/TakeoutOptionsV2.tsx b/web/apps/photos/src/components/TakeoutOptionsV2.tsx
new file mode 100644
index 0000000000..6f4ff496a4
--- /dev/null
+++ b/web/apps/photos/src/components/TakeoutOptionsV2.tsx
@@ -0,0 +1,188 @@
+import { FileZipIcon, Folder01Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+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 { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";
+import React from "react";
+
+interface TakeoutOptionsV2Props {
+ onBack: () => void;
+ onClose: () => void;
+ onSelectFolder: () => void;
+ onSelectZips: () => void;
+}
+
+export function TakeoutOptionsV2({
+ onBack,
+ onClose,
+ onSelectFolder,
+ onSelectZips,
+}: TakeoutOptionsV2Props): React.JSX.Element {
+ return (
+ <Stack data-takeout-options-v2 sx={{ gap: "36px", p: "20px" }}>
+ <Stack
+ direction="row"
+ sx={{ alignItems: "center", justifyContent: "space-between" }}
+ >
+ <Stack direction="row" sx={{ alignItems: "center", gap: 1 }}>
+ <IconButton
+ aria-label="Back"
+ onClick={onBack}
+ sx={{
+ width: "38px",
+ height: "38px",
+ borderRadius: "12px",
+ }}
+ >
+ <ArrowBackIcon sx={{ fontSize: "24px" }} />
+ </IconButton>
+ <Typography
+ sx={{
+ fontFamily: "'Outfit', sans-serif",
+ fontSize: "24px",
+ fontWeight: 600,
+ lineHeight: "32px",
+ }}
+ >
+ Import from Google Photos
+ </Typography>
+ </Stack>
+ <IconButton
+ aria-label="Close"
+ onClick={onClose}
+ sx={(theme) => ({
+ width: "38px",
+ height: "38px",
+ backgroundColor: "background.paper",
+ "&:hover": { backgroundColor: "secondary.hover" },
+ ...theme.applyStyles("dark", {
+ backgroundColor: "secondary.main",
+ }),
+ })}
+ >
+ <CloseIcon sx={{ fontSize: "18px" }} />
+ </IconButton>
+ </Stack>
+
+ <Stack sx={{ gap: "20px" }}>
+ <Stack sx={{ gap: 1 }}>
+ <TakeoutOptionButton
+ icon={<HugeiconsIcon icon={Folder01Icon} size={18} />}
+ label="Unzipped folder"
+ description="Unzip everything into one folder, then select it"
+ onClick={onSelectFolder}
+ />
+ <TakeoutOptionButton
+ icon={<HugeiconsIcon icon={FileZipIcon} size={18} />}
+ label="ZIP files"
+ description="Select your ZIPs, we'll unzip them for you"
+ onClick={onSelectZips}
+ />
+ </Stack>
+ <Link
+ href="https://ente.com/help/photos/migration/from-google-photos/"
+ target="_blank"
+ rel="noopener"
+ sx={{
+ alignSelf: "center",
+ color: "accent.main",
+ fontSize: "14px",
+ fontWeight: 500,
+ lineHeight: "20px",
+ textDecoration: "underline",
+ }}
+ >
+ Need help?
+ </Link>
+ </Stack>
+ </Stack>
+ );
+}
+
+interface TakeoutOptionButtonProps {
+ icon: React.ReactNode;
+ label: string;
+ description: string;
+ onClick: () => void;
+}
+
+function TakeoutOptionButton({
+ icon,
+ label,
+ description,
+ onClick,
+}: TakeoutOptionButtonProps): React.JSX.Element {
+ return (
+ <FocusVisibleButton
+ fullWidth
+ onClick={onClick}
+ sx={(theme) => ({
+ height: "60px",
+ p: "12px",
+ borderRadius: "20px",
+ backgroundColor: "background.paper",
+ color: "text.base",
+ "&:hover": { backgroundColor: "secondary.hover" },
+ ...theme.applyStyles("dark", {
+ backgroundColor: "secondary.main",
+ }),
+ })}
+ >
+ <Stack
+ direction="row"
+ sx={{ width: "100%", alignItems: "center", gap: "12px" }}
+ >
+ <Box
+ sx={{
+ display: "flex",
+ width: "36px",
+ height: "36px",
+ flexShrink: 0,
+ alignItems: "center",
+ justifyContent: "center",
+ color: "text.muted",
+ }}
+ >
+ {icon}
+ </Box>
+ <Stack
+ sx={{ flex: 1, minWidth: 0, textAlign: "left", gap: "4px" }}
+ >
+ <Typography
+ sx={{
+ fontSize: "14px",
+ fontWeight: 500,
+ lineHeight: "20px",
+ }}
+ >
+ {label}
+ </Typography>
+ <Typography
+ sx={{
+ color: "text.muted",
+ fontSize: "12px",
+ fontWeight: 500,
+ lineHeight: "16px",
+ }}
+ >
+ {description}
+ </Typography>
+ </Stack>
+ <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/components/Upload.tsx b/web/apps/photos/src/components/Upload.tsx
index ab238d4637..e278c68374 100644
--- a/web/apps/photos/src/components/Upload.tsx
+++ b/web/apps/photos/src/components/Upload.tsx
@@ -4,6 +4,7 @@
/* eslint-disable @typescript-eslint/no-misused-promises */
/* eslint-disable @typescript-eslint/no-floating-promises */
import { DefaultOptionsV2 } from "@/components/DefaultOptionsV2";
+import { TakeoutOptionsV2 } from "@/components/TakeoutOptionsV2";
import type {
InProgressUpload,
SegregatedFinishedUploads,
@@ -169,9 +170,10 @@ interface UploadProps {
type UploadType = "files" | "folders" | "zips";
-const uploadFeatureFlags: { defaultOptionsV2: boolean } = {
- defaultOptionsV2: true,
-};
+const uploadFeatureFlags: {
+ defaultOptionsV2: boolean;
+ takeoutOptionsV2: boolean;
+} = { defaultOptionsV2: true, takeoutOptionsV2: true };
interface UploadFilesOptions {
persistPendingUploads?: boolean;
@@ -1477,12 +1479,16 @@ const UploadTypeSelector: React.FC<UploadTypeSelectorProps> = ({
boxShadow: "none",
border: "1px solid",
borderColor: "stroke.faint",
- "&:has([data-default-options-v2])": {
- maxWidth: "621px",
- p: 0,
- borderRadius: "20px",
- backgroundColor: "secondary.main",
- },
+ "&:has([data-default-options-v2], [data-takeout-options-v2])":
+ {
+ maxWidth: "621px",
+ p: 0,
+ borderRadius: "20px",
+ backgroundColor: "secondary.main",
+ ...theme.applyStyles("dark", {
+ backgroundColor: "background.paper",
+ }),
+ },
[theme.breakpoints.down(360)]: { p: 0 },
}),
},
@@ -1547,7 +1553,19 @@ const UploadOptions: React.FC<UploadOptionsProps> = ({
const handleSelectFolder = () => handleSelect("folders");
return showTakeoutOptions ? (
- <TakeoutOptions onSelect={handleSelect} onClose={handleTakeoutClose} />
+ uploadFeatureFlags.takeoutOptionsV2 ? (
+ <TakeoutOptionsV2
+ onBack={handleTakeoutClose}
+ onSelectFolder={handleSelectFolder}
+ onSelectZips={handleSelectGooglePhotos}
+ {...{ onClose }}
+ />
+ ) : (
+ <TakeoutOptions
+ onSelect={handleSelect}
+ onClose={handleTakeoutClose}
+ />
+ )
) : uploadFeatureFlags.defaultOptionsV2 && intent != "collect" ? (
<DefaultOptionsV2
intent={intent}
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index b9b3265db7..65f9188bb9 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -2039,7 +2039,6 @@ const Page: React.FC = () => {
px: "24px",
"@media (width < 720px)": { px: "4px" },
},
- !showSelectionBar && { borderBottom: "none" },
showSelectionBar && { borderColor: "accent.main" },
]}
>
diff --git a/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx b/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
index a45f6d93a3..00a4b396ee 100644
--- a/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
+++ b/web/packages/new/photos/components/gallery/GalleryEmptyStateV2.tsx
@@ -68,8 +68,7 @@ export function GalleryEmptyStateV2({
pb: { xs: 4, sm: "44px" },
borderRadius: { xs: "30px", sm: "42px" },
bgcolor: "background.paper",
- boxShadow: (theme) =>
- `${theme.vars.palette.boxShadow.paper}, 0px 16px 40px rgba(0 0 0 / 0.14)`,
+ boxShadow: "0px 4px 16px rgba(0 0 0 / 0.12)",
zIndex: 2,
}}
>