Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(locker):update-settings-sidebar

Aswin Asokb2f0b7e4c0cb
diff --git a/web/apps/locker/src/components/LockerAboutDrawer.tsx b/web/apps/locker/src/components/LockerAboutDrawer.tsx
index ccac31d407..c36b3dcaa8 100644
--- a/web/apps/locker/src/components/LockerAboutDrawer.tsx
+++ b/web/apps/locker/src/components/LockerAboutDrawer.tsx
@@ -4,7 +4,6 @@ import {
Shield01Icon,
} from "@hugeicons/core-free-icons";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
-import { Stack } from "@mui/material";
import { t } from "i18next";
import React from "react";
import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
@@ -28,28 +27,25 @@ export const LockerAboutDrawer: React.FC<
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("about")}
- hideRootCloseButton
>
- <Stack sx={{ px: 2, py: 1, gap: 1 }}>
- <LockerSidebarCardButton
- icon={GithubIcon}
- label={t("we_are_open_source")}
- endIcon={<ChevronRightIcon />}
- onClick={() => openExternal("https://github.com/ente/ente")}
- />
- <LockerSidebarCardButton
- icon={Shield01Icon}
- label={t("privacy")}
- endIcon={<ChevronRightIcon />}
- onClick={() => openExternal("https://ente.com/privacy")}
- />
- <LockerSidebarCardButton
- icon={File01Icon}
- label={t("terms")}
- endIcon={<ChevronRightIcon />}
- onClick={() => openExternal("https://ente.com/terms")}
- />
- </Stack>
+ <LockerSidebarCardButton
+ icon={GithubIcon}
+ label={t("we_are_open_source")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => openExternal("https://github.com/ente/ente")}
+ />
+ <LockerSidebarCardButton
+ icon={Shield01Icon}
+ label={t("privacy")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => openExternal("https://ente.com/privacy")}
+ />
+ <LockerSidebarCardButton
+ icon={File01Icon}
+ label={t("terms")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => openExternal("https://ente.com/terms")}
+ />
</LockerTitledNestedSidebarDrawer>
);
};
diff --git a/web/apps/locker/src/components/LockerAccountDrawer.tsx b/web/apps/locker/src/components/LockerAccountDrawer.tsx
index 73258e5573..0b6fbe903c 100644
--- a/web/apps/locker/src/components/LockerAccountDrawer.tsx
+++ b/web/apps/locker/src/components/LockerAccountDrawer.tsx
@@ -1,58 +1,42 @@
import {
- ComputerPhoneSyncIcon,
- Key01Icon,
Key02Icon,
Mail01Icon,
PasswordValidationIcon,
- SecurityCheckIcon,
} from "@hugeicons/core-free-icons";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
-import { Stack, Typography } from "@mui/material";
-import { RecoveryKey } from "ente-accounts/components/RecoveryKey";
-import { openAccountsManagePasskeysPage } from "ente-accounts/services/passkey";
-import { useBaseContext } from "ente-base/context";
import { t } from "i18next";
import { useRouter } from "next/router";
import React, { useEffect, useState } from "react";
import { LockerAuthenticateUser } from "./LockerAuthenticateUser";
-import { LockerSessionsDrawer } from "./LockerSessionsDrawer";
+import { LockerRecoveryKeyDrawer } from "./LockerRecoveryKeyDrawer";
import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
import {
LockerTitledNestedSidebarDrawer,
type LockerNestedSidebarDrawerVisibilityProps,
} from "./LockerSidebarShell";
-import { LockerTwoFactorDrawer } from "./LockerTwoFactorDrawer";
type AuthenticatedAccountAction =
| "recoveryKey"
- | "activeSessions"
| "changePassword"
| "changeEmail";
export const LockerAccountDrawer: React.FC<
LockerNestedSidebarDrawerVisibilityProps
> = ({ open, onClose, onRootClose }) => {
- const { showMiniDialog, onGenericError } = useBaseContext();
const router = useRouter();
const [isRecoveryKeyOpen, setIsRecoveryKeyOpen] = useState(false);
- const [isSessionsOpen, setIsSessionsOpen] = useState(false);
- const [isTwoFactorOpen, setIsTwoFactorOpen] = useState(false);
const [authenticatedAction, setAuthenticatedAction] =
useState<AuthenticatedAccountAction>();
useEffect(() => {
if (!open) {
setIsRecoveryKeyOpen(false);
- setIsSessionsOpen(false);
- setIsTwoFactorOpen(false);
setAuthenticatedAction(undefined);
}
}, [open]);
const handleRootClose = () => {
setIsRecoveryKeyOpen(false);
- setIsSessionsOpen(false);
- setIsTwoFactorOpen(false);
setAuthenticatedAction(undefined);
onClose();
onRootClose();
@@ -72,9 +56,6 @@ export const LockerAccountDrawer: React.FC<
case "recoveryKey":
setIsRecoveryKeyOpen(true);
break;
- case "activeSessions":
- setIsSessionsOpen(true);
- break;
case "changePassword":
handleNavigate("/change-password");
break;
@@ -85,99 +66,43 @@ export const LockerAccountDrawer: React.FC<
setAuthenticatedAction(undefined);
};
- const handleOpenPasskeys = async () => {
- handleRootClose();
- try {
- await openAccountsManagePasskeysPage();
- } catch (e) {
- onGenericError(e);
- }
- };
-
return (
<>
<LockerTitledNestedSidebarDrawer
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("account")}
- hideRootCloseButton
>
- <Stack sx={{ px: 2, pb: 2, gap: 2 }}>
- <LockerSidebarCardButton
- icon={Key02Icon}
- label={t("recovery_key")}
- onClick={() => authenticateBefore("recoveryKey")}
- />
-
- <Stack sx={{ gap: 1 }}>
- <Typography
- variant="mini"
- sx={{
- px: 1,
- color: "text.faint",
- textTransform: "uppercase",
- letterSpacing: "0.08em",
- fontWeight: "bold",
- }}
- >
- {t("security")}
- </Typography>
- <LockerSidebarCardButton
- icon={SecurityCheckIcon}
- label={t("two_factor")}
- onClick={() => setIsTwoFactorOpen(true)}
- />
- <LockerSidebarCardButton
- icon={Key01Icon}
- label={t("passkeys")}
- endIcon={<ChevronRightIcon />}
- onClick={handleOpenPasskeys}
- />
- <LockerSidebarCardButton
- icon={ComputerPhoneSyncIcon}
- label={t("active_sessions")}
- endIcon={<ChevronRightIcon />}
- onClick={() => authenticateBefore("activeSessions")}
- />
- </Stack>
-
- <Stack sx={{ gap: 1 }}>
- <LockerSidebarCardButton
- icon={PasswordValidationIcon}
- label={t("change_password")}
- onClick={() => authenticateBefore("changePassword")}
- />
- <LockerSidebarCardButton
- icon={Mail01Icon}
- label={t("change_email")}
- onClick={() => authenticateBefore("changeEmail")}
- />
- </Stack>
- </Stack>
+ <LockerSidebarCardButton
+ icon={Mail01Icon}
+ label={t("change_email")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => authenticateBefore("changeEmail")}
+ />
+ <LockerSidebarCardButton
+ icon={Key02Icon}
+ label={t("recovery_key")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => authenticateBefore("recoveryKey")}
+ />
+ <LockerSidebarCardButton
+ icon={PasswordValidationIcon}
+ label={t("change_password")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => authenticateBefore("changePassword")}
+ />
</LockerTitledNestedSidebarDrawer>
- <LockerSessionsDrawer
- open={isSessionsOpen}
- onClose={() => setIsSessionsOpen(false)}
- onRootClose={handleRootClose}
- />
-
- <LockerTwoFactorDrawer
- open={isTwoFactorOpen}
- onClose={() => setIsTwoFactorOpen(false)}
- onRootClose={handleRootClose}
- />
-
<LockerAuthenticateUser
open={!!authenticatedAction}
onClose={() => setAuthenticatedAction(undefined)}
onAuthenticate={handleAuthenticatedAction}
/>
- <RecoveryKey
+ <LockerRecoveryKeyDrawer
open={isRecoveryKeyOpen}
onClose={() => setIsRecoveryKeyOpen(false)}
- showMiniDialog={showMiniDialog}
+ onRootClose={handleRootClose}
/>
</>
);
diff --git a/web/apps/locker/src/components/LockerLegacyDrawer.tsx b/web/apps/locker/src/components/LockerLegacyDrawer.tsx
index f9fe43ca4c..094eb03361 100644
--- a/web/apps/locker/src/components/LockerLegacyDrawer.tsx
+++ b/web/apps/locker/src/components/LockerLegacyDrawer.tsx
@@ -1,9 +1,13 @@
import { authenticatedLegacySession } from "@/services/authenticated-session";
+import { UserAdd01Icon } from "@hugeicons/core-free-icons";
+import { CircularProgress } from "@mui/material";
import {
LegacyDrawerContent,
type LegacySuggestedUser,
} from "ente-contacts/legacy";
+import { t } from "i18next";
import React from "react";
+import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
import {
LockerTitledNestedSidebarDrawer,
type LockerNestedSidebarDrawerVisibilityProps,
@@ -16,13 +20,26 @@ export const LockerLegacyDrawer: React.FC<
> = ({ open, onClose, onRootClose, suggestedUsers }) => (
<LockerTitledNestedSidebarDrawer
{...{ open, onClose, onRootClose }}
- title="Legacy"
- caption="Legacy allows trusted contacts to access your account in your absence."
+ title={t("legacy")}
>
<LegacyDrawerContent
+ intro={t("legacy_intro")}
open={open}
suggestedUsers={suggestedUsers}
getSession={authenticatedLegacySession}
+ renderAddContactButton={({ onClick, disabled, loading }) => (
+ <LockerSidebarCardButton
+ icon={UserAdd01Icon}
+ iconNode={
+ loading ? (
+ <CircularProgress size={18} color="inherit" />
+ ) : undefined
+ }
+ label={t("add_trusted_contact")}
+ onClick={onClick}
+ disabled={disabled}
+ />
+ )}
/>
</LockerTitledNestedSidebarDrawer>
);
diff --git a/web/apps/locker/src/components/LockerRecoveryKeyDrawer.tsx b/web/apps/locker/src/components/LockerRecoveryKeyDrawer.tsx
new file mode 100644
index 0000000000..e1324f1aba
--- /dev/null
+++ b/web/apps/locker/src/components/LockerRecoveryKeyDrawer.tsx
@@ -0,0 +1,148 @@
+import {
+ Box,
+ Button,
+ CircularProgress,
+ Stack,
+ Typography,
+} from "@mui/material";
+import { CopyButton } from "ente-accounts/components/CodeBlock";
+import {
+ RecoveryKeyContents,
+ type RecoveryKeyPresentationProps,
+} from "ente-accounts/components/RecoveryKey";
+import { useBaseContext } from "ente-base/context";
+import { t } from "i18next";
+import {
+ LockerTitledNestedSidebarDrawer,
+ type LockerNestedSidebarDrawerVisibilityProps,
+} from "./LockerSidebarShell";
+import {
+ bodyBoldSx,
+ fillDarkSx,
+ miniSx,
+ textBaseSx,
+ textLightSx,
+} from "./locker-sidebar-styles";
+
+export function LockerRecoveryKeyDrawer({
+ open,
+ onClose,
+ onRootClose,
+}: LockerNestedSidebarDrawerVisibilityProps) {
+ const { showMiniDialog } = useBaseContext();
+ return (
+ <LockerTitledNestedSidebarDrawer
+ {...{ open, onClose, onRootClose }}
+ title={t("recovery_key")}
+ >
+ <RecoveryKeyContents
+ {...{ open, onClose, showMiniDialog }}
+ presentation={LockerRecoveryKeyPresentation}
+ />
+ </LockerTitledNestedSidebarDrawer>
+ );
+}
+
+function LockerRecoveryKeyPresentation({
+ recoveryKey,
+ onClose,
+ onSave,
+}: RecoveryKeyPresentationProps) {
+ return (
+ <Stack sx={{ flex: 1 }}>
+ <Typography sx={[miniSx, textLightSx]}>
+ {t("recovery_key_description")}
+ </Typography>
+ <Box
+ sx={{
+ mt: 3,
+ borderRadius: "16px",
+ bgcolor: "accent.main",
+ color: "#fff",
+ p: "24px 64px 24px 22px",
+ position: "relative",
+ }}
+ >
+ {recoveryKey === undefined ? (
+ <Box
+ sx={{
+ display: "flex",
+ justifyContent: "center",
+ mr: "-42px",
+ }}
+ >
+ <CircularProgress size={24} color="inherit" />
+ </Box>
+ ) : (
+ <>
+ <Typography
+ sx={{
+ fontFamily: "ui-monospace, Menlo, monospace",
+ fontSize: 14,
+ lineHeight: "21px",
+ letterSpacing: ".5px",
+ textAlign: "justify",
+ }}
+ >
+ {recoveryKey}
+ </Typography>
+ <Box
+ sx={{
+ position: "absolute",
+ right: 8,
+ top: 8,
+ width: 40,
+ height: 40,
+ display: "grid",
+ placeItems: "center",
+ color: "#fff",
+ "& .MuiIconButton-root, & svg": {
+ color: "inherit",
+ },
+ }}
+ >
+ <CopyButton code={recoveryKey} />
+ </Box>
+ </>
+ )}
+ </Box>
+ <Typography sx={[miniSx, textLightSx, { mt: "20px" }]}>
+ {t("key_not_stored_note")}
+ </Typography>
+ <Stack sx={{ mt: "auto", pt: 3, gap: 1 }}>
+ <Button
+ fullWidth
+ disableElevation
+ variant="contained"
+ color="accent"
+ disabled={recoveryKey === undefined}
+ onClick={onSave}
+ sx={[
+ bodyBoldSx,
+ {
+ height: 52,
+ borderRadius: "20px",
+ bgcolor: "accent.main",
+ color: "#fff",
+ },
+ ]}
+ >
+ {t("save_key")}
+ </Button>
+ <Button
+ fullWidth
+ disableElevation
+ onClick={onClose}
+ sx={[
+ bodyBoldSx,
+ fillDarkSx,
+ textBaseSx,
+ { height: 52, borderRadius: "20px" },
+ ]}
+ >
+ {t("do_this_later")}
+ </Button>
+ </Stack>
+ </Stack>
+ );
+}
diff --git a/web/apps/locker/src/components/LockerSecurityDrawer.tsx b/web/apps/locker/src/components/LockerSecurityDrawer.tsx
new file mode 100644
index 0000000000..081dff8fb7
--- /dev/null
+++ b/web/apps/locker/src/components/LockerSecurityDrawer.tsx
@@ -0,0 +1,104 @@
+import {
+ ComputerPhoneSyncIcon,
+ Key01Icon,
+ SecurityCheckIcon,
+} from "@hugeicons/core-free-icons";
+import ChevronRightIcon from "@mui/icons-material/ChevronRight";
+import { openAccountsManagePasskeysPage } from "ente-accounts/services/passkey";
+import { useBaseContext } from "ente-base/context";
+import { t } from "i18next";
+import React, { useEffect, useState } from "react";
+import { LockerAuthenticateUser } from "./LockerAuthenticateUser";
+import { LockerSessionsDrawer } from "./LockerSessionsDrawer";
+import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
+import {
+ LockerTitledNestedSidebarDrawer,
+ type LockerNestedSidebarDrawerVisibilityProps,
+} from "./LockerSidebarShell";
+import { LockerTwoFactorDrawer } from "./LockerTwoFactorDrawer";
+
+export const LockerSecurityDrawer: React.FC<
+ LockerNestedSidebarDrawerVisibilityProps
+> = ({ open, onClose, onRootClose }) => {
+ const { onGenericError } = useBaseContext();
+ const [isSessionsOpen, setIsSessionsOpen] = useState(false);
+ const [isTwoFactorOpen, setIsTwoFactorOpen] = useState(false);
+ const [authenticatedAction, setAuthenticatedAction] =
+ useState<"activeSessions">();
+
+ useEffect(() => {
+ if (!open) {
+ setIsSessionsOpen(false);
+ setIsTwoFactorOpen(false);
+ setAuthenticatedAction(undefined);
+ }
+ }, [open]);
+
+ const handleRootClose = () => {
+ setIsSessionsOpen(false);
+ setIsTwoFactorOpen(false);
+ setAuthenticatedAction(undefined);
+ onClose();
+ onRootClose();
+ };
+
+ const handleAuthenticatedAction = () => {
+ if (authenticatedAction === "activeSessions") {
+ setIsSessionsOpen(true);
+ }
+ setAuthenticatedAction(undefined);
+ };
+
+ const handleOpenPasskeys = async () => {
+ handleRootClose();
+ try {
+ await openAccountsManagePasskeysPage();
+ } catch (e) {
+ onGenericError(e);
+ }
+ };
+
+ return (
+ <>
+ <LockerTitledNestedSidebarDrawer
+ {...{ open, onClose }}
+ onRootClose={handleRootClose}
+ title={t("security")}
+ >
+ <LockerSidebarCardButton
+ icon={SecurityCheckIcon}
+ label={t("two_factor")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => setIsTwoFactorOpen(true)}
+ />
+ <LockerSidebarCardButton
+ icon={Key01Icon}
+ label={t("passkeys")}
+ endIcon={<ChevronRightIcon />}
+ onClick={handleOpenPasskeys}
+ />
+ <LockerSidebarCardButton
+ icon={ComputerPhoneSyncIcon}
+ label={t("active_sessions")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => setAuthenticatedAction("activeSessions")}
+ />
+ </LockerTitledNestedSidebarDrawer>
+ <LockerSessionsDrawer
+ open={isSessionsOpen}
+ onClose={() => setIsSessionsOpen(false)}
+ onRootClose={handleRootClose}
+ />
+ <LockerTwoFactorDrawer
+ open={isTwoFactorOpen}
+ onClose={() => setIsTwoFactorOpen(false)}
+ onRootClose={handleRootClose}
+ />
+ <LockerAuthenticateUser
+ open={!!authenticatedAction}
+ onClose={() => setAuthenticatedAction(undefined)}
+ onAuthenticate={handleAuthenticatedAction}
+ />
+ </>
+ );
+};
diff --git a/web/apps/locker/src/components/LockerSessionsDrawer.tsx b/web/apps/locker/src/components/LockerSessionsDrawer.tsx
index 7e6b9f1e49..721eb245ac 100644
--- a/web/apps/locker/src/components/LockerSessionsDrawer.tsx
+++ b/web/apps/locker/src/components/LockerSessionsDrawer.tsx
@@ -1,10 +1,9 @@
-import ChevronRightIcon from "@mui/icons-material/ChevronRight";
-import DevicesIcon from "@mui/icons-material/Devices";
+import { ComputerIcon, SmartPhone01Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
import RefreshIcon from "@mui/icons-material/Refresh";
import {
Box,
CircularProgress,
- Divider,
IconButton,
Stack,
Typography,
@@ -16,7 +15,6 @@ import {
terminateSession,
type Session,
} from "ente-accounts/services/sessions";
-import { RowButton, RowButtonGroup } from "ente-base/components/RowButton";
import { useBaseContext } from "ente-base/context";
import { isHTTP401Error } from "ente-base/http";
import { formattedDateTime } from "ente-base/i18n-date";
@@ -28,6 +26,17 @@ import {
LockerTitledNestedSidebarDrawer,
type LockerNestedSidebarDrawerVisibilityProps,
} from "./LockerSidebarShell";
+import {
+ bodySx,
+ miniSx,
+ rowSurfaceSx,
+ sidebarBackgroundSx,
+ textBaseSx,
+ textLightSx,
+ titlebarActionButtonSx,
+} from "./locker-sidebar-styles";
+
+const mobileUserAgentRegex = /iphone|ipad|android|mobile/i;
export const LockerSessionsDrawer: React.FC<
LockerNestedSidebarDrawerVisibilityProps
@@ -44,14 +53,35 @@ export const LockerSessionsDrawer: React.FC<
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("active_sessions")}
- hideRootCloseButton
+ slotProps={{
+ paper: {
+ sx: (theme) => ({
+ scrollbarWidth: "thin",
+ scrollbarColor: "#b3b3b3 transparent",
+ "&::-webkit-scrollbar": { width: 6 },
+ "&::-webkit-scrollbar-track": {
+ backgroundColor: "transparent",
+ },
+ "&::-webkit-scrollbar-thumb": {
+ backgroundColor: "#b3b3b3",
+ borderRadius: 3,
+ },
+ ...theme.applyStyles("dark", {
+ scrollbarColor: "#555555 transparent",
+ "&::-webkit-scrollbar-thumb": {
+ backgroundColor: "#555555",
+ },
+ }),
+ }),
+ },
+ }}
actionButton={
<IconButton
onClick={() => setRefreshTrigger((value) => value + 1)}
- color="primary"
- sx={{ opacity: 0.2 }}
+ aria-label={t("refresh")}
+ sx={titlebarActionButtonSx}
>
- <RefreshIcon />
+ <RefreshIcon sx={{ fontSize: 18 }} />
</IconButton>
}
>
@@ -195,27 +225,18 @@ const SessionsContents: React.FC<SessionsContentsProps> = ({
}
return (
- <Stack sx={{ px: 2, pb: "12px", gap: 2 }}>
- <Typography variant="small" sx={{ color: "text.faint" }}>
+ <Stack sx={{ gap: 1 }}>
+ <Typography sx={[miniSx, textLightSx]}>
{t("active_sessions_hint")}
</Typography>
- <RowButtonGroup>
- {sessions.map((session, index) => (
- <React.Fragment key={session.token}>
- <SessionRow
- session={session}
- isCurrentDevice={isCurrentSession(
- session,
- currentToken,
- )}
- onTerminate={() => handleTerminateSession(session)}
- />
- {index < sessions.length - 1 && (
- <Divider sx={{ opacity: 0.4 }} />
- )}
- </React.Fragment>
- ))}
- </RowButtonGroup>
+ {sessions.map((session) => (
+ <SessionRow
+ key={session.token}
+ session={session}
+ isCurrentDevice={isCurrentSession(session, currentToken)}
+ onTerminate={() => handleTerminateSession(session)}
+ />
+ ))}
</Stack>
);
};
@@ -233,39 +254,79 @@ const SessionRow: React.FC<SessionRowProps> = ({
}) => {
const lastUsedFormatted = formattedDateTime(session.lastUsedTime);
+ const ip =
+ session.ip.length > 28 ? `${session.ip.slice(0, 28)}…` : session.ip;
+
return (
- <RowButton
- startIcon={<DevicesIcon />}
- label={
- <Stack sx={{ gap: 0.5, alignItems: "flex-start" }}>
- <Typography
- sx={{
- fontWeight: isCurrentDevice ? "bold" : "medium",
- color: isCurrentDevice
- ? "accent.main"
- : "text.base",
- textAlign: "left",
- }}
- >
- {isCurrentDevice ? t("this_device") : session.prettyUA}
- </Typography>
- {!isCurrentDevice && (
- <Typography
- variant="small"
- sx={{ color: "text.muted" }}
- >
- {session.ip.length > 28
- ? `${session.ip.slice(0, 28)}…`
- : session.ip}
- </Typography>
- )}
- <Typography variant="small" sx={{ color: "text.faint" }}>
- {lastUsedFormatted}
- </Typography>
- </Stack>
- }
- endIcon={<ChevronRightIcon />}
+ <Box
+ component="button"
+ type="button"
onClick={onTerminate}
- />
+ sx={[
+ rowSurfaceSx,
+ {
+ p: 1.5,
+ borderRadius: "20px",
+ border: 0,
+ m: 0,
+ display: "flex",
+ alignItems: "center",
+ gap: 1.5,
+ width: "100%",
+ textAlign: "left",
+ cursor: "pointer",
+ "&:focus-visible": {
+ outline: "2px solid",
+ outlineColor: "accent.main",
+ outlineOffset: 2,
+ },
+ },
+ ]}
+ >
+ <Box
+ sx={[
+ sidebarBackgroundSx,
+ textLightSx,
+ {
+ width: 40,
+ height: 40,
+ borderRadius: "12px",
+ flexShrink: 0,
+ display: "grid",
+ placeItems: "center",
+ },
+ ]}
+ >
+ <HugeiconsIcon
+ icon={
+ mobileUserAgentRegex.test(session.prettyUA)
+ ? SmartPhone01Icon
+ : ComputerIcon
+ }
+ size={18}
+ strokeWidth={1.6}
+ color="currentColor"
+ />
+ </Box>
+ <Box sx={{ flex: 1, minWidth: 0 }}>
+ <Typography
+ noWrap
+ sx={[
+ bodySx,
+ textBaseSx,
+ ...(isCurrentDevice
+ ? [{ "&&": { color: "accent.main" } }]
+ : []),
+ ]}
+ >
+ {isCurrentDevice ? t("this_device") : session.prettyUA}
+ </Typography>
+ <Typography sx={[miniSx, textLightSx, { mt: 0.5 }]}>
+ {isCurrentDevice
+ ? lastUsedFormatted
+ : `${ip} Β· ${lastUsedFormatted}`}
+ </Typography>
+ </Box>
+ </Box>
);
};
diff --git a/web/apps/locker/src/components/LockerSidebar.tsx b/web/apps/locker/src/components/LockerSidebar.tsx
index 7b975f96b0..a3b0bb325c 100644
--- a/web/apps/locker/src/components/LockerSidebar.tsx
+++ b/web/apps/locker/src/components/LockerSidebar.tsx
@@ -1,19 +1,16 @@
import type { LockerCollection } from "@/types";
-import { visibleLockerCollections } from "@/types";
import {
Delete02Icon,
FavouriteIcon,
HelpCircleIcon,
- Home01Icon,
InformationCircleIcon,
Logout05Icon,
+ SecurityCheckIcon,
UserIcon,
Wallet05Icon,
} from "@hugeicons/core-free-icons";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
-import CloseIcon from "@mui/icons-material/Close";
-import { Box, IconButton, Stack, Typography, useTheme } from "@mui/material";
-import { EnteLogo } from "ente-base/components/EnteLogo";
+import { Box, Stack, Typography } from "@mui/material";
import { useBaseContext } from "ente-base/context";
import {
mergeLegacySuggestedUsers,
@@ -26,10 +23,28 @@ import { LockerAboutDrawer } from "./LockerAboutDrawer";
import { LockerAccountDrawer } from "./LockerAccountDrawer";
import { LockerAuthenticateUser } from "./LockerAuthenticateUser";
import { LockerSidebarCardButton } from "./LockerSidebarCardButton";
-import { LockerSidebarDrawer } from "./LockerSidebarShell";
+import {
+ LockerSidebarDrawer,
+ LockerSidebarTitlebar,
+} from "./LockerSidebarShell";
import { LockerSocialFooter } from "./LockerSocialFooter";
import { LockerSupportDrawer } from "./LockerSupportDrawer";
+import { LockerSecurityDrawer } from "./LockerSecurityDrawer";
+import {
+ familyColor,
+ h1Sx,
+ largeSx,
+ usageBarSx,
+ usageCardSx,
+ usageMutedSx,
+} from "./locker-sidebar-styles";
+
+const legendItems = [
+ { key: "usageYou", color: "accent.main" },
+ { key: "usageFamily", color: familyColor },
+];
+
const LockerLegacyDrawer = dynamic(
() =>
import("./LockerLegacyDrawer").then(
@@ -42,11 +57,8 @@ interface LockerSidebarProps {
open: boolean;
onClose: () => void;
collections: LockerCollection[];
- trashItemCount: number;
- onSelectHome: () => void;
onSelectCollections: () => void;
onSelectTrash: () => void;
- isHomeView: boolean;
isTrashView: boolean;
isCollectionsView: boolean;
userDetails?: {
@@ -64,27 +76,19 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
open,
onClose,
collections,
- trashItemCount,
- onSelectHome,
onSelectCollections,
onSelectTrash,
- isHomeView,
isTrashView,
isCollectionsView,
userDetails,
}) => {
const { logout } = useBaseContext();
- const theme = useTheme();
- const displayCollections = visibleLockerCollections(collections);
- const totalItems = collections.reduce(
- (sum, collection) => sum + collection.items.length,
- 0,
- );
const [isAccountOpen, setIsAccountOpen] = useState(false);
const [isLegacyAuthenticateOpen, setIsLegacyAuthenticateOpen] =
useState(false);
const [isLegacyOpen, setIsLegacyOpen] = useState(false);
const [isSupportOpen, setIsSupportOpen] = useState(false);
+ const [isSecurityOpen, setIsSecurityOpen] = useState(false);
const [isAboutOpen, setIsAboutOpen] = useState(false);
const legacySuggestedUsers = useMemo(() => {
const participants: LegacySuggestedUser[] = collections.flatMap(
@@ -129,6 +133,7 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
setIsLegacyOpen(false);
setIsSupportOpen(false);
setIsAboutOpen(false);
+ setIsSecurityOpen(false);
}
}, [open]);
@@ -137,141 +142,52 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
<LockerSidebarDrawer open={open} onClose={onClose} anchor="left">
<Stack
sx={{
- height: "calc(100dvh - env(titlebar-area-height, 0px) - 16px)",
+ height: "100dvh",
minHeight: 0,
- backgroundColor: "#f4f4f4",
- ...theme.applyStyles("dark", {
- backgroundColor: "#161616",
- }),
+ overflow: "hidden",
}}
>
+ <LockerSidebarTitlebar
+ onClose={onClose}
+ title={userDetails?.email || "Ente Locker"}
+ closeLabel={t("close")}
+ tooltip={userDetails?.email}
+ />
<Box
sx={{
flex: 1,
minHeight: 0,
overflowY: "auto",
overscrollBehavior: "contain",
- WebkitOverflowScrolling: "touch",
+ p: "0 16px 24px",
}}
>
- <Stack sx={{ px: 1, pt: 0.5, pb: 0.5 }}>
- <Stack
- direction="row"
- sx={{
- alignItems: "center",
- justifyContent: "space-between",
- }}
- >
- <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"
- sx={{ mr: 0.75 }}
- >
- <CloseIcon />
- </IconButton>
- </Stack>
- </Stack>
-
- {userDetails?.email && (
- <Typography
- variant="small"
- sx={{
- px: 2,
- pb: 1,
- color: "text.muted",
- wordBreak: "break-all",
- }}
- >
- {userDetails.email}
- </Typography>
- )}
-
{userDetails && (
- <Box
- sx={{
- mx: 1.5,
- mb: 1.5,
- p: 2,
- borderRadius: "20px",
- color: "rgba(255,255,255,0.92)",
- background:
- "radial-gradient(circle at 12px 12px, rgba(255,255,255,0.03) 0 2px, transparent 2px) 0 0 / 24px 24px, linear-gradient(180deg, #2B2B2B 0%, #151515 100%)",
- overflow: "hidden",
- }}
- >
- <Typography
- variant="small"
- sx={{
- color: "rgba(255,255,255,0.68)",
- mb: 0.5,
- display: "block",
- fontSize: 16,
- lineHeight: "20px",
- }}
- >
+ <Box sx={usageCardSx}>
+ <Typography sx={[largeSx, usageMutedSx]}>
{t("itemsStored")}
</Typography>
- <Typography
- sx={{
- mb: 2,
- display: "block",
- fontSize: 32,
- lineHeight: "39px",
- fontWeight: 500,
- }}
- >
+ <Typography sx={{ ...h1Sx, mt: 0.5 }}>
{formattedUsed}
<Box
component="span"
- sx={{
- color: "rgba(255,255,255,0.68)",
- fontWeight: 500,
- }}
- >
- {` ${t("of_")} `}
- </Box>
+ sx={usageMutedSx}
+ >{` ${t("of_")} `}</Box>
{formattedMax}
</Typography>
- <Box
- sx={{
- position: "relative",
- height: 8,
- borderRadius: 999,
- bgcolor: "rgba(193, 193, 193, 0.11)",
- overflow: "hidden",
- }}
- >
+ <Box sx={usageBarSx}>
{showFamilyBreakup && (
<Box
sx={{
- position: "absolute",
- inset: 0,
width: `${familyProgress * 100}%`,
- borderRadius: 999,
- bgcolor:
- "rgba(255,255,255,0.92)",
+ bgcolor: familyColor,
}}
/>
)}
<Box
sx={{
- position: "absolute",
- inset: 0,
width: `${userProgress * 100}%`,
- borderRadius: 999,
- bgcolor: "#1071FF",
+ bgcolor: "accent.main",
}}
/>
</Box>
@@ -282,144 +198,112 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
gap: 2,
mt: 1.5,
alignItems: "center",
- color: "rgba(255,255,255,0.92)",
}}
>
- <Stack
- direction="row"
- sx={{
- gap: 0.75,
- alignItems: "center",
- }}
- >
- <Box
- sx={{
- width: 8,
- height: 8,
- borderRadius: "50%",
- bgcolor: "#1071FF",
- }}
- />
- <Typography
- variant="mini"
- sx={{
- color: "inherit",
- fontWeight: "bold",
- }}
- >
- {t("usageYou")}
- </Typography>
- </Stack>
- <Stack
- direction="row"
- sx={{
- gap: 0.75,
- alignItems: "center",
- }}
- >
- <Box
- sx={{
- width: 8,
- height: 8,
- borderRadius: "50%",
- bgcolor:
- "rgba(255,255,255,0.92)",
- }}
- />
- <Typography
- variant="mini"
+ {legendItems.map(({ key, color }) => (
+ <Stack
+ key={key}
+ direction="row"
sx={{
- color: "inherit",
- fontWeight: "bold",
+ gap: 0.75,
+ alignItems: "center",
}}
>
- {t("usageFamily")}
- </Typography>
- </Stack>
+ <Box
+ sx={{
+ width: 8,
+ height: 8,
+ borderRadius: "50%",
+ bgcolor: color,
+ }}
+ />
+ <Typography
+ variant="mini"
+ sx={{
+ color: familyColor,
+ fontWeight: "bold",
+ }}
+ >
+ {t(key)}
+ </Typography>
+ </Stack>
+ ))}
</Stack>
) : (
- <Box sx={{ height: 4 }} />
+ <Box sx={{ height: 16 }} />
)}
</Box>
)}
-
- <Box sx={{ px: 0.5, mt: 0.5 }}>
- <Stack sx={{ gap: 1 }}>
- <LockerSidebarCardButton
- icon={Home01Icon}
- label={t("home")}
- caption={String(totalItems)}
- selected={isHomeView}
- onClick={onSelectHome}
- />
+ <Stack sx={{ mt: 3, gap: 1 }}>
+ <LockerSidebarCardButton
+ icon={FavouriteIcon}
+ label={t("legacy")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() =>
+ setIsLegacyAuthenticateOpen(true)
+ }
+ />
+ <Stack direction="row" sx={{ gap: 1 }}>
<LockerSidebarCardButton
+ half
icon={Wallet05Icon}
label={t("menuCollections")}
- caption={String(displayCollections.length)}
selected={isCollectionsView}
onClick={onSelectCollections}
/>
<LockerSidebarCardButton
+ half
icon={Delete02Icon}
label={t("menuTrash")}
- caption={String(trashItemCount)}
selected={isTrashView}
onClick={onSelectTrash}
/>
</Stack>
- </Box>
- <Box sx={{ px: 0.5, mt: 2, pb: 1 }}>
- <Stack sx={{ gap: 1 }}>
- <LockerSidebarCardButton
- icon={UserIcon}
- label={t("account")}
- endIcon={<ChevronRightIcon />}
- onClick={() => setIsAccountOpen(true)}
- />
- <LockerSidebarCardButton
- icon={FavouriteIcon}
- label="Legacy"
- endIcon={<ChevronRightIcon />}
- onClick={() =>
- setIsLegacyAuthenticateOpen(true)
- }
- />
- <LockerSidebarCardButton
- icon={HelpCircleIcon}
- label={t("help_and_support")}
- endIcon={<ChevronRightIcon />}
- onClick={() => setIsSupportOpen(true)}
- />
- <LockerSidebarCardButton
- icon={InformationCircleIcon}
- label={t("about")}
- endIcon={<ChevronRightIcon />}
- onClick={() => setIsAboutOpen(true)}
- />
- </Stack>
- </Box>
- <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>
+ </Stack>
+ <Stack sx={{ mt: 3, gap: 1 }}>
+ <LockerSidebarCardButton
+ icon={UserIcon}
+ label={t("account")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => setIsAccountOpen(true)}
+ />
+ <LockerSidebarCardButton
+ icon={SecurityCheckIcon}
+ label={t("security")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => setIsSecurityOpen(true)}
+ />
+ <LockerSidebarCardButton
+ icon={HelpCircleIcon}
+ label={t("help_and_support")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => setIsSupportOpen(true)}
+ />
+ <LockerSidebarCardButton
+ icon={InformationCircleIcon}
+ label={t("about")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => setIsAboutOpen(true)}
+ />
+ <LockerSidebarCardButton
+ icon={Logout05Icon}
+ label={t("logout")}
+ endIcon={<ChevronRightIcon />}
+ color="warning"
+ onClick={logout}
+ />
+ </Stack>
</Box>
-
- <Box
- sx={{
- pb: "max(8px, env(safe-area-inset-bottom))",
- flexShrink: 0,
- }}
- >
+ <Box sx={{ flexShrink: 0, p: "24px 16px" }}>
<LockerSocialFooter />
</Box>
</Stack>
</LockerSidebarDrawer>
+ <LockerSecurityDrawer
+ open={isSecurityOpen}
+ onClose={() => setIsSecurityOpen(false)}
+ onRootClose={onClose}
+ />
<LockerAccountDrawer
open={isAccountOpen}
diff --git a/web/apps/locker/src/components/LockerSidebarCardButton.tsx b/web/apps/locker/src/components/LockerSidebarCardButton.tsx
index ffd70de6ce..e9699de159 100644
--- a/web/apps/locker/src/components/LockerSidebarCardButton.tsx
+++ b/web/apps/locker/src/components/LockerSidebarCardButton.tsx
@@ -1,16 +1,30 @@
import { HugeiconsIcon } from "@hugeicons/react";
-import { Box, Stack, Typography } from "@mui/material";
+import ChevronRightIcon from "@mui/icons-material/ChevronRight";
+import { Box, Typography } from "@mui/material";
import React from "react";
+import {
+ bodyBoldSx,
+ bodySx,
+ largeSx,
+ miniSx,
+ rowSurfaceSx,
+ selectedRowSx,
+ textBaseSx,
+ textLightSx,
+ warningSx,
+} from "./locker-sidebar-styles";
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;
+ color?: "warning";
+ subtitle?: string;
+ half?: boolean;
+ disabled?: boolean;
}
export const LockerSidebarCardButton: React.FC<
@@ -20,151 +34,152 @@ export const LockerSidebarCardButton: React.FC<
iconNode,
label,
onClick,
- caption,
endIcon,
selected = false,
color,
+ subtitle,
+ half,
+ disabled = false,
}) => (
<Box
component="button"
type="button"
+ disabled={disabled}
onClick={onClick}
- sx={{
- width: "100%",
- p: 0,
- m: 0,
- border: 0,
- background: "transparent",
- textAlign: "inherit",
- cursor: "pointer",
- borderRadius: "20px",
- }}
- >
- <Stack
- direction="row"
- sx={(theme) => ({
+ sx={[
+ rowSurfaceSx,
+ {
+ width: "100%",
minHeight: 54,
- px: 1.5,
- gap: 1.5,
+ p: "9px 12px",
+ m: 0,
+ border: 0,
+ display: "flex",
alignItems: "center",
+ gap: 1.5,
+ textAlign: "left",
+ cursor: "pointer",
+ "&:disabled": { cursor: "default", opacity: 0.5 },
borderRadius: "20px",
- backgroundColor: "#ffffff",
- color: color ?? "text.base",
- transition: theme.transitions.create(
- ["background-color", "border-color", "color"],
- { duration: theme.transitions.duration.shorter },
- ),
- border: "1px solid transparent",
- ...(selected && {
- backgroundColor: "rgba(16, 113, 255, 0.12)",
- boxShadow: `inset 0 0 0 1px ${theme.vars.palette.accent.main}`,
- color: "accent.main",
- }),
- "&:hover": {
- backgroundColor: selected
- ? "rgba(16, 113, 255, 0.16)"
- : "#eaeaea",
+ "&:focus-visible": {
+ outline: "2px solid",
+ outlineColor: "accent.main",
+ outlineOffset: 2,
},
- "&:active": {
- backgroundColor: selected
- ? "rgba(16, 113, 255, 0.18)"
- : "#dedede",
- },
- ...theme.applyStyles("dark", {
- backgroundColor: "#212121",
- ...(selected && {
- backgroundColor: "rgba(16, 113, 255, 0.12)",
- }),
- "&:hover": {
- backgroundColor: selected
- ? "rgba(16, 113, 255, 0.16)"
- : "#1b1b1b",
- },
- "&:active": {
- backgroundColor: selected
- ? "rgba(16, 113, 255, 0.18)"
- : "#141414",
- },
- }),
- })}
- >
- {iconNode || icon ? (
- <Box
- sx={{
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- color: "inherit",
+ },
+ ...(half ? [{ flex: 1, minWidth: 0 }] : []),
+ ...(selected ? [selectedRowSx] : []),
+ ]}
+ >
+ {(iconNode || icon) && (
+ <Box
+ sx={[
+ textLightSx,
+ {
width: 36,
height: 36,
flexShrink: 0,
- }}
- >
- {iconNode ?? (
- <HugeiconsIcon
- icon={icon!}
- size={18}
- color="currentColor"
- strokeWidth={1.6}
- />
- )}
- </Box>
- ) : null}
- <Box sx={{ flex: 1, minWidth: 0 }}>
- {typeof label === "string" ? (
- <Typography
- variant="small"
- sx={{
- color: "inherit",
- fontSize: 14,
- lineHeight: "20px",
- fontWeight: selected ? 600 : 500,
- }}
- >
- {label}
- </Typography>
- ) : (
- label
+ display: "grid",
+ placeItems: "center",
+ },
+ ...(color === "warning" ? [warningSx] : []),
+ ...(selected ? [{ "&&": { color: "accent.main" } }] : []),
+ ]}
+ >
+ {iconNode ?? (
+ <HugeiconsIcon
+ icon={icon!}
+ size={18}
+ strokeWidth={1.6}
+ color="currentColor"
+ />
)}
</Box>
- {caption && (
- <Box
- sx={{
- width: 36,
- height: 36,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- flexShrink: 0,
- }}
+ )}
+ <Box sx={{ flex: 1, minWidth: 0 }}>
+ <Typography
+ component="div"
+ noWrap
+ sx={[
+ bodySx,
+ textBaseSx,
+ ...(color === "warning" ? [warningSx] : []),
+ ...(selected
+ ? [{ "&&": { color: "accent.main" }, fontWeight: 600 }]
+ : []),
+ ]}
+ >
+ {label}
+ </Typography>
+ {subtitle && (
+ <Typography
+ sx={[
+ miniSx,
+ textLightSx,
+ {
+ mt: 0.5,
+ display: "-webkit-box",
+ WebkitLineClamp: 2,
+ WebkitBoxOrient: "vertical",
+ overflow: "hidden",
+ },
+ ]}
>
- <Typography
- variant="mini"
- sx={{
- color: selected ? "accent.main" : "text.muted",
- fontSize: 14,
- lineHeight: "20px",
- }}
- >
- {caption}
- </Typography>
- </Box>
+ {subtitle}
+ </Typography>
)}
- {endIcon && (
- <Box
- sx={{
+ </Box>
+ {!half && endIcon && (
+ <Box
+ sx={[
+ textLightSx,
+ {
width: 36,
height: 36,
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- color: selected ? "accent.main" : "text.muted",
flexShrink: 0,
- }}
- >
- {endIcon}
- </Box>
- )}
- </Stack>
+ display: "grid",
+ placeItems: "center",
+ "& svg": { fontSize: 24 },
+ },
+ ...(selected ? [{ "&&": { color: "accent.main" } }] : []),
+ ]}
+ >
+ {endIcon}
+ </Box>
+ )}
+ </Box>
+);
+
+export const LockerSidebarSectionTitle: React.FC<React.PropsWithChildren> = ({
+ children,
+}) => (
+ <Typography sx={[largeSx, textBaseSx, { p: "6px 0 6px 8px" }]}>
+ {children}
+ </Typography>
+);
+
+export const LockerSidebarLink: React.FC<
+ React.PropsWithChildren<{ onClick: () => void }>
+> = ({ children, onClick }) => (
+ <Box
+ component="button"
+ type="button"
+ onClick={onClick}
+ sx={{
+ ...bodyBoldSx,
+ color: "accent.main",
+ p: "12px 8px",
+ alignSelf: "flex-start",
+ display: "flex",
+ alignItems: "center",
+ gap: 1,
+ border: 0,
+ background: "transparent",
+ cursor: "pointer",
+ "&:focus-visible": { outline: "2px solid", outlineOffset: 2 },
+ }}
+ >
+ {children}
+ <ChevronRightIcon sx={{ fontSize: 16 }} />
</Box>
);
diff --git a/web/apps/locker/src/components/LockerSidebarShell.tsx b/web/apps/locker/src/components/LockerSidebarShell.tsx
index 778410c618..488a1fc1ae 100644
--- a/web/apps/locker/src/components/LockerSidebarShell.tsx
+++ b/web/apps/locker/src/components/LockerSidebarShell.tsx
@@ -1,17 +1,20 @@
import ArrowBackOutlinedIcon from "@mui/icons-material/ArrowBackOutlined";
-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 { t } from "i18next";
import React from "react";
+import {
+ display2Sx,
+ sidebarBackgroundSx,
+ textBaseSx,
+} from "./locker-sidebar-styles";
export const LockerSidebarDrawer: React.FC<DrawerProps> = ({
slotProps,
@@ -24,44 +27,35 @@ export const LockerSidebarDrawer: React.FC<DrawerProps> = ({
return (
<Drawer
{...rest}
+ closeAfterTransition={false}
slotProps={{
+ backdrop: {
+ sx: (theme) => ({
+ [theme.breakpoints.down("sm")]: {
+ "&&&": { backgroundColor: "transparent" },
+ },
+ }),
+ },
...(slotProps ?? {}),
paper: {
...(paperSlotProps ?? {}),
sx: [
{
- maxWidth: "375px",
- width: "100%",
+ width: { xs: "100%", sm: 375 },
scrollbarWidth: "thin",
- backgroundColor: "#f4f4f4",
"&&": { padding: 0 },
},
- (theme) =>
- theme.applyStyles("dark", {
- backgroundColor: "#161616",
- }),
+ sidebarBackgroundSx,
paperSlotProps?.sx as never,
],
},
}}
>
- {isDesktop && <LockerTitlebarBackdrop />}
- <Box sx={{ p: 1 }}>{children}</Box>
+ {children}
</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;
};
@@ -90,53 +84,60 @@ export const LockerNestedSidebarDrawer: React.FC<
);
};
-type LockerSidebarTitlebarProps = Pick<
- LockerNestedSidebarDrawerVisibilityProps,
- "onClose" | "onRootClose"
-> & {
+interface LockerSidebarTitlebarProps {
+ onClose: () => void;
title: string;
- caption?: string;
actionButton?: React.ReactNode;
- hideRootCloseButton?: boolean;
-};
+ closeLabel?: string;
+ tooltip?: string;
+}
-const LockerSidebarTitlebar: React.FC<LockerSidebarTitlebarProps> = ({
+export const LockerSidebarTitlebar: React.FC<LockerSidebarTitlebarProps> = ({
title,
- caption,
onClose,
- onRootClose,
actionButton,
- hideRootCloseButton,
+ closeLabel,
+ tooltip,
}) => (
- <Stack sx={{ gap: "4px" }}>
- <Stack direction="row" sx={{ justifyContent: "space-between" }}>
- <IconButton onClick={onClose} color="primary">
- <ArrowBackOutlinedIcon />
- </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>
+ <Box sx={{ position: "relative", height: 92, flexShrink: 0 }}>
+ <IconButton
+ aria-label={closeLabel ?? t("go_back")}
+ onClick={onClose}
+ sx={[
+ textBaseSx,
+ {
+ position: "absolute",
+ left: 8,
+ top: 8,
+ p: 1,
+ borderRadius: "12px",
+ },
+ ]}
+ >
+ <ArrowBackOutlinedIcon sx={{ fontSize: 24 }} />
+ </IconButton>
+ <Typography
+ noWrap
+ title={tooltip}
+ sx={[
+ display2Sx,
+ textBaseSx,
+ {
+ position: "absolute",
+ left: 16,
+ right: actionButton ? 70 : 16,
+ top: 48,
+ },
+ ]}
+ >
+ {title}
+ </Typography>
+ {actionButton && (
+ <Box sx={{ position: "absolute", right: 16, top: 45 }}>
+ {actionButton}
+ </Box>
+ )}
+ </Box>
);
type LockerTitledNestedSidebarDrawerProps = React.PropsWithChildren<
@@ -151,9 +152,7 @@ export const LockerTitledNestedSidebarDrawer: React.FC<
<LockerNestedSidebarDrawer
{...{ open, onClose, onRootClose, anchor, slotProps }}
>
- <Stack sx={{ gap: "4px", py: "12px" }}>
- <LockerSidebarTitlebar {...{ onClose, onRootClose }} {...rest} />
- {children}
- </Stack>
+ <LockerSidebarTitlebar onClose={onClose} {...rest} />
+ <Stack sx={{ flex: 1, p: "0 16px 16px", gap: 1 }}>{children}</Stack>
</LockerNestedSidebarDrawer>
);
diff --git a/web/apps/locker/src/components/LockerSocialFooter.tsx b/web/apps/locker/src/components/LockerSocialFooter.tsx
index 04e5b88e9e..d194de239e 100644
--- a/web/apps/locker/src/components/LockerSocialFooter.tsx
+++ b/web/apps/locker/src/components/LockerSocialFooter.tsx
@@ -8,6 +8,7 @@ import log from "ente-base/log";
import { getRemoteFlag } from "ente-new/photos/services/remote-store";
import { t } from "i18next";
import React from "react";
+import { iconColorSx, miniSx, textLightSx } from "./locker-sidebar-styles";
const openExternal = (url: string) => window.open(url, "_blank", "noopener");
@@ -16,38 +17,20 @@ const socialLinks = [
icon: DiscordBrandIcon,
label: "Discord",
url: "https://ente.com/discord",
- buttonSize: 48,
},
{
icon: YouTubeIcon,
label: "YouTube",
url: "https://www.youtube.com/@entestudio",
- buttonSize: 36,
- },
- {
- icon: GitHubIcon,
- label: "GitHub",
- url: "https://github.com/ente",
- buttonSize: 36,
- },
- {
- icon: XIcon,
- label: "X",
- url: "https://twitter.com/enteio",
- buttonSize: 36,
},
+ { icon: GitHubIcon, label: "GitHub", url: "https://github.com/ente" },
+ { icon: XIcon, label: "X", url: "https://twitter.com/enteio" },
{
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 = () => {
@@ -70,7 +53,7 @@ export const LockerSocialFooter: React.FC = () => {
const build = isInternalUser ? buildLabel() : undefined;
return (
- <Stack sx={{ alignItems: "center", gap: 1, px: 1, pb: 1 }}>
+ <Stack sx={{ alignItems: "center" }}>
<Stack
direction="row"
sx={{
@@ -80,34 +63,35 @@ export const LockerSocialFooter: React.FC = () => {
alignItems: "center",
}}
>
- {socialLinks.map(({ icon: Icon, label, url, buttonSize }) => (
+ {socialLinks.map(({ icon: Icon, label, url }) => (
<IconButton
key={label}
color="secondary"
aria-label={label}
onClick={() => openExternal(url)}
- sx={{
- width: buttonSize,
- height: buttonSize,
- color: "text.muted",
- display: "flex",
- alignItems: "center",
- justifyContent: "center",
- p: 0,
- }}
+ sx={[
+ iconColorSx,
+ {
+ width: 36,
+ height: 36,
+ borderRadius: "12px",
+ p: 0,
+ "& svg": { width: 18, height: 18 },
+ },
+ ]}
>
- {label === "YouTube" ? (
- <Icon sx={{ fontSize: 24 }} />
- ) : label === "Reddit" ? (
- <Icon sx={{ fontSize: 22 }} />
- ) : (
- <Icon fontSize="small" />
- )}
+ <Icon />
</IconButton>
))}
</Stack>
{build && (
- <Typography variant="mini" sx={{ color: "text.muted" }}>
+ <Typography
+ sx={[
+ miniSx,
+ textLightSx,
+ { textAlign: "center", py: "20px" },
+ ]}
+ >
{build}
</Typography>
)}
@@ -115,12 +99,11 @@ export const LockerSocialFooter: React.FC = () => {
);
};
-function DiscordBrandIcon(props: { fontSize?: "small" | "medium" }) {
- const size = props.fontSize === "small" ? 20 : 20;
+function DiscordBrandIcon() {
return (
<svg
- width={size}
- height={size}
+ width={18}
+ height={18}
viewBox="0 0 24 24"
fill="currentColor"
aria-hidden="true"
@@ -130,12 +113,11 @@ function DiscordBrandIcon(props: { fontSize?: "small" | "medium" }) {
);
}
-function MastodonBrandIcon(props: { fontSize?: "small" | "medium" }) {
- const size = props.fontSize === "small" ? 20 : 20;
+function MastodonBrandIcon() {
return (
<svg
- width={size}
- height={size}
+ width={18}
+ height={18}
viewBox="0 0 24 24"
fill="currentColor"
aria-hidden="true"
diff --git a/web/apps/locker/src/components/LockerSupportDrawer.tsx b/web/apps/locker/src/components/LockerSupportDrawer.tsx
index b6754f11dc..3e91efe19a 100644
--- a/web/apps/locker/src/components/LockerSupportDrawer.tsx
+++ b/web/apps/locker/src/components/LockerSupportDrawer.tsx
@@ -1,11 +1,16 @@
import {
+ Bug01Icon,
+ FavouriteIcon,
+ File01Icon,
HelpCircleIcon,
- InformationCircleIcon,
- MessageQuestionIcon,
- NewsIcon,
+ Idea01Icon,
+ Rocket01Icon,
+ SecurityCheckIcon,
+ Wallet05Icon,
+ Wrench01Icon,
} from "@hugeicons/core-free-icons";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
-import { Stack, Tooltip, Typography } from "@mui/material";
+import { Box } from "@mui/material";
import { useBaseContext } from "ente-base/context";
import log from "ente-base/log";
import { savedLogs } from "ente-base/log-web";
@@ -14,12 +19,25 @@ 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 {
+ LockerSidebarCardButton,
+ LockerSidebarLink,
+ LockerSidebarSectionTitle,
+} from "./LockerSidebarCardButton";
import {
LockerTitledNestedSidebarDrawer,
type LockerNestedSidebarDrawerVisibilityProps,
} from "./LockerSidebarShell";
+const helpTopics = [
+ { icon: Rocket01Icon, key: "getting_started", slug: "getting-started" },
+ { icon: File01Icon, key: "information_types", slug: "information-types" },
+ { icon: Wallet05Icon, key: "organization", slug: "organization" },
+ { icon: FavouriteIcon, key: "legacy", slug: "legacy" },
+ { icon: SecurityCheckIcon, key: "security", slug: "security" },
+ { icon: Wrench01Icon, key: "troubleshooting", slug: "troubleshooting" },
+] as const;
+
export const LockerSupportDrawer: React.FC<
LockerNestedSidebarDrawerVisibilityProps
> = ({ open, onClose, onRootClose }) => {
@@ -29,10 +47,10 @@ export const LockerSupportDrawer: React.FC<
onRootClose();
};
- const handleHelp = () => openURL("https://ente.com/help/photos/");
- const handleBlog = () => openURL("https://ente.com/blog/");
const handleRequestFeature = () =>
openURL("https://github.com/ente/ente/discussions");
+ const handleReportIssue = () =>
+ openURL("https://github.com/ente/ente/issues");
const handleSupport = () => initiateEmail("[email protected]");
const viewLogs = async () => {
@@ -57,49 +75,53 @@ export const LockerSupportDrawer: React.FC<
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("help_and_support")}
- hideRootCloseButton
>
- <Stack sx={{ px: 2, py: 1, gap: 1 }}>
- <LockerSidebarCardButton
- icon={InformationCircleIcon}
- label={t("help")}
- endIcon={<ChevronRightIcon />}
- onClick={handleHelp}
- />
- <LockerSidebarCardButton
- icon={NewsIcon}
- label={t("blog")}
- endIcon={<ChevronRightIcon />}
- onClick={handleBlog}
- />
+ <LockerSidebarSectionTitle>
+ {t("get_in_touch")}
+ </LockerSidebarSectionTitle>
+ <LockerSidebarCardButton
+ icon={HelpCircleIcon}
+ label={t("ask_a_question")}
+ endIcon={<ChevronRightIcon />}
+ onClick={handleSupport}
+ />
+ <LockerSidebarCardButton
+ icon={Idea01Icon}
+ label={t("request_a_feature")}
+ endIcon={<ChevronRightIcon />}
+ onClick={handleRequestFeature}
+ />
+ <LockerSidebarCardButton
+ icon={Bug01Icon}
+ label={t("report_an_issue")}
+ endIcon={<ChevronRightIcon />}
+ onClick={handleReportIssue}
+ />
+ <LockerSidebarLink onClick={confirmViewLogs}>
+ {t("export_logs")}
+ </LockerSidebarLink>
+ <Box sx={{ mt: 2 }}>
+ <LockerSidebarSectionTitle>
+ {t("browse_help_pages")}
+ </LockerSidebarSectionTitle>
+ </Box>
+ {helpTopics.map(({ icon, key, slug }) => (
<LockerSidebarCardButton
- icon={MessageQuestionIcon}
- label={t("request_feature")}
+ key={key}
+ icon={icon}
+ label={t(key)}
+ subtitle={t(`${key}_desc`)}
endIcon={<ChevronRightIcon />}
- onClick={handleRequestFeature}
- />
- <LockerSidebarCardButton
- icon={HelpCircleIcon}
- label={
- <Tooltip title="[email protected]">
- <Typography
- variant="small"
- sx={{ fontWeight: 500 }}
- >
- {t("support")}
- </Typography>
- </Tooltip>
+ onClick={() =>
+ openURL(`https://ente.com/help/locker/faq/${slug}`)
}
- endIcon={<ChevronRightIcon />}
- onClick={handleSupport}
- />
- <LockerSidebarCardButton
- icon={InformationCircleIcon}
- label={t("view_logs")}
- endIcon={<ChevronRightIcon />}
- onClick={confirmViewLogs}
/>
- </Stack>
+ ))}
+ <LockerSidebarLink
+ onClick={() => openURL("https://ente.com/help/locker")}
+ >
+ {t("view_all_help_topics")}
+ </LockerSidebarLink>
</LockerTitledNestedSidebarDrawer>
);
};
diff --git a/web/apps/locker/src/components/LockerTwoFactorDrawer.tsx b/web/apps/locker/src/components/LockerTwoFactorDrawer.tsx
index 1e5371c6d1..4cd929a499 100644
--- a/web/apps/locker/src/components/LockerTwoFactorDrawer.tsx
+++ b/web/apps/locker/src/components/LockerTwoFactorDrawer.tsx
@@ -44,7 +44,6 @@ export const LockerTwoFactorDrawer: React.FC<
{...{ open, onClose }}
onRootClose={handleRootClose}
title={t("two_factor_authentication")}
- hideRootCloseButton
>
<TwoFactorContents
open={open}
diff --git a/web/apps/locker/src/components/locker-sidebar-styles.ts b/web/apps/locker/src/components/locker-sidebar-styles.ts
new file mode 100644
index 0000000000..84d1ed7640
--- /dev/null
+++ b/web/apps/locker/src/components/locker-sidebar-styles.ts
@@ -0,0 +1,82 @@
+import type { SxProps, Theme } from "@mui/material";
+
+export const sidebarBackgroundSx = (theme: Theme) => ({
+ backgroundColor: "#f4f4f4",
+ ...theme.applyStyles("dark", { backgroundColor: "#161616" }),
+});
+export const fillLightSx = (theme: Theme) => ({
+ backgroundColor: "#ffffff",
+ ...theme.applyStyles("dark", { backgroundColor: "#212121" }),
+});
+export const fillDarkSx = (theme: Theme) => ({
+ backgroundColor: "#eaeaea",
+ ...theme.applyStyles("dark", { backgroundColor: "#0a0a0a" }),
+});
+export const rowSurfaceSx = (theme: Theme) => ({
+ backgroundColor: "#ffffff",
+ "&:hover": { backgroundColor: "#eaeaea" },
+ "&:active": { backgroundColor: "#dedede" },
+ ...theme.applyStyles("dark", {
+ backgroundColor: "#212121",
+ "&:hover": { backgroundColor: "#0a0a0a" },
+ "&:active": { backgroundColor: "#141414" },
+ }),
+});
+export const textBaseSx = (theme: Theme) => ({
+ color: "#000000",
+ ...theme.applyStyles("dark", { color: "#ffffff" }),
+});
+export const textLightSx = (theme: Theme) => ({
+ color: "#666666",
+ ...theme.applyStyles("dark", { color: "#999999" }),
+});
+export const iconColorSx = (theme: Theme) => ({
+ color: "rgba(0,0,0,.75)",
+ ...theme.applyStyles("dark", { color: "#ffffff" }),
+});
+export const titlebarActionButtonSx: SxProps<Theme> = [
+ rowSurfaceSx,
+ iconColorSx,
+ { width: 36, height: 36, borderRadius: "12px", p: 0 },
+];
+
+export const warningSx = { "&&": { color: "#f63a3a" } };
+export const selectedRowSx = (theme: Theme) => ({
+ "&&": {
+ backgroundColor: "rgba(16,113,255,.12)",
+ boxShadow: `inset 0 0 0 1px ${theme.vars.palette.accent.main}`,
+ },
+ "&&:hover": { backgroundColor: "rgba(16,113,255,.16)" },
+ "&&:active": { backgroundColor: "rgba(16,113,255,.18)" },
+});
+export const display2Sx = {
+ fontFamily: "'Outfit Variable', Inter, system-ui, sans-serif",
+ fontSize: 24,
+ lineHeight: "32px",
+ fontWeight: 600,
+};
+export const h1Sx = { fontSize: 20, lineHeight: "28px", fontWeight: 700 };
+export const largeSx = { fontSize: 16, lineHeight: "20px", fontWeight: 600 };
+export const bodySx = { fontSize: 14, lineHeight: "20px", fontWeight: 500 };
+export const bodyBoldSx = { ...bodySx, fontWeight: 600 };
+export const miniSx = { fontSize: 12, lineHeight: "16px", fontWeight: 500 };
+export const usageCardSx = {
+ borderRadius: "20px",
+ p: 2,
+ color: "#ffffff",
+ background:
+ "radial-gradient(circle at 12px 12px, rgba(255,255,255,.03) 0 2px, transparent 2px) 0 0/24px 24px, linear-gradient(0deg,#151515 0%,#2B2B2B 100%)",
+};
+export const usageMutedSx = { color: "rgba(255,255,255,.7)" };
+const whiteOverlay = "rgba(255,255,255,.14)";
+export const familyColor = "rgba(255,255,255,.92)";
+
+export const usageBarSx = {
+ position: "relative",
+ height: 8,
+ mt: 2,
+ borderRadius: "4px",
+ bgcolor: whiteOverlay,
+ overflow: "hidden",
+ "& > div": { position: "absolute", inset: 0, borderRadius: "4px" },
+};
diff --git a/web/apps/locker/src/locales/en-US/translation.json b/web/apps/locker/src/locales/en-US/translation.json
index 2416b85fa4..a0bda5510c 100644
--- a/web/apps/locker/src/locales/en-US/translation.json
+++ b/web/apps/locker/src/locales/en-US/translation.json
@@ -1,4 +1,5 @@
{
+ "refresh": "Refresh",
"saveToLocker": "Save to Locker",
"informationDescription": "Save and share information with loved ones.",
"saveDocumentTitle": "Document",
@@ -226,5 +227,24 @@
"selectAll": "Select all",
"deselectAll": "Deselect all",
"filesSelected": "{{count, number}} items selected",
- "filesSelected_one": "1 item selected"
+ "filesSelected_one": "1 item selected",
+ "legacy": "Legacy",
+ "get_in_touch": "Get in touch",
+ "ask_a_question": "Ask a question",
+ "request_a_feature": "Request a feature",
+ "report_an_issue": "Report an issue",
+ "export_logs": "Export logs",
+ "browse_help_pages": "Browse help pages",
+ "getting_started": "Getting started",
+ "getting_started_desc": "Install Locker, create an account, and save your first item",
+ "information_types": "Information types",
+ "information_types_desc": "Documents, notes, cards, passwords, and other item types",
+ "organization": "Organization",
+ "organization_desc": "Collections, favorites, search, and ways to keep items organized",
+ "legacy_desc": "Trusted contacts, Legacy kit, and account recovery planning",
+ "security_desc": "Encryption, recovery keys, app lock, and account protection",
+ "troubleshooting": "Troubleshooting",
+ "troubleshooting_desc": "Common issues and their solutions",
+ "view_all_help_topics": "View all help topics",
+ "legacy_intro": "Legacy allows trusted contacts to access your account in your absence."
}
diff --git a/web/apps/locker/src/pages/locker.tsx b/web/apps/locker/src/pages/locker.tsx
index c5b1cb670a..8cf2c4b202 100644
--- a/web/apps/locker/src/pages/locker.tsx
+++ b/web/apps/locker/src/pages/locker.tsx
@@ -36,7 +36,6 @@ export const LockerPage: React.FC = () => {
handleSelectTrash,
isCollectionRoutePending,
isCollectionsView,
- isHomeView,
isTrashView,
navigateHome,
selectedCollectionID,
@@ -213,11 +212,8 @@ export const LockerPage: React.FC = () => {
open={sidebarOpen}
onClose={closeSidebar}
collections={collections}
- trashItemCount={trashItems.length}
- onSelectHome={() => handleSelectCollection(null)}
onSelectCollections={handleSelectCollections}
onSelectTrash={handleSelectTrash}
- isHomeView={isHomeView}
isTrashView={isTrashView}
isCollectionsView={isCollectionsView}
userDetails={userDetails}
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index c013618489..d37f9bf4f4 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -1112,5 +1112,10 @@
"auto_lock_5_minutes": "5 minutes",
"auto_lock_30_minutes": "30 minutes",
"wrong_unlock_code_one": "You've entered the wrong unlock code {{count}} time.",
- "wrong_unlock_code_other": "You've entered the wrong unlock code {{count}} times."
+ "wrong_unlock_code_other": "You've entered the wrong unlock code {{count}} times.",
+ "trusted_contacts": "Trusted contacts",
+ "legacy_accounts": "Legacy accounts",
+ "add_trusted_contact": "Add trusted contact",
+ "trusted_contacts_empty": "Nominate another Ente user as a trusted contact to recover your account",
+ "legacy_accounts_empty": "Trusted contacts can initiate account recovery, and if not blocked within 30 days, reset your password and access your account."
}
diff --git a/web/packages/contacts/legacy/components/LegacyDrawerContent.tsx b/web/packages/contacts/legacy/components/LegacyDrawerContent.tsx
index 36fbb3498b..fe35e75ef9 100644
--- a/web/packages/contacts/legacy/components/LegacyDrawerContent.tsx
+++ b/web/packages/contacts/legacy/components/LegacyDrawerContent.tsx
@@ -1,4 +1,5 @@
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
+import PersonAddAltOutlinedIcon from "@mui/icons-material/PersonAddAltOutlined";
import WarningAmberRoundedIcon from "@mui/icons-material/WarningAmberRounded";
import { Box, CircularProgress, Stack, Typography } from "@mui/material";
import { useBaseContext } from "ente-base/context";
@@ -13,6 +14,7 @@ import {
updateRecoveryNotice,
type Session,
} from "ente-legacy-wasm/authenticated";
+import { t } from "i18next";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import {
legacyChangePassword,
@@ -115,6 +117,16 @@ const recoveryAttemptMessage = (session: LegacyRecoverySession) => {
return `${email} is trying to recover your account. ${formatWait(session)}.`;
};
+const chevronAction = <ChevronRightIcon sx={{ color: "text.muted" }} />;
+
+const emptyCardSx = {
+ borderRadius: "20px",
+ bgcolor: "fill.faint",
+ p: "24px 20px",
+ textAlign: "left",
+ color: "text.muted",
+};
+
const attentionIndicator = (
<WarningAmberRoundedIcon
sx={{ fontSize: 18, color: "warning.main", flexShrink: 0 }}
@@ -122,14 +134,16 @@ const attentionIndicator = (
);
const sectionTitleSx = {
- color: "text.muted",
- fontSize: 18,
- lineHeight: "24px",
- fontWeight: 500,
+ color: "text.base",
+ fontSize: 16,
+ lineHeight: "20px",
+ fontWeight: 600,
+ p: "6px 0 6px 8px",
};
+// ponytail: retain the existing sheets here instead of splitting the stateful component.
const groupedCardSx = {
- p: 0.5,
+ gap: 1,
borderRadius: "20px",
backgroundColor: "fill.faint",
};
@@ -137,11 +151,17 @@ const groupedCardSx = {
const warningBannerSx = {
p: 2,
gap: 1.5,
- borderRadius: "18px",
+ borderRadius: "20px",
backgroundColor: "rgba(255, 82, 82, 0.14)",
};
interface LegacyDrawerContentProps {
+ intro?: React.ReactNode;
+ renderAddContactButton?: (props: {
+ onClick: () => void;
+ disabled: boolean;
+ loading: boolean;
+ }) => React.ReactNode;
open: boolean;
getSession: () => Promise<Session>;
suggestedUsers?: LegacySuggestedUser[];
@@ -156,9 +176,11 @@ interface ConfirmActionDialogInput {
}
export const LegacyDrawerContent: React.FC<LegacyDrawerContentProps> = ({
+ intro,
open,
getSession,
suggestedUsers = [],
+ renderAddContactButton,
}) => {
const { showMiniDialog, onGenericError } = useBaseContext();
const [info, setInfo] = useState<LegacyInfo | undefined>();
@@ -266,12 +288,6 @@ export const LegacyDrawerContent: React.FC<LegacyDrawerContentProps> = ({
);
}, [activeRecoveriesByPair, selectedTrustedContact]);
- const hasOverviewEntries = Boolean(
- info?.recoverSessions.length ||
- info?.contacts.length ||
- info?.othersEmergencyContact.length,
- );
-
const refreshAfterMutation = useCallback(async () => {
await loadInfo(false);
}, [loadInfo]);
@@ -464,7 +480,12 @@ export const LegacyDrawerContent: React.FC<LegacyDrawerContentProps> = ({
}}
/>
) : (
- <Stack sx={{ px: 2, pt: 2, pb: 2, gap: 2.5 }}>
+ <Stack>
+ {intro && (
+ <Typography variant="body" sx={{ color: "text.muted" }}>
+ {intro}
+ </Typography>
+ )}
{isLoading && !info ? (
<Stack
sx={{
@@ -483,7 +504,7 @@ export const LegacyDrawerContent: React.FC<LegacyDrawerContentProps> = ({
) : (
<>
{!!info?.recoverSessions.length && (
- <Stack sx={{ gap: 2 }}>
+ <Stack sx={{ gap: 2, mt: 3 }}>
<Stack direction="row" sx={warningBannerSx}>
<WarningAmberRoundedIcon
sx={{
@@ -506,228 +527,223 @@ export const LegacyDrawerContent: React.FC<LegacyDrawerContentProps> = ({
</Typography>
</Stack>
<Stack sx={groupedCardSx}>
- {info.recoverSessions.map(
- (session, index) => (
- <Box
- key={session.id}
- sx={{
- pt:
- index === 0
- ? 0
- : 0.75,
- borderTop:
- index === 0
- ? undefined
- : "1px solid",
- borderColor: "divider",
- }}
- >
- <LegacyIdentityRow
- email={
- session
- .emergencyContact
- .email
- }
- userID={
- session
- .emergencyContact
- .id
- }
- primaryColor="warning.main"
- action={
- <ChevronRightIcon
- sx={{
- color: "text.muted",
- }}
- />
- }
- onClick={() =>
- setActiveSheet({
- kind: "recovery",
- session,
- })
- }
- />
- </Box>
- ),
- )}
+ {info.recoverSessions.map((session) => (
+ <LegacyIdentityRow
+ action={chevronAction}
+ key={session.id}
+ email={
+ session.emergencyContact
+ .email
+ }
+ userID={
+ session.emergencyContact.id
+ }
+ primaryColor="warning.main"
+ onClick={() =>
+ setActiveSheet({
+ kind: "recovery",
+ session,
+ })
+ }
+ />
+ ))}
</Stack>
</Stack>
)}
- {!!info?.contacts.length && (
- <Stack sx={{ gap: 1 }}>
- <Typography sx={sectionTitleSx}>
- Trusted contacts
- </Typography>
+ <Stack sx={{ mt: 3, gap: 1 }}>
+ <Typography sx={sectionTitleSx}>
+ {t("trusted_contacts")}
+ </Typography>
+ {info?.contacts.length ? (
<Stack sx={groupedCardSx}>
- {info.contacts.map((contact, index) => (
- <Box
+ {info.contacts.map((contact) => (
+ <LegacyIdentityRow
+ action={chevronAction}
key={pairKey(
contact.user.id,
contact.emergencyContact.id,
)}
- sx={{
- pt: index === 0 ? 0 : 0.75,
- borderTop:
- index === 0
- ? undefined
- : "1px solid",
- borderColor: "divider",
- }}
- >
- <LegacyIdentityRow
- email={
- contact.emergencyContact
- .email
- }
- userID={
- contact.emergencyContact
- .id
- }
- statusIndicator={
- contact.state ===
- "ACCEPTED"
- ? undefined
- : attentionIndicator
- }
- action={
- <ChevronRightIcon
- sx={{
- color: "text.muted",
- }}
- />
- }
- onClick={() =>
- setActiveSheet({
- kind: "owner",
- contact,
- })
- }
- />
- </Box>
+ email={
+ contact.emergencyContact
+ .email
+ }
+ userID={
+ contact.emergencyContact.id
+ }
+ statusIndicator={
+ contact.state === "ACCEPTED"
+ ? undefined
+ : attentionIndicator
+ }
+ onClick={() =>
+ setActiveSheet({
+ kind: "owner",
+ contact,
+ })
+ }
+ />
))}
</Stack>
- </Stack>
- )}
-
- <ActionButton
- fullWidth
- buttonType="primary"
- loading={isLoading}
- disabled={!info || isSubmitting}
- onClick={() => setActiveSheet({ kind: "add" })}
- >
- Add trusted contact
- </ActionButton>
-
- {!!info?.othersEmergencyContact.length && (
- <>
+ ) : (
+ !!info && (
+ <Typography
+ variant="mini"
+ sx={emptyCardSx}
+ >
+ {t("trusted_contacts_empty")}
+ </Typography>
+ )
+ )}
+ {renderAddContactButton ? (
+ renderAddContactButton({
+ onClick: () =>
+ setActiveSheet({ kind: "add" }),
+ disabled:
+ !info || isSubmitting || isLoading,
+ loading: isLoading,
+ })
+ ) : (
<Box
+ component="button"
+ type="button"
+ disabled={
+ !info || isSubmitting || isLoading
+ }
+ onClick={() =>
+ setActiveSheet({ kind: "add" })
+ }
sx={{
- mt: 0.5,
- borderTop: "1px solid",
- borderColor: "divider",
+ minHeight: 54,
+ width: "100%",
+ border: 0,
+ borderRadius: "20px",
+ bgcolor: "fill.faint",
+ "&:hover": {
+ bgcolor: "fill.faintHover",
+ },
+ p: "9px 12px",
+ display: "flex",
+ alignItems: "center",
+ gap: 1.5,
+ color: "accent.main",
+ textAlign: "left",
+ cursor: "pointer",
+ "&:disabled": {
+ cursor: "default",
+ color: "text.muted",
+ },
+ "&:focus-visible": {
+ outline: "2px solid",
+ outlineColor: "accent.main",
+ outlineOffset: 2,
+ },
}}
- />
- <Stack sx={{ gap: 1 }}>
- <Typography sx={sectionTitleSx}>
- Legacy accounts
- </Typography>
- <Stack sx={groupedCardSx}>
- {info.othersEmergencyContact.map(
- (contact, index) => {
- const activeRecovery =
- activeRecoveriesByPair.get(
- pairKey(
- contact.user.id,
- contact
- .emergencyContact
- .id,
- ),
- );
- return (
- <Box
- key={pairKey(
- contact.user.id,
- contact
- .emergencyContact
- .id,
- )}
- sx={{
- pt:
- index === 0
- ? 0
- : 0.75,
- borderTop:
- index === 0
- ? undefined
- : "1px solid",
- borderColor:
- "divider",
- }}
- >
- <LegacyIdentityRow
- email={
- contact.user
- .email
- }
- userID={
- contact.user
- .id
- }
- statusIndicator={
- contact.state !==
- "ACCEPTED" ||
- !!activeRecovery
- ? attentionIndicator
- : undefined
- }
- action={
- <ChevronRightIcon
- sx={{
- color: "text.muted",
- }}
- />
- }
- onClick={() =>
- contact.state ===
- "INVITED"
- ? setActiveSheet(
- {
- kind: "trustedInvite",
- contact,
- },
- )
- : setActivePage(
- {
- kind: "trusted",
- contact,
- },
- )
- }
- />
- </Box>
- );
- },
- )}
- </Stack>
- </Stack>
- </>
- )}
+ >
+ {isLoading ? (
+ <CircularProgress
+ size={20}
+ sx={{
+ color: "inherit",
+ mx: "auto",
+ }}
+ />
+ ) : (
+ <>
+ <Box
+ sx={{
+ width: 36,
+ height: 36,
+ flexShrink: 0,
+ display: "grid",
+ placeItems: "center",
+ }}
+ >
+ <PersonAddAltOutlinedIcon
+ sx={{ fontSize: 20 }}
+ />
+ </Box>
+ <Typography
+ variant="body"
+ sx={{ fontWeight: 500 }}
+ >
+ {t("add_trusted_contact")}
+ </Typography>
+ </>
+ )}
+ </Box>
+ )}
+ </Stack>
- {!hasOverviewEntries && !!info && (
- <Typography
- variant="small"
- sx={{
- color: "text.muted",
- textAlign: "center",
- py: 1,
- }}
- >
- No Legacy activity yet.
+ <Stack sx={{ mt: 3, gap: 1 }}>
+ <Typography sx={sectionTitleSx}>
+ {t("legacy_accounts")}
</Typography>
- )}
+ {info?.othersEmergencyContact.length ? (
+ <Stack sx={groupedCardSx}>
+ {info.othersEmergencyContact.map(
+ (contact) => {
+ const activeRecovery =
+ activeRecoveriesByPair.get(
+ pairKey(
+ contact.user.id,
+ contact
+ .emergencyContact
+ .id,
+ ),
+ );
+ return (
+ <LegacyIdentityRow
+ action={chevronAction}
+ key={pairKey(
+ contact.user.id,
+ contact
+ .emergencyContact
+ .id,
+ )}
+ email={
+ contact.user.email
+ }
+ userID={contact.user.id}
+ statusIndicator={
+ contact.state !==
+ "ACCEPTED" ||
+ !!activeRecovery
+ ? attentionIndicator
+ : undefined
+ }
+ onClick={() =>
+ contact.state ===
+ "INVITED"
+ ? setActiveSheet(
+ {
+ kind: "trustedInvite",
+ contact,
+ },
+ )
+ : setActivePage(
+ {
+ kind: "trusted",
+ contact,
+ },
+ )
+ }
+ />
+ );
+ },
+ )}
+ </Stack>
+ ) : (
+ !!info && (
+ <Typography
+ variant="mini"
+ sx={emptyCardSx}
+ >
+ {t("legacy_accounts_empty")}
+ </Typography>
+ )
+ )}
+ </Stack>
</>
)}
</Stack>
diff --git a/web/packages/contacts/legacy/components/LegacyIdentityRow.tsx b/web/packages/contacts/legacy/components/LegacyIdentityRow.tsx
index caeab672b8..55cf2755c8 100644
--- a/web/packages/contacts/legacy/components/LegacyIdentityRow.tsx
+++ b/web/packages/contacts/legacy/components/LegacyIdentityRow.tsx
@@ -56,9 +56,10 @@ export const LegacyIdentityRow: React.FC<LegacyIdentityRowProps> = ({
sx={[
{
alignItems: "center",
- gap: 1.25,
- px: 2,
- py: 1.5,
+ minHeight: 54,
+ gap: 1.5,
+ p: "9px 12px",
+ bgcolor: "fill.faint",
borderRadius: "20px",
transition: "background-color 160ms ease",
cursor: onClick ? "pointer" : "default",
@@ -88,7 +89,7 @@ export const LegacyIdentityRow: React.FC<LegacyIdentityRowProps> = ({
>
<Typography
variant="body"
- sx={{ fontWeight: 600, color: primaryColor }}
+ sx={{ fontWeight: 500, color: primaryColor }}
noWrap
>
{label}
@@ -97,7 +98,7 @@ export const LegacyIdentityRow: React.FC<LegacyIdentityRowProps> = ({
</Stack>
{subtext && (
<Typography
- variant="small"
+ variant="mini"
sx={{ color: "text.muted", mt: 0.25 }}
noWrap
>
@@ -116,9 +117,20 @@ export const LegacyIdentityRow: React.FC<LegacyIdentityRowProps> = ({
>
<CheckIcon fontSize="small" />
</IconButton>
- ) : (
- action
- )}
+ ) : action ? (
+ <Box
+ sx={{
+ width: 36,
+ height: 36,
+ flexShrink: 0,
+ display: "grid",
+ placeItems: "center",
+ color: "text.muted",
+ }}
+ >
+ {action}
+ </Box>
+ ) : undefined}
</Stack>
);
};