Inline
This commit is contained in:
@@ -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<NestedSidebarDrawerVisibilityProps> = ({
|
||||
open,
|
||||
onClose,
|
||||
onRootClose,
|
||||
}) => {
|
||||
const appContext = useContext(AppContext);
|
||||
|
||||
const handleRootClose = () => {
|
||||
onClose();
|
||||
onRootClose();
|
||||
};
|
||||
|
||||
const toggleCFProxy = () => {
|
||||
appContext.setIsCFProxyDisabled(!appContext.isCFProxyDisabled);
|
||||
};
|
||||
|
||||
return (
|
||||
<NestedSidebarDrawer
|
||||
{...{ open, onClose }}
|
||||
onRootClose={handleRootClose}
|
||||
>
|
||||
<Stack sx={{ gap: "4px", py: "12px" }}>
|
||||
<SidebarDrawerTitlebar
|
||||
onClose={onClose}
|
||||
onRootClose={handleRootClose}
|
||||
title={t("advanced")}
|
||||
/>
|
||||
|
||||
<Stack sx={{ px: "16px", py: "20px" }}>
|
||||
<Stack sx={{ gap: "4px" }}>
|
||||
<MenuItemGroup>
|
||||
<EnteMenuItem
|
||||
variant="toggle"
|
||||
checked={!appContext.isCFProxyDisabled}
|
||||
onClick={toggleCFProxy}
|
||||
label={t("faster_upload")}
|
||||
/>
|
||||
</MenuItemGroup>
|
||||
<MenuSectionTitle
|
||||
title={t("faster_upload_description")}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</NestedSidebarDrawer>
|
||||
);
|
||||
};
|
||||
@@ -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<NestedSidebarDrawerVisibilityProps> = ({
|
||||
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 (
|
||||
<NestedSidebarDrawer
|
||||
{...{ open, onClose }}
|
||||
onRootClose={handleRootClose}
|
||||
>
|
||||
<Stack sx={{ gap: "4px", py: "12px" }}>
|
||||
<SidebarDrawerTitlebar
|
||||
onClose={onClose}
|
||||
onRootClose={handleRootClose}
|
||||
title={t("map")}
|
||||
/>
|
||||
|
||||
<Stack sx={{ px: "16px", py: "20px" }}>
|
||||
<MenuItemGroup>
|
||||
<EnteMenuItem
|
||||
onClick={confirmToggle}
|
||||
variant="toggle"
|
||||
checked={mapEnabled}
|
||||
label={t("enabled")}
|
||||
/>
|
||||
</MenuItemGroup>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</NestedSidebarDrawer>
|
||||
);
|
||||
};
|
||||
@@ -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<NestedSidebarDrawerVisibilityProps> = ({
|
||||
open,
|
||||
@@ -157,3 +170,109 @@ const localeName = (locale: SupportedLocale) => {
|
||||
return "Українська";
|
||||
}
|
||||
};
|
||||
|
||||
export const MapSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
|
||||
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 (
|
||||
<NestedSidebarDrawer
|
||||
{...{ open, onClose }}
|
||||
onRootClose={handleRootClose}
|
||||
>
|
||||
<Stack sx={{ gap: "4px", py: "12px" }}>
|
||||
<SidebarDrawerTitlebar
|
||||
onClose={onClose}
|
||||
onRootClose={handleRootClose}
|
||||
title={t("map")}
|
||||
/>
|
||||
|
||||
<Stack sx={{ px: "16px", py: "20px" }}>
|
||||
<MenuItemGroup>
|
||||
<EnteMenuItem
|
||||
onClick={confirmToggle}
|
||||
variant="toggle"
|
||||
checked={mapEnabled}
|
||||
label={t("enabled")}
|
||||
/>
|
||||
</MenuItemGroup>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</NestedSidebarDrawer>
|
||||
);
|
||||
};
|
||||
|
||||
export const AdvancedSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({
|
||||
open,
|
||||
onClose,
|
||||
onRootClose,
|
||||
}) => {
|
||||
const appContext = useContext(AppContext);
|
||||
|
||||
const handleRootClose = () => {
|
||||
onClose();
|
||||
onRootClose();
|
||||
};
|
||||
|
||||
const toggleCFProxy = () => {
|
||||
appContext.setIsCFProxyDisabled(!appContext.isCFProxyDisabled);
|
||||
};
|
||||
|
||||
return (
|
||||
<NestedSidebarDrawer
|
||||
{...{ open, onClose }}
|
||||
onRootClose={handleRootClose}
|
||||
>
|
||||
<Stack sx={{ gap: "4px", py: "12px" }}>
|
||||
<SidebarDrawerTitlebar
|
||||
onClose={onClose}
|
||||
onRootClose={handleRootClose}
|
||||
title={t("advanced")}
|
||||
/>
|
||||
|
||||
<Stack sx={{ px: "16px", py: "20px" }}>
|
||||
<Stack sx={{ gap: "4px" }}>
|
||||
<MenuItemGroup>
|
||||
<EnteMenuItem
|
||||
variant="toggle"
|
||||
checked={!appContext.isCFProxyDisabled}
|
||||
onClick={toggleCFProxy}
|
||||
label={t("faster_upload")}
|
||||
/>
|
||||
</MenuItemGroup>
|
||||
<MenuSectionTitle
|
||||
title={t("faster_upload_description")}
|
||||
/>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</NestedSidebarDrawer>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user