Skip to content

armgit / ente

Public Imported from GitHub
0

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

Tweak

Manav Rathi23d739c38018
diff --git a/web/apps/photos/src/components/Sidebar/MapSettings.tsx b/web/apps/photos/src/components/Sidebar/MapSettings.tsx
index c600dbf7b5..839e0ea5e9 100644
--- a/web/apps/photos/src/components/Sidebar/MapSettings.tsx
+++ b/web/apps/photos/src/components/Sidebar/MapSettings.tsx
@@ -1,11 +1,12 @@
import { MenuItemGroup } from "@/base/components/Menu";
+import { FocusVisibleButton } from "@/base/components/mui/FocusVisibleButton";
import {
NestedSidebarDrawer,
SidebarDrawerTitlebar,
type NestedSidebarDrawerVisibilityProps,
} from "@/base/components/mui/SidebarDrawer";
-import { Titlebar } from "@/base/components/Titlebar";
import log from "@/base/log";
+import type { ButtonishProps } from "@/new/photos/components/mui";
import { AppContext } from "@/new/photos/types/context";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import { Box, Button, Link, Stack, Typography } from "@mui/material";
@@ -64,7 +65,7 @@ export const MapSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
</MenuItemGroup>
</Stack>
</Stack>
- <ModifyMapEnabled
+ <ModifyMapSettings
open={modifyMapEnabledView}
mapEnabled={mapEnabled}
onClose={closeModifyMapEnabled}
@@ -74,7 +75,7 @@ export const MapSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
);
};
-const ModifyMapEnabled = ({ open, onClose, onRootClose, mapEnabled }) => {
+const ModifyMapSettings = ({ open, onClose, onRootClose, mapEnabled }) => {
const { somethingWentWrong, updateMapEnabled } = useContext(AppContext);
const disableMap = async () => {
@@ -108,88 +109,102 @@ const ModifyMapEnabled = ({ open, onClose, onRootClose, mapEnabled }) => {
onRootClose={handleRootClose}
>
{mapEnabled ? (
- <DisableMap
+ <ConfirmDisableMap
onClose={onClose}
- disableMap={disableMap}
onRootClose={handleRootClose}
+ onClick={disableMap}
/>
) : (
- <EnableMap
+ <ConfirmEnableMap
onClose={onClose}
- enableMap={enableMap}
onRootClose={handleRootClose}
+ onClick={enableMap}
/>
)}
</NestedSidebarDrawer>
);
};
-function EnableMap({ onClose, enableMap, onRootClose }) {
- return (
- <Stack spacing={"4px"} py={"12px"}>
- <Titlebar
- onClose={onClose}
- title={t("enable_maps_confirm")}
- onRootClose={onRootClose}
- />
- <Stack py={"20px"} px={"8px"} spacing={"32px"}>
- <Box px={"8px"}>
- {" "}
- <Typography color="text.muted">
- <Trans
- i18nKey={"enable_maps_confirm_message"}
- components={{
- a: (
- <Link
- target="_blank"
- rel="noopener"
- href="https://www.openstreetmap.org/"
- />
- ),
- }}
- />
- </Typography>
- </Box>
- <Stack px={"8px"} spacing={"8px"}>
- <Button color={"accent"} size="large" onClick={enableMap}>
- {t("enable")}
- </Button>
- <Button color={"secondary"} size="large" onClick={onClose}>
- {t("cancel")}
- </Button>
- </Stack>
+type ConfirmStepProps = Pick<
+ NestedSidebarDrawerVisibilityProps,
+ "onClose" | "onRootClose"
+> &
+ ButtonishProps;
+
+const ConfirmEnableMap: React.FC<ConfirmStepProps> = ({
+ onClose,
+ onRootClose,
+ onClick,
+}) => (
+ <Stack sx={{ gap: "4px", py: "12px" }}>
+ <SidebarDrawerTitlebar
+ onClose={onClose}
+ onRootClose={onRootClose}
+ title={t("enable_maps_confirm")}
+ />
+ <Stack py={"20px"} px={"8px"} spacing={"32px"}>
+ <Box px={"8px"}>
+ {" "}
+ <Typography color="text.muted">
+ <Trans
+ i18nKey={"enable_maps_confirm_message"}
+ components={{
+ a: (
+ <Link
+ target="_blank"
+ rel="noopener"
+ href="https://www.openstreetmap.org/"
+ />
+ ),
+ }}
+ />
+ </Typography>
+ </Box>
+ <Stack px={"8px"} spacing={"8px"}>
+ <Button color={"accent"} size="large" onClick={onClick}>
+ {t("enable")}
+ </Button>
+ <Button color={"secondary"} size="large" onClick={onClose}>
+ {t("cancel")}
+ </Button>
</Stack>
</Stack>
- );
-}
+ </Stack>
+);
-function DisableMap({ onClose, disableMap, onRootClose }) {
- return (
- <Stack spacing={"4px"} py={"12px"}>
- <Titlebar
- onClose={onClose}
- title={t("disable_maps_confirm")}
- onRootClose={onRootClose}
- />
- <Stack py={"20px"} px={"8px"} spacing={"32px"}>
- <Box px={"8px"}>
- <Typography color="text.muted">
- <Trans i18nKey={"disable_maps_confirm_message"} />
- </Typography>
- </Box>
- <Stack px={"8px"} spacing={"8px"}>
- <Button
- color={"critical"}
- size="large"
- onClick={disableMap}
- >
- {t("disable")}
- </Button>
- <Button color={"secondary"} size="large" onClick={onClose}>
- {t("cancel")}
- </Button>
- </Stack>
+const ConfirmDisableMap: React.FC<ConfirmStepProps> = ({
+ onClose,
+ onRootClose,
+ onClick,
+}) => (
+ <Stack sx={{ gap: "4px", py: "12px" }}>
+ <SidebarDrawerTitlebar
+ onClose={onClose}
+ onRootClose={onRootClose}
+ title={t("disable_maps_confirm")}
+ />
+ <Stack py={"20px"} px={"8px"} spacing={"32px"}>
+ <Box px={"8px"}>
+ <Typography color="text.muted">
+ <Trans i18nKey={"disable_maps_confirm_message"} />
+ </Typography>
+ </Box>
+ <Stack px={"8px"} spacing={"8px"}>
+ <FocusVisibleButton
+ color={"critical"}
+ size="large"
+ onClick={onClick}
+ >
+ {t("disable")}
+ </FocusVisibleButton>
+ <FocusVisibleButton
+ color={"secondary"}
+ size="large"
+ onClick={onClose}
+ >
+ {t("cancel")}
+ </FocusVisibleButton>
</Stack>
</Stack>
- );
-}
+ </Stack>
+);
diff --git a/web/packages/new/photos/components/MLSettings.tsx b/web/packages/new/photos/components/MLSettings.tsx
index 65b07b28a2..21a09ce312 100644
--- a/web/packages/new/photos/components/MLSettings.tsx
+++ b/web/packages/new/photos/components/MLSettings.tsx
@@ -5,7 +5,6 @@ import {
SidebarDrawerTitlebar,
type NestedSidebarDrawerVisibilityProps,
} from "@/base/components/mui/SidebarDrawer";
-import { Titlebar } from "@/base/components/Titlebar";
import { disableML, enableML, type MLStatus } from "@/new/photos/services/ml";
import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem";
import {
@@ -68,11 +67,11 @@ export const MLSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
{...{ open, onClose }}
onRootClose={handleRootClose}
>
- <Stack spacing={"4px"} py={"12px"}>
- <Titlebar
+ <Stack sx={{ gap: "4px", py: "12px" }}>
+ <SidebarDrawerTitlebar
onClose={onClose}
- title={t("ml_search")}
onRootClose={handleRootClose}
+ title={t("ml_search")}
/>
{component}
</Stack>