Skip to content

armgit / ente

Public Imported from GitHub
0

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

Update sidebar

vishnukvmd6b276f5e5a61
diff --git a/web/apps/locker/src/components/LockerAboutDrawer.tsx b/web/apps/locker/src/components/LockerAboutDrawer.tsx
index ee582c02ac..e769241767 100644
--- a/web/apps/locker/src/components/LockerAboutDrawer.tsx
+++ b/web/apps/locker/src/components/LockerAboutDrawer.tsx
@@ -1,53 +1,65 @@
-import OpenInNewOutlinedIcon from "@mui/icons-material/OpenInNewOutlined";
-import {
- RowButton,
- RowButtonDivider,
- RowButtonGroup,
-} from "ente-base/components/RowButton";
-import {
- TitledNestedSidebarDrawer,
- type NestedSidebarDrawerVisibilityProps,
-} from "ente-base/components/mui/SidebarDrawer";
+import { Github01Icon, LicenseIcon, Shield01Icon } from "@hugeicons/core-free-icons";
+import NorthEastIcon from "@mui/icons-material/NorthEast";
+import { Stack, useTheme } from "@mui/material";
import { t } from "i18next";
import React from "react";
+import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
+import {
+ LockerTitledNestedSidebarDrawer,
+ type LockerNestedSidebarDrawerVisibilityProps,
+} from "./LockerSidebarShell";
const openExternal = (url: string) => window.open(url, "_blank", "noopener");
export const LockerAboutDrawer: React.FC<
- NestedSidebarDrawerVisibilityProps
+ LockerNestedSidebarDrawerVisibilityProps
> = ({ open, onClose, onRootClose }) => {
+ const theme = useTheme();
+
const handleRootClose = () => {
onClose();
onRootClose();
};
return (
- <TitledNestedSidebarDrawer
+ <LockerTitledNestedSidebarDrawer
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("about")}
+ hideRootCloseButton
>
- <RowButtonGroup sx={{ mx: 2, my: 2 }}>
- <RowButton
+ <Stack
+ sx={{
+ px: 2,
+ py: 1,
+ gap: 1,
+ backgroundColor: "background.default",
+ ...theme.applyStyles("dark", {
+ backgroundColor: "background.paper",
+ }),
+ }}
+ >
+ <LockerSidebarCardButton
+ icon={Github01Icon}
label={t("we_are_open_source")}
- endIcon={<OpenInNewOutlinedIcon />}
+ endIcon={<NorthEastIcon />}
onClick={() =>
openExternal("https://github.com/ente-io/ente")
}
/>
- <RowButtonDivider />
- <RowButton
+ <LockerSidebarCardButton
+ icon={Shield01Icon}
label={t("privacy")}
- endIcon={<OpenInNewOutlinedIcon />}
+ endIcon={<NorthEastIcon />}
onClick={() => openExternal("https://ente.io/privacy")}
/>
- <RowButtonDivider />
- <RowButton
+ <LockerSidebarCardButton
+ icon={LicenseIcon}
label={t("terms")}
- endIcon={<OpenInNewOutlinedIcon />}
+ endIcon={<NorthEastIcon />}
onClick={() => openExternal("https://ente.io/terms")}
/>
- </RowButtonGroup>
- </TitledNestedSidebarDrawer>
+ </Stack>
+ </LockerTitledNestedSidebarDrawer>
);
};
diff --git a/web/apps/locker/src/components/LockerAccountDrawer.tsx b/web/apps/locker/src/components/LockerAccountDrawer.tsx
index 3245bbe0f2..1ecd3ab257 100644
--- a/web/apps/locker/src/components/LockerAccountDrawer.tsx
+++ b/web/apps/locker/src/components/LockerAccountDrawer.tsx
@@ -1,30 +1,33 @@
+import {
+ ComputerPhoneSyncIcon,
+ Key01Icon,
+ Key02Icon,
+ Mail01Icon,
+ PasswordValidationIcon,
+ SecurityCheckIcon,
+} from "@hugeicons/core-free-icons";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
-import OpenInNewOutlinedIcon from "@mui/icons-material/OpenInNewOutlined";
-import VerifiedUserOutlinedIcon from "@mui/icons-material/VerifiedUserOutlined";
-import { Stack } from "@mui/material";
+import NorthEastIcon from "@mui/icons-material/NorthEast";
+import { Box, Stack, Typography, useTheme } from "@mui/material";
import { RecoveryKey } from "ente-accounts-rs/components/RecoveryKey";
import { openAccountsManagePasskeysPage } from "ente-accounts-rs/services/passkey";
-import {
- RowButton,
- RowButtonDivider,
- RowButtonGroup,
- RowButtonGroupTitle,
-} from "ente-base/components/RowButton";
-import {
- TitledNestedSidebarDrawer,
- type NestedSidebarDrawerVisibilityProps,
-} from "ente-base/components/mui/SidebarDrawer";
import { useBaseContext } from "ente-base/context";
import { t } from "i18next";
import { useRouter } from "next/router";
import React, { useEffect, useState } from "react";
+import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
+import {
+ LockerTitledNestedSidebarDrawer,
+ type LockerNestedSidebarDrawerVisibilityProps,
+} from "./LockerSidebarShell";
import { LockerSessionsDrawer } from "./LockerSessionsDrawer";
export const LockerAccountDrawer: React.FC<
- NestedSidebarDrawerVisibilityProps
+ LockerNestedSidebarDrawerVisibilityProps
> = ({ open, onClose, onRootClose }) => {
const { showMiniDialog, onGenericError } = useBaseContext();
const router = useRouter();
+ const theme = useTheme();
const [isRecoveryKeyOpen, setIsRecoveryKeyOpen] = useState(false);
const [isSessionsOpen, setIsSessionsOpen] = useState(false);
@@ -59,63 +62,83 @@ export const LockerAccountDrawer: React.FC<
return (
<>
- <TitledNestedSidebarDrawer
+ <LockerTitledNestedSidebarDrawer
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("account")}
+ hideRootCloseButton
>
- <Stack sx={{ px: 2, pb: 2, gap: 2 }}>
- <RowButtonGroup>
- <RowButton
- label={t("recovery_key")}
- endIcon={
- <VerifiedUserOutlinedIcon
- sx={{ color: "success.main" }}
- />
- }
- onClick={() => setIsRecoveryKeyOpen(true)}
- />
- </RowButtonGroup>
+ <Stack
+ sx={{
+ px: 2,
+ pb: 2,
+ gap: 2,
+ backgroundColor: "background.default",
+ ...theme.applyStyles("dark", {
+ backgroundColor: "background.paper",
+ }),
+ }}
+ >
+ <LockerSidebarCardButton
+ icon={Key02Icon}
+ label={t("recovery_key")}
+ onClick={() => setIsRecoveryKeyOpen(true)}
+ />
- <Stack sx={{ gap: 0.5 }}>
- <RowButtonGroupTitle>
+ <Stack sx={{ gap: 1 }}>
+ <Typography
+ variant="mini"
+ sx={{
+ px: 1,
+ color: "text.faint",
+ textTransform: "uppercase",
+ letterSpacing: "0.08em",
+ fontWeight: "bold",
+ }}
+ >
{t("security")}
- </RowButtonGroupTitle>
- <RowButtonGroup>
- <RowButton
- label={t("two_factor")}
- onClick={() =>
- handleNavigate("/two-factor/setup")
- }
- />
- <RowButtonDivider />
- <RowButton
- label={t("passkeys")}
- endIcon={<OpenInNewOutlinedIcon />}
- onClick={handleOpenPasskeys}
- />
- <RowButtonDivider />
- <RowButton
- label={t("active_sessions")}
- endIcon={<ChevronRightIcon />}
- onClick={() => setIsSessionsOpen(true)}
- />
- </RowButtonGroup>
+ </Typography>
+ <LockerSidebarCardButton
+ icon={SecurityCheckIcon}
+ label={t("two_factor")}
+ onClick={() => handleNavigate("/two-factor/setup")}
+ />
+ <LockerSidebarCardButton
+ icon={Key01Icon}
+ label={t("passkeys")}
+ endIcon={<NorthEastIcon />}
+ onClick={handleOpenPasskeys}
+ />
+ <LockerSidebarCardButton
+ icon={ComputerPhoneSyncIcon}
+ label={t("active_sessions")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => setIsSessionsOpen(true)}
+ />
</Stack>
- <RowButtonGroup>
- <RowButton
+ <Box
+ sx={{
+ borderTop: 1,
+ borderColor: "divider",
+ mx: 1,
+ }}
+ />
+
+ <Stack sx={{ gap: 1 }}>
+ <LockerSidebarCardButton
+ icon={PasswordValidationIcon}
label={t("change_password")}
onClick={() => handleNavigate("/change-password")}
/>
- <RowButtonDivider />
- <RowButton
+ <LockerSidebarCardButton
+ icon={Mail01Icon}
label={t("change_email")}
onClick={() => handleNavigate("/change-email")}
/>
- </RowButtonGroup>
+ </Stack>
</Stack>
- </TitledNestedSidebarDrawer>
+ </LockerTitledNestedSidebarDrawer>
<LockerSessionsDrawer
open={isSessionsOpen}
diff --git a/web/apps/locker/src/components/LockerSessionsDrawer.tsx b/web/apps/locker/src/components/LockerSessionsDrawer.tsx
index 49f5039dc0..e7d743f628 100644
--- a/web/apps/locker/src/components/LockerSessionsDrawer.tsx
+++ b/web/apps/locker/src/components/LockerSessionsDrawer.tsx
@@ -16,10 +16,6 @@ import {
type Session,
} from "ente-accounts-rs/services/sessions";
import { RowButton, RowButtonGroup } from "ente-base/components/RowButton";
-import {
- TitledNestedSidebarDrawer,
- type NestedSidebarDrawerVisibilityProps,
-} from "ente-base/components/mui/SidebarDrawer";
import { useBaseContext } from "ente-base/context";
import { isHTTP401Error } from "ente-base/http";
import { formattedDateTime } from "ente-base/i18n-date";
@@ -27,9 +23,13 @@ import log from "ente-base/log";
import { savedAuthToken } from "ente-base/token";
import { t } from "i18next";
import React, { useCallback, useEffect, useState } from "react";
+import {
+ LockerTitledNestedSidebarDrawer,
+ type LockerNestedSidebarDrawerVisibilityProps,
+} from "./LockerSidebarShell";
export const LockerSessionsDrawer: React.FC<
- NestedSidebarDrawerVisibilityProps
+ LockerNestedSidebarDrawerVisibilityProps
> = ({ open, onClose, onRootClose }) => {
const [refreshTrigger, setRefreshTrigger] = useState(0);
@@ -39,10 +39,11 @@ export const LockerSessionsDrawer: React.FC<
};
return (
- <TitledNestedSidebarDrawer
+ <LockerTitledNestedSidebarDrawer
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("active_sessions")}
+ hideRootCloseButton
actionButton={
<IconButton
onClick={() => setRefreshTrigger((value) => value + 1)}
@@ -54,7 +55,7 @@ export const LockerSessionsDrawer: React.FC<
}
>
<SessionsContents refreshTrigger={refreshTrigger} />
- </TitledNestedSidebarDrawer>
+ </LockerTitledNestedSidebarDrawer>
);
};
diff --git a/web/apps/locker/src/components/LockerSidebar.tsx b/web/apps/locker/src/components/LockerSidebar.tsx
index fdbd33a2c6..19f595572e 100644
--- a/web/apps/locker/src/components/LockerSidebar.tsx
+++ b/web/apps/locker/src/components/LockerSidebar.tsx
@@ -7,7 +7,6 @@ import {
UserIcon,
Wallet05Icon,
} from "@hugeicons/core-free-icons";
-import { HugeiconsIcon } from "@hugeicons/react";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import CloseIcon from "@mui/icons-material/Close";
import {
@@ -18,7 +17,6 @@ import {
useTheme,
} from "@mui/material";
import { EnteLogo } from "ente-base/components/EnteLogo";
-import { SidebarDrawer } from "ente-base/components/mui/SidebarDrawer";
import { useBaseContext } from "ente-base/context";
import { t } from "i18next";
import React, { useEffect, useState } from "react";
@@ -27,6 +25,8 @@ import type { LockerCollection } from "types";
import { visibleLockerCollections } from "types";
import { LockerAboutDrawer } from "./LockerAboutDrawer";
import { LockerAccountDrawer } from "./LockerAccountDrawer";
+import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
+import { LockerSidebarDrawer } from "./LockerSidebarShell";
import { LockerSocialFooter } from "./LockerSocialFooter";
import { LockerSupportDrawer } from "./LockerSupportDrawer";
@@ -115,11 +115,19 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
return (
<>
- <SidebarDrawer open={open} onClose={onClose} anchor="left">
+ <LockerSidebarDrawer
+ open={open}
+ onClose={onClose}
+ anchor="left"
+ >
<Stack
sx={{
height: "calc(100dvh - env(titlebar-area-height, 0px) - 16px)",
minHeight: 0,
+ backgroundColor: "background.default",
+ ...theme.applyStyles("dark", {
+ backgroundColor: "background.paper",
+ }),
}}
>
<Box
@@ -132,31 +140,30 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
}}
>
{/* Header */}
- <Stack
- direction="row"
- sx={{
- alignItems: "center",
- justifyContent: "space-between",
- px: 1,
- pt: 1,
- pb: 0.5,
- }}
- >
- <Box
+ <Stack sx={{ px: 1, pt: 0.5, pb: 0.5 }}>
+ <Stack
+ direction="row"
sx={{
- px: 1,
- lineHeight: 0,
- color: "#111111",
- ...theme.applyStyles("dark", {
- color: "rgba(255,255,255,0.92)",
- }),
+ alignItems: "center",
+ justifyContent: "space-between",
}}
>
- <EnteLogo height={18} />
- </Box>
- <IconButton onClick={onClose} color="secondary">
- <CloseIcon />
- </IconButton>
+ <Box
+ sx={{
+ px: 1,
+ lineHeight: 0,
+ color: "#111111",
+ ...theme.applyStyles("dark", {
+ color: "rgba(255,255,255,0.92)",
+ }),
+ }}
+ >
+ <EnteLogo height={18} />
+ </Box>
+ <IconButton onClick={onClose} color="secondary">
+ <CloseIcon />
+ </IconButton>
+ </Stack>
</Stack>
{userDetails?.email && (
@@ -320,21 +327,21 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
<Box sx={{ px: 0.5, mt: 0.5 }}>
<Stack sx={{ gap: 1 }}>
- <SidebarCardButton
+ <LockerSidebarCardButton
icon={Home01Icon}
label={t("home")}
caption={String(totalItems)}
selected={isHomeView}
onClick={onSelectHome}
/>
- <SidebarCardButton
+ <LockerSidebarCardButton
icon={Wallet05Icon}
label={t("menuCollections")}
caption={String(displayCollections.length)}
selected={isCollectionsView}
onClick={onSelectCollections}
/>
- <SidebarCardButton
+ <LockerSidebarCardButton
icon={Delete02Icon}
label={t("menuTrash")}
caption={String(trashItemCount)}
@@ -343,22 +350,30 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
/>
</Stack>
</Box>
+ <Box
+ sx={{
+ mx: 1.5,
+ mt: 2,
+ borderTop: 1,
+ borderColor: "divider",
+ }}
+ />
<Box sx={{ px: 0.5, mt: 2, pb: 1 }}>
<Stack sx={{ gap: 1 }}>
- <SidebarCardButton
+ <LockerSidebarCardButton
icon={UserIcon}
label={t("account")}
endIcon={<ChevronRightIcon />}
onClick={() => setIsAccountOpen(true)}
/>
- <SidebarCardButton
+ <LockerSidebarCardButton
icon={HelpCircleIcon}
label={t("help_and_support")}
endIcon={<ChevronRightIcon />}
onClick={() => setIsSupportOpen(true)}
/>
- <SidebarCardButton
+ <LockerSidebarCardButton
icon={InformationCircleIcon}
label={t("about")}
endIcon={<ChevronRightIcon />}
@@ -366,15 +381,24 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
/>
</Stack>
</Box>
- </Box>
-
- <Box sx={{ px: 0.5, pb: 1 }}>
- <SidebarCardButton
- icon={Logout05Icon}
- label={t("logout")}
- color="warning.main"
- onClick={logout}
+ <Box
+ sx={{
+ mx: 1.5,
+ mt: 1,
+ borderTop: 1,
+ borderColor: "divider",
+ }}
/>
+ <Box sx={{ px: 0.5, mt: 2, pb: 1 }}>
+ <Stack sx={{ gap: 1 }}>
+ <LockerSidebarCardButton
+ icon={Logout05Icon}
+ label={t("logout")}
+ color="critical.main"
+ onClick={logout}
+ />
+ </Stack>
+ </Box>
</Box>
<Box
@@ -386,7 +410,7 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
<LockerSocialFooter />
</Box>
</Stack>
- </SidebarDrawer>
+ </LockerSidebarDrawer>
<LockerAccountDrawer
open={isAccountOpen}
@@ -406,106 +430,3 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
</>
);
};
-
-interface SidebarCardButtonProps {
- icon: Parameters<typeof HugeiconsIcon>[0]["icon"];
- label: string;
- onClick: () => void;
- caption?: string;
- endIcon?: React.ReactNode;
- selected?: boolean;
- color?: string;
-}
-
-const SidebarCardButton: React.FC<SidebarCardButtonProps> = ({
- icon,
- label,
- onClick,
- caption,
- endIcon,
- selected = false,
- color,
-}) => (
- <FocusVisibleRowButton onClick={onClick}>
- <Stack
- direction="row"
- sx={(theme) => ({
- minHeight: 56,
- px: 2,
- gap: 1.5,
- alignItems: "center",
- borderRadius: "20px",
- backgroundColor: "backdrop.base",
- color: color ?? "text.base",
- transition: theme.transitions.create(
- ["background-color", "border-color", "color"],
- { duration: theme.transitions.duration.shorter },
- ),
- ...(selected && {
- backgroundColor: "fill.faintHover",
- boxShadow: `inset 0 0 0 1px ${theme.vars.palette.accent.main}`,
- color: "accent.main",
- }),
- "&:hover": {
- backgroundColor: selected ? "fill.faintHover" : "fill.faint",
- },
- })}
- >
- <HugeiconsIcon
- icon={icon}
- size={24}
- color="currentColor"
- strokeWidth={1.9}
- />
- <Typography
- variant="small"
- sx={{
- flex: 1,
- color: "inherit",
- fontWeight: selected ? 700 : 500,
- }}
- >
- {label}
- </Typography>
- {caption && (
- <Typography
- variant="mini"
- sx={{
- color: selected ? "accent.main" : "text.muted",
- flexShrink: 0,
- }}
- >
- {caption}
- </Typography>
- )}
- {endIcon && (
- <Box sx={{ color: selected ? "accent.main" : "text.muted" }}>
- {endIcon}
- </Box>
- )}
- </Stack>
- </FocusVisibleRowButton>
-);
-
-const FocusVisibleRowButton = ({
- children,
- onClick,
-}: React.PropsWithChildren<{ onClick: () => void }>) => (
- <Box
- component="button"
- type="button"
- onClick={onClick}
- sx={{
- width: "100%",
- p: 0,
- m: 0,
- border: 0,
- background: "transparent",
- textAlign: "inherit",
- cursor: "pointer",
- borderRadius: "20px",
- }}
- >
- {children}
- </Box>
-);
diff --git a/web/apps/locker/src/components/LockerSidebarCardButton.tsx b/web/apps/locker/src/components/LockerSidebarCardButton.tsx
new file mode 100644
index 0000000000..2cc6bda880
--- /dev/null
+++ b/web/apps/locker/src/components/LockerSidebarCardButton.tsx
@@ -0,0 +1,119 @@
+import { HugeiconsIcon } from "@hugeicons/react";
+import { Box, Stack, Typography } from "@mui/material";
+import React from "react";
+
+interface LockerSidebarCardButtonProps {
+ icon?: React.ComponentProps<typeof HugeiconsIcon>["icon"];
+ iconNode?: React.ReactNode;
+ label: React.ReactNode;
+ onClick: () => void;
+ caption?: string;
+ endIcon?: React.ReactNode;
+ selected?: boolean;
+ color?: string;
+}
+
+export const LockerSidebarCardButton: React.FC<
+ LockerSidebarCardButtonProps
+> = ({
+ icon,
+ iconNode,
+ label,
+ onClick,
+ caption,
+ endIcon,
+ selected = false,
+ color,
+}) => (
+ <Box
+ component="button"
+ type="button"
+ onClick={onClick}
+ sx={{
+ width: "100%",
+ p: 0,
+ m: 0,
+ border: 0,
+ background: "transparent",
+ textAlign: "inherit",
+ cursor: "pointer",
+ borderRadius: "20px",
+ }}
+ >
+ <Stack
+ direction="row"
+ sx={(theme) => ({
+ minHeight: 56,
+ px: 2,
+ gap: 1.5,
+ alignItems: "center",
+ borderRadius: "20px",
+ backgroundColor: "backdrop.base",
+ color: color ?? "text.base",
+ transition: theme.transitions.create(
+ ["background-color", "border-color", "color"],
+ { duration: theme.transitions.duration.shorter },
+ ),
+ ...(selected && {
+ backgroundColor: "fill.faintHover",
+ boxShadow: `inset 0 0 0 1px ${theme.vars.palette.accent.main}`,
+ color: "accent.main",
+ }),
+ "&:hover": {
+ backgroundColor: selected ? "fill.faintHover" : "fill.faint",
+ },
+ })}
+ >
+ {iconNode ? (
+ <Box
+ sx={{
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ color: "inherit",
+ }}
+ >
+ {iconNode}
+ </Box>
+ ) : icon ? (
+ <HugeiconsIcon
+ icon={icon}
+ size={24}
+ color="currentColor"
+ strokeWidth={1.9}
+ />
+ ) : null}
+ <Box sx={{ flex: 1, minWidth: 0 }}>
+ {typeof label === "string" ? (
+ <Typography
+ variant="small"
+ sx={{
+ color: "inherit",
+ fontWeight: selected ? 700 : 500,
+ }}
+ >
+ {label}
+ </Typography>
+ ) : (
+ label
+ )}
+ </Box>
+ {caption && (
+ <Typography
+ variant="mini"
+ sx={{
+ color: selected ? "accent.main" : "text.muted",
+ flexShrink: 0,
+ }}
+ >
+ {caption}
+ </Typography>
+ )}
+ {endIcon && (
+ <Box sx={{ color: selected ? "accent.main" : "text.muted" }}>
+ {endIcon}
+ </Box>
+ )}
+ </Stack>
+ </Box>
+);
diff --git a/web/apps/locker/src/components/LockerSidebarShell.tsx b/web/apps/locker/src/components/LockerSidebarShell.tsx
new file mode 100644
index 0000000000..aee857a47f
--- /dev/null
+++ b/web/apps/locker/src/components/LockerSidebarShell.tsx
@@ -0,0 +1,156 @@
+import ArrowBackIcon from "@mui/icons-material/ArrowBack";
+import CloseIcon from "@mui/icons-material/Close";
+import {
+ Box,
+ Drawer,
+ IconButton,
+ Stack,
+ styled,
+ Typography,
+ type DrawerProps,
+} from "@mui/material";
+import { isDesktop } from "ente-base/app";
+import type { ModalVisibilityProps } from "ente-base/components/utils/modal";
+import React from "react";
+
+export const LockerSidebarDrawer: React.FC<DrawerProps> = ({
+ slotProps,
+ children,
+ ...rest
+}) => (
+ <Drawer
+ {...rest}
+ slotProps={{
+ ...(slotProps ?? {}),
+ paper: {
+ ...(slotProps?.paper ?? {}),
+ sx: [
+ {
+ maxWidth: "375px",
+ width: "100%",
+ scrollbarWidth: "thin",
+ backgroundColor: "background.default",
+ "&&": { padding: 0 },
+ },
+ (theme) => theme.applyStyles("dark", {
+ backgroundColor: theme.vars.palette.background.paper,
+ }),
+ (slotProps?.paper as { sx?: unknown } | undefined)?.sx as never,
+ ],
+ },
+ }}
+ >
+ {isDesktop && <LockerTitlebarBackdrop />}
+ <Box sx={{ p: 1 }}>{children}</Box>
+ </Drawer>
+);
+
+const LockerTitlebarBackdrop = styled("div")(({ theme }) => ({
+ position: "sticky",
+ top: 0,
+ left: 0,
+ width: "100%",
+ minHeight: "env(titlebar-area-height, 30px)",
+ zIndex: 1,
+ backgroundColor: theme.vars.palette.backdrop.muted,
+ backdropFilter: "blur(12px)",
+}));
+
+export type LockerNestedSidebarDrawerVisibilityProps = ModalVisibilityProps & {
+ onRootClose: () => void;
+};
+
+export const LockerNestedSidebarDrawer: React.FC<
+ LockerNestedSidebarDrawerVisibilityProps & DrawerProps
+> = ({ onClose, onRootClose, ...rest }) => {
+ const handleClose: DrawerProps["onClose"] = (_, reason) => {
+ if (reason == "backdropClick") {
+ onClose();
+ onRootClose();
+ } else {
+ onClose();
+ }
+ };
+
+ return (
+ <LockerSidebarDrawer
+ transitionDuration={0}
+ slotProps={{
+ backdrop: { sx: { "&&&": { backgroundColor: "transparent" } } },
+ }}
+ onClose={handleClose}
+ {...rest}
+ />
+ );
+};
+
+type LockerSidebarTitlebarProps = Pick<
+ LockerNestedSidebarDrawerVisibilityProps,
+ "onClose" | "onRootClose"
+> & {
+ title: string;
+ caption?: string;
+ actionButton?: React.ReactNode;
+ hideRootCloseButton?: boolean;
+};
+
+const LockerSidebarTitlebar: React.FC<LockerSidebarTitlebarProps> = ({
+ title,
+ caption,
+ onClose,
+ onRootClose,
+ actionButton,
+ hideRootCloseButton,
+}) => (
+ <Stack sx={{ gap: "4px" }}>
+ <Stack direction="row" sx={{ justifyContent: "space-between" }}>
+ <IconButton onClick={onClose} color="primary">
+ <ArrowBackIcon />
+ </IconButton>
+ <Stack direction="row" sx={{ gap: "4px" }}>
+ {actionButton && actionButton}
+ {!hideRootCloseButton && (
+ <IconButton onClick={onRootClose} color="secondary">
+ <CloseIcon />
+ </IconButton>
+ )}
+ </Stack>
+ </Stack>
+ <Stack sx={{ px: "16px", gap: "4px" }}>
+ <Typography variant="h3">{title}</Typography>
+ <Typography
+ variant="small"
+ sx={{
+ color: "text.muted",
+ wordBreak: "break-all",
+ px: "1px",
+ minHeight: "17px",
+ }}
+ >
+ {caption}
+ </Typography>
+ </Stack>
+ </Stack>
+);
+
+type LockerTitledNestedSidebarDrawerProps = React.PropsWithChildren<
+ LockerNestedSidebarDrawerVisibilityProps &
+ Pick<DrawerProps, "anchor" | "slotProps"> &
+ LockerSidebarTitlebarProps
+>;
+
+export const LockerTitledNestedSidebarDrawer: React.FC<
+ LockerTitledNestedSidebarDrawerProps
+> = ({ open, onClose, onRootClose, anchor, slotProps, children, ...rest }) => (
+ <LockerNestedSidebarDrawer
+ {...{ open, onClose, onRootClose, anchor, slotProps }}
+ >
+ <Stack sx={{ gap: "4px", py: "12px" }}>
+ <LockerSidebarTitlebar
+ {...{ onClose, onRootClose }}
+ {...rest}
+ />
+ {children}
+ </Stack>
+ </LockerNestedSidebarDrawer>
+);
diff --git a/web/apps/locker/src/components/LockerSocialFooter.tsx b/web/apps/locker/src/components/LockerSocialFooter.tsx
index c9009143fa..a9373b674b 100644
--- a/web/apps/locker/src/components/LockerSocialFooter.tsx
+++ b/web/apps/locker/src/components/LockerSocialFooter.tsx
@@ -1,5 +1,3 @@
-import AlternateEmailIcon from "@mui/icons-material/AlternateEmail";
-import ForumOutlinedIcon from "@mui/icons-material/ForumOutlined";
import GitHubIcon from "@mui/icons-material/GitHub";
import RedditIcon from "@mui/icons-material/Reddit";
import XIcon from "@mui/icons-material/X";
@@ -12,23 +10,36 @@ const openExternal = (url: string) => window.open(url, "_blank", "noopener");
const socialLinks = [
{
- icon: ForumOutlinedIcon,
+ icon: DiscordBrandIcon,
label: "Discord",
url: "https://ente.io/discord",
+ buttonSize: 48,
},
{
icon: YouTubeIcon,
label: "YouTube",
url: "https://www.youtube.com/@entestudio",
+ buttonSize: 36,
},
- { icon: GitHubIcon, label: "GitHub", url: "https://github.com/ente-io" },
- { icon: XIcon, label: "X", url: "https://twitter.com/enteio" },
{
- icon: AlternateEmailIcon,
+ icon: GitHubIcon,
+ label: "GitHub",
+ url: "https://github.com/ente-io",
+ buttonSize: 36,
+ },
+ { icon: XIcon, label: "X", url: "https://twitter.com/enteio", buttonSize: 36 },
+ {
+ icon: MastodonBrandIcon,
label: "Mastodon",
url: "https://fosstodon.org/@ente",
+ buttonSize: 48,
+ },
+ {
+ icon: RedditIcon,
+ label: "Reddit",
+ url: "https://reddit.com/r/enteio",
+ buttonSize: 36,
},
- { icon: RedditIcon, label: "Reddit", url: "https://reddit.com/r/enteio" },
] as const;
const buildLabel = () => {
@@ -43,17 +54,36 @@ export const LockerSocialFooter: React.FC = () => {
<Stack sx={{ alignItems: "center", gap: 1, px: 1, pb: 1 }}>
<Stack
direction="row"
- sx={{ gap: 0.5, flexWrap: "wrap", justifyContent: "center" }}
+ sx={{
+ gap: 0.5,
+ flexWrap: "wrap",
+ justifyContent: "center",
+ alignItems: "center",
+ }}
>
- {socialLinks.map(({ icon: Icon, label, url }) => (
+ {socialLinks.map(({ icon: Icon, label, url, buttonSize }) => (
<IconButton
key={label}
color="secondary"
aria-label={label}
onClick={() => openExternal(url)}
- sx={{ width: 36, height: 36, color: "text.muted" }}
+ sx={{
+ width: buttonSize,
+ height: buttonSize,
+ color: "text.muted",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ p: 0,
+ }}
>
- <Icon fontSize="small" />
+ {label === "YouTube" ? (
+ <Icon sx={{ fontSize: 24 }} />
+ ) : label === "Reddit" ? (
+ <Icon sx={{ fontSize: 22 }} />
+ ) : (
+ <Icon fontSize="small" />
+ )}
</IconButton>
))}
</Stack>
@@ -65,3 +95,33 @@ export const LockerSocialFooter: React.FC = () => {
</Stack>
);
};
+
+function DiscordBrandIcon(props: { fontSize?: "small" | "medium" }) {
+ const size = props.fontSize === "small" ? 20 : 20;
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="currentColor"
+ aria-hidden="true"
+ >
+ <path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" />
+ </svg>
+ );
+}
+
+function MastodonBrandIcon(props: { fontSize?: "small" | "medium" }) {
+ const size = props.fontSize === "small" ? 20 : 20;
+ return (
+ <svg
+ width={size}
+ height={size}
+ viewBox="0 0 24 24"
+ fill="currentColor"
+ aria-hidden="true"
+ >
+ <path d="M23.268 5.313c-.35-2.578-2.617-4.61-5.304-5.004C17.51.242 15.792 0 11.813 0h-.03c-3.98 0-4.835.242-5.288.309C3.882.692 1.496 2.518.917 5.127.64 6.412.61 7.837.661 9.143c.074 1.874.088 3.745.26 5.611.118 1.24.325 2.47.62 3.68.55 2.237 2.777 4.098 4.96 4.857 2.336.792 4.849.923 7.256.38.265-.061.527-.132.786-.213.585-.184 1.27-.39 1.774-.753a.057.057 0 0 0 .023-.043v-1.809a.052.052 0 0 0-.02-.041.053.053 0 0 0-.046-.01 20.282 20.282 0 0 1-4.709.545c-2.73 0-3.463-1.284-3.674-1.818a5.593 5.593 0 0 1-.319-1.433.053.053 0 0 1 .066-.054c1.517.363 3.072.546 4.632.546.376 0 .75 0 1.125-.01 1.57-.044 3.224-.124 4.768-.422.038-.008.077-.015.11-.024 2.435-.464 4.753-1.92 4.989-5.604.008-.145.03-1.52.03-1.67.002-.512.167-3.63-.024-5.545zm-3.748 9.195h-2.561V8.29c0-1.309-.55-1.976-1.67-1.976-1.23 0-1.846.79-1.846 2.35v3.403h-2.546V8.663c0-1.56-.617-2.35-1.848-2.35-1.112 0-1.668.668-1.67 1.977v6.218H4.822V8.102c0-1.31.337-2.35 1.011-3.12.696-.77 1.608-1.164 2.74-1.164 1.311 0 2.302.5 2.962 1.498l.638 1.06.638-1.06c.66-.999 1.65-1.498 2.96-1.498 1.13 0 2.043.395 2.74 1.164.675.77 1.012 1.81 1.012 3.12z" />
+ </svg>
+ );
+}
diff --git a/web/apps/locker/src/components/LockerSupportDrawer.tsx b/web/apps/locker/src/components/LockerSupportDrawer.tsx
index 15282689ca..80779e5a3f 100644
--- a/web/apps/locker/src/components/LockerSupportDrawer.tsx
+++ b/web/apps/locker/src/components/LockerSupportDrawer.tsx
@@ -1,16 +1,12 @@
+import {
+ HelpCircleIcon,
+ InformationCircleIcon,
+ MessageQuestionIcon,
+ NewsIcon,
+} from "@hugeicons/core-free-icons";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
-import InfoOutlinedIcon from "@mui/icons-material/InfoOutlined";
import NorthEastIcon from "@mui/icons-material/NorthEast";
-import { Stack, Tooltip, Typography } from "@mui/material";
-import {
- RowButton,
- RowButtonDivider,
- RowButtonGroup,
-} from "ente-base/components/RowButton";
-import {
- TitledNestedSidebarDrawer,
- type NestedSidebarDrawerVisibilityProps,
-} from "ente-base/components/mui/SidebarDrawer";
+import { Box, Stack, Tooltip, Typography, useTheme } from "@mui/material";
import { useBaseContext } from "ente-base/context";
import log from "ente-base/log";
import { savedLogs } from "ente-base/log-web";
@@ -19,11 +15,17 @@ import { initiateEmail, openURL } from "ente-new/photos/utils/web";
import { t } from "i18next";
import React from "react";
import { Trans } from "react-i18next";
+import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
+import {
+ LockerTitledNestedSidebarDrawer,
+ type LockerNestedSidebarDrawerVisibilityProps,
+} from "./LockerSidebarShell";
export const LockerSupportDrawer: React.FC<
- NestedSidebarDrawerVisibilityProps
+ LockerNestedSidebarDrawerVisibilityProps
> = ({ open, onClose, onRootClose }) => {
const { showMiniDialog } = useBaseContext();
+ const theme = useTheme();
const handleRootClose = () => {
onClose();
@@ -54,53 +56,68 @@ export const LockerSupportDrawer: React.FC<
});
return (
- <TitledNestedSidebarDrawer
+ <LockerTitledNestedSidebarDrawer
{...{ open, onClose }}
onRootClose={handleRootClose}
- title={t("help")}
+ title={t("help_and_support")}
+ hideRootCloseButton
>
- <Stack sx={{ px: 2, py: 1, gap: 3 }}>
- <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>
- <RowButtonGroup>
- <RowButton
- endIcon={<ChevronRightIcon />}
- label={t("view_logs")}
- onClick={confirmViewLogs}
- />
- </RowButtonGroup>
+ <Stack
+ sx={{
+ px: 2,
+ py: 1,
+ gap: 1,
+ backgroundColor: "background.default",
+ ...theme.applyStyles("dark", {
+ backgroundColor: "background.paper",
+ }),
+ }}
+ >
+ <LockerSidebarCardButton
+ icon={InformationCircleIcon}
+ label={t("help")}
+ endIcon={<NorthEastIcon />}
+ onClick={handleHelp}
+ />
+ <LockerSidebarCardButton
+ icon={NewsIcon}
+ label={t("blog")}
+ endIcon={<NorthEastIcon />}
+ onClick={handleBlog}
+ />
+ <LockerSidebarCardButton
+ icon={MessageQuestionIcon}
+ label={t("request_feature")}
+ endIcon={<NorthEastIcon />}
+ onClick={handleRequestFeature}
+ />
+ <LockerSidebarCardButton
+ icon={HelpCircleIcon}
+ label={
+ <Tooltip title="[email protected]">
+ <Typography variant="small" sx={{ fontWeight: 500 }}>
+ {t("support")}
+ </Typography>
+ </Tooltip>
+ }
+ endIcon={<ChevronRightIcon />}
+ onClick={handleSupport}
+ />
+ <Box
+ sx={{
+ borderTop: 1,
+ borderColor: "divider",
+ mx: 1,
+ my: 1,
+ }}
+ />
+ <LockerSidebarCardButton
+ icon={InformationCircleIcon}
+ label={t("view_logs")}
+ endIcon={<ChevronRightIcon />}
+ onClick={confirmViewLogs}
+ />
</Stack>
- </TitledNestedSidebarDrawer>
+ </LockerTitledNestedSidebarDrawer>
);
};