diff --git a/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx b/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx deleted file mode 100644 index c7a18af8c2..0000000000 --- a/web/apps/photos/src/components/Sidebar/AdvancedSettings.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { MenuItemGroup, MenuSectionTitle } from "@/base/components/Menu"; -import { - NestedSidebarDrawer, - SidebarDrawerTitlebar, - type NestedSidebarDrawerVisibilityProps, -} from "@/base/components/mui/SidebarDrawer"; -import { AppContext } from "@/new/photos/types/context"; -import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem"; -import { Stack } from "@mui/material"; -import { t } from "i18next"; -import React, { useContext } from "react"; - -export const AdvancedSettings: React.FC = ({ - open, - onClose, - onRootClose, -}) => { - const appContext = useContext(AppContext); - - const handleRootClose = () => { - onClose(); - onRootClose(); - }; - - const toggleCFProxy = () => { - appContext.setIsCFProxyDisabled(!appContext.isCFProxyDisabled); - }; - - return ( - - - - - - - - - - - - - - - ); -}; diff --git a/web/apps/photos/src/components/Sidebar/MapSettings.tsx b/web/apps/photos/src/components/Sidebar/MapSettings.tsx deleted file mode 100644 index 44ddf6e7a2..0000000000 --- a/web/apps/photos/src/components/Sidebar/MapSettings.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { MenuItemGroup } from "@/base/components/Menu"; -import { - NestedSidebarDrawer, - SidebarDrawerTitlebar, - type NestedSidebarDrawerVisibilityProps, -} from "@/base/components/mui/SidebarDrawer"; -import { - confirmDisableMapsDialogAttributes, - confirmEnableMapsDialogAttributes, -} from "@/new/photos/components/utils/dialog"; -import { - settingsSnapshot, - settingsSubscribe, - updateMapEnabled, -} from "@/new/photos/services/settings"; -import { useAppContext } from "@/new/photos/types/context"; -import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem"; -import { Stack } from "@mui/material"; -import { t } from "i18next"; -import React, { useCallback, useSyncExternalStore } from "react"; - -export const MapSettings: React.FC = ({ - open, - onClose, - onRootClose, -}) => { - const { showMiniDialog } = useAppContext(); - - const { mapEnabled } = useSyncExternalStore( - settingsSubscribe, - settingsSnapshot, - ); - - const confirmToggle = useCallback( - () => - showMiniDialog( - mapEnabled - ? confirmDisableMapsDialogAttributes(() => - updateMapEnabled(false), - ) - : confirmEnableMapsDialogAttributes(() => - updateMapEnabled(true), - ), - ), - [showMiniDialog, mapEnabled], - ); - - const handleRootClose = () => { - onClose(); - onRootClose(); - }; - - return ( - - - - - - - - - - - - ); -}; diff --git a/web/apps/photos/src/components/Sidebar/Preferences.tsx b/web/apps/photos/src/components/Sidebar/Preferences.tsx index 884e9fbde0..323c1266ee 100644 --- a/web/apps/photos/src/components/Sidebar/Preferences.tsx +++ b/web/apps/photos/src/components/Sidebar/Preferences.tsx @@ -12,17 +12,30 @@ import { type SupportedLocale, } from "@/base/i18n"; import { MLSettings } from "@/new/photos/components/sidebar/MLSettings"; +import { + confirmDisableMapsDialogAttributes, + confirmEnableMapsDialogAttributes, +} from "@/new/photos/components/utils/dialog"; import { isMLSupported } from "@/new/photos/services/ml"; -import { syncSettings } from "@/new/photos/services/settings"; +import { + settingsSnapshot, + settingsSubscribe, + syncSettings, + updateMapEnabled, +} from "@/new/photos/services/settings"; +import { AppContext, useAppContext } from "@/new/photos/types/context"; import { EnteMenuItem } from "@ente/shared/components/Menu/EnteMenuItem"; import ChevronRight from "@mui/icons-material/ChevronRight"; import ScienceIcon from "@mui/icons-material/Science"; 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 "./MapSettings"; +import React, { + useCallback, + useContext, + useEffect, + useSyncExternalStore, +} from "react"; export const Preferences: React.FC = ({ open, @@ -157,3 +170,109 @@ const localeName = (locale: SupportedLocale) => { return "Українська"; } }; + +export const MapSettings: React.FC = ({ + open, + onClose, + onRootClose, +}) => { + const { showMiniDialog } = useAppContext(); + + const { mapEnabled } = useSyncExternalStore( + settingsSubscribe, + settingsSnapshot, + ); + + const confirmToggle = useCallback( + () => + showMiniDialog( + mapEnabled + ? confirmDisableMapsDialogAttributes(() => + updateMapEnabled(false), + ) + : confirmEnableMapsDialogAttributes(() => + updateMapEnabled(true), + ), + ), + [showMiniDialog, mapEnabled], + ); + + const handleRootClose = () => { + onClose(); + onRootClose(); + }; + + return ( + + + + + + + + + + + + ); +}; + +export const AdvancedSettings: React.FC = ({ + open, + onClose, + onRootClose, +}) => { + const appContext = useContext(AppContext); + + const handleRootClose = () => { + onClose(); + onRootClose(); + }; + + const toggleCFProxy = () => { + appContext.setIsCFProxyDisabled(!appContext.isCFProxyDisabled); + }; + + return ( + + + + + + + + + + + + + + + ); +}; diff --git a/web/apps/photos/src/pages/_app.tsx b/web/apps/photos/src/pages/_app.tsx index 294f541551..0c589b5b04 100644 --- a/web/apps/photos/src/pages/_app.tsx +++ b/web/apps/photos/src/pages/_app.tsx @@ -52,9 +52,7 @@ import { useCallback, useEffect, useState } from "react"; import LoadingBar from "react-top-loading-bar"; import { resumeExportsIfNeeded } from "services/export"; import { photosLogout } from "services/logout"; -import { - getFamilyPortalRedirectURL, -} from "services/userService"; +import { getFamilyPortalRedirectURL } from "services/userService"; import "styles/global.css"; import { NotificationAttributes } from "types/Notification";