π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
abstraction
Manav Rathi68aaedc2d913
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsxindex 075aec2b8b..d82cacc3c7 100644--- a/web/apps/photos/src/components/Sidebar.tsx+++ b/web/apps/photos/src/components/Sidebar.tsx@@ -41,9 +41,8 @@ import { ActivityIndicator } from "ente-base/components/mui/ActivityIndicator";import { DialogCloseIconButton } from "ente-base/components/mui/DialogCloseIconButton";import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";import {- NestedSidebarDrawer,SidebarDrawer,- SidebarDrawerTitlebar,+ TitledNestedSidebarDrawer,type NestedSidebarDrawerVisibilityProps,} from "ente-base/components/mui/SidebarDrawer";import { useIsSmallWidth } from "ente-base/components/utils/hooks";@@ -658,6 +657,7 @@ const InfoSection: React.FC = () => {type AccountProps = NestedSidebarDrawerVisibilityProps &Pick<SidebarProps, "onAuthenticateUser">;+const Account: React.FC<AccountProps> = ({open,onClose,@@ -689,55 +689,49 @@ const Account: React.FC<AccountProps> = ({};return (- <NestedSidebarDrawer {...{ open, onClose }} onRootClose={onRootClose}>- <Stack sx={{ gap: "4px", py: "12px" }}>- <SidebarDrawerTitlebar- onClose={onClose}- title={t("account")}- onRootClose={handleRootClose}- />- <Stack sx={{ px: "16px", py: "8px", gap: "24px" }}>- <RowButtonGroup>- <RowButton- endIcon={- <HealthAndSafetyIcon- sx={{ color: "accent.main" }}- />- }- label={t("recovery_key")}- onClick={showRecoveryKey}- />- </RowButtonGroup>- <RowButtonGroup>- <RowButton- label={t("two_factor")}- onClick={showTwoFactor}- />- <RowButtonDivider />- <RowButton- label={t("passkeys")}- onClick={handlePasskeys}- />- </RowButtonGroup>- <RowButtonGroup>- <RowButton- label={t("change_password")}- onClick={handleChangePassword}- />- <RowButtonDivider />- <RowButton- label={t("change_email")}- onClick={handleChangeEmail}- />- </RowButtonGroup>- <RowButtonGroup>- <RowButton- color="critical"- label={t("delete_account")}- onClick={showDeleteAccount}- />- </RowButtonGroup>- </Stack>+ <TitledNestedSidebarDrawer+ {...{ open, onClose }}+ onRootClose={handleRootClose}+ title={t("account")}+ >+ <Stack sx={{ px: "16px", py: "8px", gap: "24px" }}>+ <RowButtonGroup>+ <RowButton+ endIcon={+ <HealthAndSafetyIcon+ sx={{ color: "accent.main" }}+ />+ }+ label={t("recovery_key")}+ onClick={showRecoveryKey}+ />+ </RowButtonGroup>+ <RowButtonGroup>+ <RowButton+ label={t("two_factor")}+ onClick={showTwoFactor}+ />+ <RowButtonDivider />+ <RowButton label={t("passkeys")} onClick={handlePasskeys} />+ </RowButtonGroup>+ <RowButtonGroup>+ <RowButton+ label={t("change_password")}+ onClick={handleChangePassword}+ />+ <RowButtonDivider />+ <RowButton+ label={t("change_email")}+ onClick={handleChangeEmail}+ />+ </RowButtonGroup>+ <RowButtonGroup>+ <RowButton+ color="critical"+ label={t("delete_account")}+ onClick={showDeleteAccount}+ />+ </RowButtonGroup></Stack><RecoveryKey{...recoveryKeyVisibilityProps}@@ -751,7 +745,7 @@ const Account: React.FC<AccountProps> = ({{...deleteAccountVisibilityProps}{...{ onAuthenticateUser }}/>- </NestedSidebarDrawer>+ </TitledNestedSidebarDrawer>);};@@ -782,51 +776,48 @@ const Preferences: React.FC<NestedSidebarDrawerVisibilityProps> = ({};return (- <NestedSidebarDrawer {...{ open, onClose }} onRootClose={onRootClose}>- <Stack sx={{ gap: "4px", py: "12px" }}>- <SidebarDrawerTitlebar- onClose={onClose}- title={t("preferences")}- onRootClose={handleRootClose}+ <TitledNestedSidebarDrawer+ {...{ open, onClose }}+ onRootClose={handleRootClose}+ title={t("preferences")}+ >+ <Stack sx={{ px: "16px", py: "8px", gap: "24px" }}>+ <LanguageSelector />+ <ThemeSelector />+ <Divider sx={{ my: "2px", opacity: 0.1 }} />+ {isMLSupported && (+ <RowButtonGroup>+ <RowButton+ endIcon={<ChevronRightIcon />}+ label={t("ml_search")}+ onClick={showMLSettings}+ />+ </RowButtonGroup>+ )}+ <RowButton+ endIcon={<ChevronRightIcon />}+ label={t("map")}+ onClick={showMapSettings}+ />+ <RowButton+ endIcon={<ChevronRightIcon />}+ label={t("advanced")}+ onClick={showAdvancedSettings}/>- <Stack sx={{ px: "16px", py: "8px", gap: "24px" }}>- <LanguageSelector />- <ThemeSelector />- <Divider sx={{ my: "2px", opacity: 0.1 }} />- {isMLSupported && (+ {isHLSGenerationSupported && (+ <Stack>+ <RowButtonGroupTitle icon={<ScienceIcon />}>+ {t("labs")}+ </RowButtonGroupTitle><RowButtonGroup>- <RowButton- endIcon={<ChevronRightIcon />}- label={t("ml_search")}- onClick={showMLSettings}+ <RowSwitch+ label={t("streamable_videos")}+ checked={isHLSGenerationEnabled}+ onClick={() => void toggleHLSGeneration()}/></RowButtonGroup>- )}- <RowButton- endIcon={<ChevronRightIcon />}- label={t("map")}- onClick={showMapSettings}- />- <RowButton- endIcon={<ChevronRightIcon />}- label={t("advanced")}- onClick={showAdvancedSettings}- />- {isHLSGenerationSupported && (- <Stack>- <RowButtonGroupTitle icon={<ScienceIcon />}>- {t("labs")}- </RowButtonGroupTitle>- <RowButtonGroup>- <RowSwitch- label={t("streamable_videos")}- checked={isHLSGenerationEnabled}- onClick={() => void toggleHLSGeneration()}- />- </RowButtonGroup>- </Stack>- )}- </Stack>+ </Stack>+ )}</Stack><MapSettings{...mapSettingsVisibilityProps}@@ -840,7 +831,7 @@ const Preferences: React.FC<NestedSidebarDrawerVisibilityProps> = ({{...mlSettingsVisibilityProps}onRootClose={handleRootClose}/>- </NestedSidebarDrawer>+ </TitledNestedSidebarDrawer>);};@@ -974,28 +965,21 @@ const MapSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({};return (- <NestedSidebarDrawer+ <TitledNestedSidebarDrawer{...{ open, onClose }}onRootClose={handleRootClose}+ title={t("map")}>- <Stack sx={{ gap: "4px", py: "12px" }}>- <SidebarDrawerTitlebar- onClose={onClose}- onRootClose={handleRootClose}- title={t("map")}- />-- <Stack sx={{ px: "16px", py: "20px" }}>- <RowButtonGroup>- <RowSwitch- label={t("enabled")}- checked={mapEnabled}- onClick={confirmToggle}- />- </RowButtonGroup>- </Stack>+ <Stack sx={{ px: "16px", py: "20px" }}>+ <RowButtonGroup>+ <RowSwitch+ label={t("enabled")}+ checked={mapEnabled}+ onClick={confirmToggle}+ />+ </RowButtonGroup></Stack>- </NestedSidebarDrawer>+ </TitledNestedSidebarDrawer>);};@@ -1032,41 +1016,35 @@ const AdvancedSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({void electron?.toggleAutoLaunch().then(refreshAutoLaunchEnabled);return (- <NestedSidebarDrawer+ <TitledNestedSidebarDrawer{...{ open, onClose }}onRootClose={handleRootClose}+ title={t("advanced")}>- <Stack sx={{ gap: "4px", py: "12px" }}>- <SidebarDrawerTitlebar- onClose={onClose}- onRootClose={handleRootClose}- title={t("advanced")}- />- <Stack sx={{ px: "16px", py: "20px", gap: "24px" }}>- <Stack>- <RowButtonGroup>- <RowSwitch- label={t("faster_upload")}- checked={!cfUploadProxyDisabled}- onClick={toggleProxy}- />- </RowButtonGroup>- <RowButtonGroupHint>- {t("faster_upload_description")}- </RowButtonGroupHint>- </Stack>- {electron && (- <RowButtonGroup>- <RowSwitch- label={t("open_ente_on_startup")}- checked={isAutoLaunchEnabled}- onClick={toggleAutoLaunch}- />- </RowButtonGroup>- )}+ <Stack sx={{ px: "16px", py: "20px", gap: "24px" }}>+ <Stack>+ <RowButtonGroup>+ <RowSwitch+ label={t("faster_upload")}+ checked={!cfUploadProxyDisabled}+ onClick={toggleProxy}+ />+ </RowButtonGroup>+ <RowButtonGroupHint>+ {t("faster_upload_description")}+ </RowButtonGroupHint></Stack>+ {electron && (+ <RowButtonGroup>+ <RowSwitch+ label={t("open_ente_on_startup")}+ checked={isAutoLaunchEnabled}+ onClick={toggleAutoLaunch}+ />+ </RowButtonGroup>+ )}</Stack>- </NestedSidebarDrawer>+ </TitledNestedSidebarDrawer>);};@@ -1106,71 +1084,68 @@ const Help: React.FC<NestedSidebarDrawerVisibilityProps> = ({};return (- <NestedSidebarDrawer {...{ open, onClose }} onRootClose={onRootClose}>- <Stack sx={{ gap: "4px", py: "12px" }}>- <SidebarDrawerTitlebar- onClose={onClose}- title={t("help")}- onRootClose={handleRootClose}+ <TitledNestedSidebarDrawer+ {...{ open, onClose }}+ onRootClose={handleRootClose}+ title={t("help")}+ >+ <Stack sx={{ px: "16px", py: "8px", gap: "24px" }}>+ <RowButtonGroup>+ <RowButton+ endIcon={<InfoOutlinedIcon />}+ label={t("ente_help")}+ onClick={handleHelp}+ />+ </RowButtonGroup>+ <RowButtonGroup>+ <RowButton+ endIcon={<NorthEastIcon />}+ label={t("blog")}+ onClick={handleBlog}+ />+ <RowButtonDivider />+ <RowButton+ endIcon={<NorthEastIcon />}+ label={t("request_feature")}+ onClick={handleRequestFeature}+ />+ </RowButtonGroup>+ <RowButtonGroup>+ <RowButton+ endIcon={<ChevronRightIcon />}+ label={+ <Tooltip title="[email protected]">+ <Typography sx={{ fontWeight: "medium" }}>+ {t("support")}+ </Typography>+ </Tooltip>+ }+ onClick={handleSupport}+ />+ </RowButtonGroup>+ </Stack>+ <Stack sx={{ px: "16px" }}>+ <RowButton+ variant="secondary"+ label={+ <Typography variant="mini" color="text.muted">+ {t("view_logs")}+ </Typography>+ }+ onClick={confirmViewLogs}/>- <Stack sx={{ px: "16px", py: "8px", gap: "24px" }}>- <RowButtonGroup>- <RowButton- endIcon={<InfoOutlinedIcon />}- label={t("ente_help")}- onClick={handleHelp}- />- </RowButtonGroup>- <RowButtonGroup>- <RowButton- endIcon={<NorthEastIcon />}- label={t("blog")}- onClick={handleBlog}- />- <RowButtonDivider />- <RowButton- endIcon={<NorthEastIcon />}- label={t("request_feature")}- onClick={handleRequestFeature}- />- </RowButtonGroup>- <RowButtonGroup>- <RowButton- endIcon={<ChevronRightIcon />}- label={- <Tooltip title="[email protected]">- <Typography sx={{ fontWeight: "medium" }}>- {t("support")}- </Typography>- </Tooltip>- }- onClick={handleSupport}- />- </RowButtonGroup>- </Stack>- <Stack sx={{ px: "16px" }}>+ {isDevBuildAndUser() && (<RowButtonvariant="secondary"label={<Typography variant="mini" color="text.muted">- {t("view_logs")}+ {ut("Test upload")}</Typography>}- onClick={confirmViewLogs}+ onClick={testUpload}/>- {isDevBuildAndUser() && (- <RowButton- variant="secondary"- label={- <Typography variant="mini" color="text.muted">- {ut("Test upload")}- </Typography>- }- onClick={testUpload}- />- )}- </Stack>+ )}</Stack>- </NestedSidebarDrawer>+ </TitledNestedSidebarDrawer>);};diff --git a/web/packages/base/components/mui/SidebarDrawer.tsx b/web/packages/base/components/mui/SidebarDrawer.tsxindex 73b86d9869..c3ac89d176 100644--- a/web/packages/base/components/mui/SidebarDrawer.tsx+++ b/web/packages/base/components/mui/SidebarDrawer.tsx@@ -179,3 +179,25 @@ export const SidebarDrawerTitlebar: React.FC<SidebarDrawerTitlebarProps> = ({</Box></Stack>);++/**+ * A variant of {@link NestedSidebarDrawer} that additionally shows a title.+ *+ * {@link NestedSidebarDrawer} is for second level, nested drawers that are+ * shown atop an already visible {@link SidebarDrawer}. This component combines+ * the {@link NestedSidebarDrawer} with a {@link SidebarDrawerTitlebar} and some+ * standard spacing, so that the caller can just provide the content as the+ * children.+ */+export const TitledNestedSidebarDrawer: React.FC<+ React.PropsWithChildren<+ NestedSidebarDrawerVisibilityProps & SidebarDrawerTitlebarProps+ >+> = ({ open, onClose, onRootClose, children, ...rest }) => (+ <NestedSidebarDrawer {...{ open, onClose, onRootClose }}>+ <Stack sx={{ gap: "4px", py: "12px" }}>+ <SidebarDrawerTitlebar {...{ onClose, onRootClose }} {...rest} />+ {children}+ </Stack>+ </NestedSidebarDrawer>+);diff --git a/web/packages/new/photos/components/sidebar/MLSettings.tsx b/web/packages/new/photos/components/sidebar/MLSettings.tsxindex 98b3319d96..9951fafad3 100644--- a/web/packages/new/photos/components/sidebar/MLSettings.tsx+++ b/web/packages/new/photos/components/sidebar/MLSettings.tsx@@ -13,8 +13,7 @@ import { RowButtonGroup, RowSwitch } from "ente-base/components/RowButton";import { ActivityIndicator } from "ente-base/components/mui/ActivityIndicator";import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";import {- NestedSidebarDrawer,- SidebarDrawerTitlebar,+ TitledNestedSidebarDrawer,type NestedSidebarDrawerVisibilityProps,} from "ente-base/components/mui/SidebarDrawer";import { useBaseContext } from "ente-base/context";@@ -66,19 +65,13 @@ export const MLSettings: React.FC<NestedSidebarDrawerVisibilityProps> = ({return (<>- <NestedSidebarDrawer+ <TitledNestedSidebarDrawer{...{ open, onClose }}onRootClose={handleRootClose}+ title={t("ml_search")}>- <Stack sx={{ gap: "4px", py: "12px" }}>- <SidebarDrawerTitlebar- onClose={onClose}- onRootClose={handleRootClose}- title={t("ml_search")}- />- {component}- </Stack>- </NestedSidebarDrawer>+ {component}+ </TitledNestedSidebarDrawer><FaceConsentDraweropen={openFaceConsent}@@ -151,19 +144,13 @@ const FaceConsentDrawer: React.FC<FaceConsentDrawerProps> = ({};return (- <NestedSidebarDrawer+ <TitledNestedSidebarDrawer{...{ open, onClose }}onRootClose={handleRootClose}+ title={t("ml_consent_title")}>- <Stack sx={{ gap: "4px", py: "12px" }}>- <SidebarDrawerTitlebar- onClose={onClose}- onRootClose={handleRootClose}- title={t("ml_consent_title")}- />- <FaceConsent onConsent={onConsent} onCancel={onClose} />- </Stack>- </NestedSidebarDrawer>+ <FaceConsent onConsent={onConsent} onCancel={onClose} />+ </TitledNestedSidebarDrawer>);};diff --git a/web/packages/new/photos/components/sidebar/TwoFactorSettings.tsx b/web/packages/new/photos/components/sidebar/TwoFactorSettings.tsxindex 5338951cae..3e88743ece 100644--- a/web/packages/new/photos/components/sidebar/TwoFactorSettings.tsx+++ b/web/packages/new/photos/components/sidebar/TwoFactorSettings.tsx@@ -8,8 +8,7 @@ import {} from "ente-base/components/RowButton";import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";import {- NestedSidebarDrawer,- SidebarDrawerTitlebar,+ TitledNestedSidebarDrawer,type NestedSidebarDrawerVisibilityProps,} from "ente-base/components/mui/SidebarDrawer";import { useBaseContext } from "ente-base/context";@@ -52,24 +51,17 @@ export const TwoFactorSettings: React.FC<};return (- <NestedSidebarDrawer+ <TitledNestedSidebarDrawer{...{ open, onClose }}onRootClose={handleRootClose}+ title={t("two_factor_authentication")}>- <Stack sx={{ gap: "4px", py: "12px" }}>- <SidebarDrawerTitlebar- onClose={onClose}- onRootClose={handleRootClose}- title={t("two_factor_authentication")}- />-- {isTwoFactorEnabled ? (- <ManageDrawerContents onRootClose={handleRootClose} />- ) : (- <SetupDrawerContents onRootClose={handleRootClose} />- )}- </Stack>- </NestedSidebarDrawer>+ {isTwoFactorEnabled ? (+ <ManageDrawerContents onRootClose={handleRootClose} />+ ) : (+ <SetupDrawerContents onRootClose={handleRootClose} />+ )}+ </TitledNestedSidebarDrawer>);};