Skip to content

armgit / ente

Public Imported from GitHub
0

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

Ditto

Manav Rathi0a122b9fed56
diff --git a/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx b/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
index 8e1bac65f8..cbc5a1f016 100644
--- a/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
+++ b/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx
@@ -1,12 +1,12 @@
import { MenuItemGroup, MenuSectionTitle } from "@/base/components/Menu";
import {
NestedSidebarDrawer,
+ SidebarDrawerTitlebar,
type NestedSidebarDrawerVisibilityProps,
} from "@/base/components/mui/SidebarDrawer";
-import { Titlebar } from "@/base/components/Titlebar";
import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
-import { Box, Stack } from "@mui/material";
+import { Stack } from "@mui/material";
import { t } from "i18next";
import React, { useContext } from "react";
@@ -31,30 +31,28 @@ export const AdvancedSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
{...{ open, onClose }}
onRootClose={handleRootClose}
>
- <Stack spacing={"4px"} py={"12px"}>
- <Titlebar
+ <Stack sx={{ gap: "4px", py: "12px" }}>
+ <SidebarDrawerTitlebar
onClose={onClose}
- title={t("advanced")}
onRootClose={handleRootClose}
+ title={t("advanced")}
/>
- <Box px={"8px"}>
- <Stack py="20px" spacing="24px">
- <Box>
- <MenuItemGroup>
- <EnteMenuItem
- variant="toggle"
- checked={!appContext.isCFProxyDisabled}
- onClick={toggleCFProxy}
- label={t("FASTER_UPLOAD")}
- />
- </MenuItemGroup>
- <MenuSectionTitle
- title={t("FASTER_UPLOAD_DESCRIPTION")}
+ <Stack sx={{ px: "16px", py: "20px" }}>
+ <Stack sx={{ gap: "4px" }}>
+ <MenuItemGroup>
+ <EnteMenuItem
+ variant="toggle"
+ checked={!appContext.isCFProxyDisabled}
+ onClick={toggleCFProxy}
+ label={t("FASTER_UPLOAD")}
/>
- </Box>
+ </MenuItemGroup>
+ <MenuSectionTitle
+ title={t("FASTER_UPLOAD_DESCRIPTION")}
+ />
</Stack>
- </Box>
+ </Stack>
</Stack>
</NestedSidebarDrawer>
);
diff --git a/web/apps/photos/src/components/Sidebar/MapSetting.tsx b/web/apps/photos/src/components/Sidebar/MapSettings.tsx
similarity index 99%
rename from web/apps/photos/src/components/Sidebar/MapSetting.tsx
rename to web/apps/photos/src/components/Sidebar/MapSettings.tsx
index 5bd77b42ad..c600dbf7b5 100644
--- a/web/apps/photos/src/components/Sidebar/MapSetting.tsx
+++ b/web/apps/photos/src/components/Sidebar/MapSettings.tsx
@@ -46,11 +46,11 @@ export const MapSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
{...{ open, onClose }}
onRootClose={handleRootClose}
>
- <Stack spacing={"4px"} py={"12px"}>
+ <Stack sx={{ gap: "4px", py: "12px" }}>
<SidebarDrawerTitlebar
onClose={onClose}
- title={t("map")}
onRootClose={handleRootClose}
+ title={t("map")}
/>
<Stack sx={{ px: "16px", py: "20px" }}>
diff --git a/web/apps/photos/src/components/Sidebar/Preferences.tsx b/web/apps/photos/src/components/Sidebar/Preferences.tsx
index 18f1545e2c..1fd9ec89fc 100644
--- a/web/apps/photos/src/components/Sidebar/Preferences.tsx
+++ b/web/apps/photos/src/components/Sidebar/Preferences.tsx
@@ -1,9 +1,9 @@
import { MenuItemGroup, MenuSectionTitle } from "@/base/components/Menu";
import {
- SidebarDrawer,
+ NestedSidebarDrawer,
+ SidebarDrawerTitlebar,
type NestedSidebarDrawerVisibilityProps,
} from "@/base/components/mui/SidebarDrawer";
-import { Titlebar } from "@/base/components/Titlebar";
import { useModalVisibility } from "@/base/components/utils/modal";
import {
getLocaleInUse,
@@ -17,12 +17,12 @@ import { syncSettings } from "@/new/photos/services/settings";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import ChevronRight from "@mui/icons-material/ChevronRight";
import ScienceIcon from "@mui/icons-material/Science";
-import { Box, DialogProps, Stack } from "@mui/material";
+import { Box, Stack } from "@mui/material";
import DropdownInput from "components/DropdownInput";
import { t } from "i18next";
import React, { useEffect } from "react";
import { AdvancedSettings } from "./AdvancedSettings";
-import { MapSettings } from "./MapSetting";
+import { MapSettings } from "./MapSettings";
export const Preferences: React.FC<NestedSidebarDrawerVisibilityProps> = ({
open,
@@ -47,61 +47,42 @@ export const Preferences: React.FC<NestedSidebarDrawerVisibilityProps> = ({
onRootClose();
};
- const handleDrawerClose: DialogProps["onClose"] = (_, reason) => {
- console.log(reason);
- if (reason === "backdropClick") {
- handleRootClose();
- } else {
- onClose();
- }
- };
-
return (
- <SidebarDrawer
- transitionDuration={0}
- open={open}
- onClose={handleDrawerClose}
- // hideBackdrop
- // BackdropProps={{
- // sx: { "&&&": { backgroundColor: "transparent" } },
- // }}
- >
- <Stack spacing={"4px"} py={"12px"}>
- <Titlebar
+ <NestedSidebarDrawer {...{ open, onClose }} onRootClose={onRootClose}>
+ <Stack sx={{ gap: "4px", py: "12px" }}>
+ <SidebarDrawerTitlebar
onClose={onClose}
title={t("preferences")}
onRootClose={handleRootClose}
/>
- <Box px={"8px"}>
- <Stack py="20px" spacing="24px">
- <LanguageSelector />
- <EnteMenuItem
- onClick={showMapSettings}
- endIcon={<ChevronRight />}
- label={t("map")}
- />
- <EnteMenuItem
- onClick={showAdvancedSettings}
- endIcon={<ChevronRight />}
- label={t("advanced")}
- />
- {isMLSupported && (
- <Box>
- <MenuSectionTitle
- title={t("labs")}
- icon={<ScienceIcon />}
+ <Stack sx={{ px: "16px", py: "20px", gap: "24px" }}>
+ <LanguageSelector />
+ <EnteMenuItem
+ onClick={showMapSettings}
+ endIcon={<ChevronRight />}
+ label={t("map")}
+ />
+ <EnteMenuItem
+ onClick={showAdvancedSettings}
+ endIcon={<ChevronRight />}
+ label={t("advanced")}
+ />
+ {isMLSupported && (
+ <Box>
+ <MenuSectionTitle
+ title={t("labs")}
+ icon={<ScienceIcon />}
+ />
+ <MenuItemGroup>
+ <EnteMenuItem
+ endIcon={<ChevronRight />}
+ onClick={showMLSettings}
+ label={t("ml_search")}
/>
- <MenuItemGroup>
- <EnteMenuItem
- endIcon={<ChevronRight />}
- onClick={showMLSettings}
- label={t("ml_search")}
- />
- </MenuItemGroup>
- </Box>
- )}
- </Stack>
- </Box>
+ </MenuItemGroup>
+ </Box>
+ )}
+ </Stack>
</Stack>
<MapSettings
{...mapSettingsVisibilityProps}
@@ -115,7 +96,7 @@ export const Preferences: React.FC<NestedSidebarDrawerVisibilityProps> = ({
{...mlSettingsVisibilityProps}
onRootClose={handleRootClose}
/>
- </SidebarDrawer>
+ </NestedSidebarDrawer>
);
};
diff --git a/web/apps/photos/src/components/Sidebar/TwoFactorSettings.tsx b/web/apps/photos/src/components/Sidebar/TwoFactorSettings.tsx
index 953d22439a..3f508fbe2f 100644
--- a/web/apps/photos/src/components/Sidebar/TwoFactorSettings.tsx
+++ b/web/apps/photos/src/components/Sidebar/TwoFactorSettings.tsx
@@ -1,9 +1,9 @@
import { disableTwoFactor } from "@/accounts/api/user";
import {
NestedSidebarDrawer,
+ SidebarDrawerTitlebar,
type NestedSidebarDrawerVisibilityProps,
} from "@/base/components/mui/SidebarDrawer";
-import { Titlebar } from "@/base/components/Titlebar";
import { AppContext } from "@/new/photos/types/context";
import { VerticallyCentered } from "@ente/shared/components/Container";
import { PHOTOS_PAGES as PAGES } from "@ente/shared/constants/pages";
@@ -62,11 +62,11 @@ export const TwoFactorSettings: React.FC<
{...{ open, onClose }}
onRootClose={handleRootClose}
>
- <Stack spacing={"4px"} py={"12px"}>
- <Titlebar
+ <Stack sx={{ gap: "4px", py: "12px" }}>
+ <SidebarDrawerTitlebar
onClose={onClose}
- title={t("TWO_FACTOR_AUTHENTICATION")}
onRootClose={handleRootClose}
+ title={t("TWO_FACTOR_AUTHENTICATION")}
/>
{/* {component} */}
diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsx
index c9425c4efc..5ce5d12559 100644
--- a/web/packages/base/components/mui/SidebarDrawer.tsx
+++ b/web/packages/base/components/mui/SidebarDrawer.tsx
@@ -1,5 +1,17 @@
-import { Drawer, Stack, styled, type DrawerProps } from "@mui/material";
+import ArrowBack from "@mui/icons-material/ArrowBack";
+import Close from "@mui/icons-material/Close";
+import {
+ Box,
+ Drawer,
+ IconButton,
+ Stack,
+ styled,
+ Typography,
+ type DrawerProps,
+} from "@mui/material";
+import React from "react";
import type { ModalVisibilityProps } from "../utils/modal";
+import { SpaceBetweenFlex } from "./Container";
/**
* A MUI {@link Drawer} with a standard set of styling that we use for our left
@@ -75,12 +87,6 @@ export const NestedSidebarDrawer: React.FC<
);
};
-import ArrowBack from "@mui/icons-material/ArrowBack";
-import Close from "@mui/icons-material/Close";
-import { Box, IconButton, Typography } from "@mui/material";
-import React from "react";
-import { SpaceBetweenFlex } from "./Container";
-
type SidebarDrawerTitlebarProps = Pick<
NestedSidebarDrawerVisibilityProps,
"onClose" | "onRootClose"
@@ -106,32 +112,30 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({
onClose,
onRootClose,
actionButton,
-}) => {
- return (
- <Stack sx={{ gap: "4px" }}>
- <SpaceBetweenFlex sx={{ minHeight: "48px" }}>
- <IconButton onClick={onClose} color={"primary"}>
- <ArrowBack />
+}) => (
+ <Stack sx={{ gap: "4px" }}>
+ <SpaceBetweenFlex sx={{ minHeight: "48px" }}>
+ <IconButton onClick={onClose} color={"primary"}>
+ <ArrowBack />
+ </IconButton>
+ <Box display={"flex"} gap="4px">
+ {actionButton && actionButton}
+ <IconButton onClick={onRootClose} color={"secondary"}>
+ <Close />
</IconButton>
- <Box display={"flex"} gap="4px">
- {actionButton && actionButton}
- <IconButton onClick={onRootClose} color={"secondary"}>
- <Close />
- </IconButton>
- </Box>
- </SpaceBetweenFlex>
- <Stack py={0.5} px={2}>
- <Typography variant="h3" fontWeight={"bold"}>
- {title}
- </Typography>
- <Typography
- variant="small"
- color="text.muted"
- sx={{ wordBreak: "break-all", minHeight: "17px" }}
- >
- {caption}
- </Typography>
- </Stack>
- </Stack>
- );
-};
+ </Box>
+ </SpaceBetweenFlex>
+ <Box sx={{ px: "16px", py: "4px" }}>
+ <Typography variant="h3" fontWeight={"bold"}>
+ {title}
+ </Typography>
+ <Typography
+ variant="small"
+ color="text.muted"
+ sx={{ wordBreak: "break-all", minHeight: "17px" }}
+ >
+ {caption}
+ </Typography>
+ </Box>
+ </Stack>
+);
diff --git a/web/packages/new/photos/components/MLSettings.tsx b/web/packages/new/photos/components/MLSettings.tsx
index f93c5341a3..65b07b28a2 100644
--- a/web/packages/new/photos/components/MLSettings.tsx
+++ b/web/packages/new/photos/components/MLSettings.tsx
@@ -2,6 +2,7 @@ import { MenuItemGroup } from "@/base/components/Menu";
import { ActivityIndicator } from "@/base/components/mui/ActivityIndicator";
import {
NestedSidebarDrawer,
+ SidebarDrawerTitlebar,
type NestedSidebarDrawerVisibilityProps,
} from "@/base/components/mui/SidebarDrawer";
import { Titlebar } from "@/base/components/Titlebar";
@@ -165,10 +166,10 @@ const FaceConsent: React.FC<FaceConsentProps> = ({
onRootClose={handleRootClose}
>
<Stack spacing={"4px"} py={"12px"}>
- <Titlebar
+ <SidebarDrawerTitlebar
onClose={onClose}
- title={t("ml_consent_title")}
onRootClose={handleRootClose}
+ title={t("ml_consent_title")}
/>
<Stack py={"20px"} px={"8px"} spacing={"32px"}>
<Typography component="div" color="text.muted" px={"8px"}>