Skip to content

armgit / ente

Public Imported from GitHub
0

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

update-styles

Aswin Asok2a4a89f7d3f3
diff --git a/web/apps/locker/src/components/items/SelectionActionBar.tsx b/web/apps/locker/src/components/items/SelectionActionBar.tsx
index fdacc2b5c3..061fdedb8a 100644
--- a/web/apps/locker/src/components/items/SelectionActionBar.tsx
+++ b/web/apps/locker/src/components/items/SelectionActionBar.tsx
@@ -1,8 +1,12 @@
-import { lockerColorSx } from "@/styles/tokens";
-import CheckCircleRoundedIcon from "@mui/icons-material/CheckCircleRounded";
+import {
+ lockerColorSx,
+ lockerShadowFloating,
+ lockerTextBodyBoldSx,
+ lockerTextBodySx,
+} from "@/styles/tokens";
+import { Delete02Icon, Download01Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
import ClearRoundedIcon from "@mui/icons-material/ClearRounded";
-import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined";
-import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import { Box, Button, IconButton, Stack, Typography } from "@mui/material";
import { t } from "i18next";
import React from "react";
@@ -30,150 +34,121 @@ export const SelectionActionBar: React.FC<{
onDelete,
onDone,
}) => (
- <Box sx={{ px: { xs: 2, sm: 3 }, py: { xs: 1.25, sm: 1.5 } }}>
- <Box
+ <Box sx={{ px: { xs: 2, sm: 3 }, py: 1.5 }}>
+ <Stack
+ direction={{ xs: "column", sm: "row" }}
sx={(theme) => ({
maxWidth: 760,
mx: "auto",
- borderRadius: "20px",
- border: `1px solid ${theme.vars.palette.stroke.faint}`,
- backgroundColor: theme.vars.palette.background.paper,
- boxShadow: "0 12px 30px rgba(15, 23, 42, 0.12)",
- backdropFilter: "blur(18px)",
- px: { xs: 1.25, sm: 1.5 },
- py: 1.25,
+ p: 1.5,
+ gap: 1.5,
+ alignItems: { xs: "stretch", sm: "center" },
+ borderRadius: "24px",
+ boxShadow: lockerShadowFloating,
+ ...lockerColorSx(theme, {
+ backgroundColor: "fillLight",
+ color: "textBase",
+ }),
})}
>
<Stack
- direction={{ xs: "column", sm: "row" }}
+ direction="row"
+ sx={{ alignItems: "center", gap: 1, flex: 1, minWidth: 0 }}
+ >
+ <IconButton
+ aria-label={t("close")}
+ onClick={onDone}
+ disabled={bulkDownloading}
+ sx={(theme) => ({
+ width: 40,
+ height: 40,
+ flexShrink: 0,
+ ...lockerColorSx(theme, { color: "textLight" }),
+ })}
+ >
+ <ClearRoundedIcon sx={{ fontSize: 20 }} />
+ </IconButton>
+ <Typography
+ sx={{ ...lockerTextBodyBoldSx, flex: 1, minWidth: 0 }}
+ aria-live="polite"
+ >
+ {t("selected_count", { selected: selectedCount })}
+ </Typography>
+ <Button
+ variant="text"
+ onClick={onToggleSelectAll}
+ disabled={bulkDownloading}
+ sx={{
+ ...lockerTextBodySx,
+ minHeight: 40,
+ px: 1.5,
+ flexShrink: 0,
+ }}
+ >
+ {allSelected ? t("deselect_all") : t("select_all")}
+ </Button>
+ </Stack>
+ <Stack
+ direction="row"
sx={{
- alignItems: { xs: "stretch", sm: "center" },
- justifyContent: "space-between",
gap: 1,
+ "& > button": {
+ flex: { xs: 1, sm: "initial" },
+ minHeight: 44,
+ px: 2,
+ ...lockerTextBodyBoldSx,
+ },
}}
>
- <Stack
- direction="row"
- sx={{
- alignItems: "center",
- justifyContent: "space-between",
- gap: 1,
- }}
+ <Button
+ variant="contained"
+ startIcon={
+ <HugeiconsIcon
+ icon={Download01Icon}
+ size={18}
+ strokeWidth={1.6}
+ />
+ }
+ onClick={onDownload}
+ disabled={bulkDownloading || !canDownload}
>
- <Box
- sx={{
- display: "flex",
- alignItems: "center",
- gap: 1,
- minWidth: 0,
- px: 1.25,
- py: 0.875,
- borderRadius: "14px",
- backgroundColor: "rgba(16, 113, 255, 0.10)",
- border: "1px solid rgba(16, 113, 255, 0.16)",
- }}
- >
- <CheckCircleRoundedIcon
- sx={(theme) => ({
- fontSize: 18,
- ...lockerColorSx(theme, { color: "primary" }),
- flexShrink: 0,
- })}
+ {bulkDownloading && bulkDownloadProgress
+ ? `${t("downloading")} ${bulkDownloadProgress.completed}/${bulkDownloadProgress.total}`
+ : t("download")}
+ </Button>
+ <Button
+ variant="text"
+ color="critical"
+ startIcon={
+ <HugeiconsIcon
+ icon={Delete02Icon}
+ size={18}
+ strokeWidth={1.6}
/>
- <Typography
- variant="body"
- sx={{ fontWeight: 600, minWidth: 0 }}
- noWrap
- >
- {t("filesSelected", { count: selectedCount })}
- </Typography>
- </Box>
- <IconButton
- onClick={onDone}
- disabled={bulkDownloading}
- sx={(theme) => ({
- color: "text.muted",
- width: 38,
- height: 38,
- flexShrink: 0,
- border: `1px solid ${theme.vars.palette.stroke.faint}`,
- backgroundColor: theme.vars.palette.fill.faint,
- "&:hover": {
- backgroundColor:
- theme.vars.palette.fill.faintHover,
- },
- })}
- >
- <ClearRoundedIcon sx={{ fontSize: 18 }} />
- </IconButton>
- </Stack>
- <Stack
- direction={{ xs: "column", sm: "row" }}
- sx={{ alignItems: { xs: "stretch", sm: "center" }, gap: 1 }}
+ }
+ onClick={onDelete}
+ disabled={bulkDownloading || !canDelete}
+ sx={(theme) => ({
+ ...lockerColorSx(theme, {
+ backgroundColor: "warningLight",
+ color: "warning",
+ }),
+ "&:hover": lockerColorSx(theme, {
+ backgroundColor: "warningLight",
+ color: "warningDark",
+ }),
+ "&.Mui-disabled": {
+ ...lockerColorSx(theme, {
+ backgroundColor: "fillDark",
+ color: "textLighter",
+ }),
+ opacity: 0.5,
+ },
+ })}
>
- <Button
- color="secondary"
- onClick={onToggleSelectAll}
- disabled={bulkDownloading}
- sx={(theme) => ({
- minHeight: 42,
- px: 1.5,
- borderRadius: "14px",
- border: `1px solid ${theme.vars.palette.stroke.faint}`,
- backgroundColor: theme.vars.palette.fill.faint,
- "&:hover": {
- backgroundColor:
- theme.vars.palette.fill.faintHover,
- },
- })}
- >
- {allSelected ? t("deselectAll") : t("selectAll")}
- </Button>
- <Button
- variant="contained"
- startIcon={<FileDownloadOutlinedIcon />}
- onClick={onDownload}
- disabled={bulkDownloading || !canDownload}
- sx={{
- minHeight: 42,
- px: 1.75,
- borderRadius: "14px",
- boxShadow: "none",
- color: "#FFFFFF",
- background:
- "linear-gradient(180deg, #1674FF 0%, #0B5FE0 100%)",
- "& .MuiButton-startIcon": { color: "#FFFFFF" },
- "&:hover": {
- boxShadow: "none",
- background:
- "linear-gradient(180deg, #2A82FF 0%, #1269F0 100%)",
- },
- }}
- >
- {bulkDownloading && bulkDownloadProgress
- ? `${t("downloading")} ${bulkDownloadProgress.completed}/${bulkDownloadProgress.total}`
- : t("download")}
- </Button>
- <Button
- color="critical"
- startIcon={<DeleteOutlinedIcon />}
- onClick={onDelete}
- disabled={bulkDownloading || !canDelete}
- sx={{
- minHeight: 42,
- px: 1.75,
- borderRadius: "14px",
- color: "#FFFFFF",
- border: "1px solid rgba(185, 28, 28, 0.26)",
- backgroundColor: "#D14343",
- "& .MuiButton-startIcon": { color: "#FFFFFF" },
- "&:hover": { backgroundColor: "#B93838" },
- }}
- >
- {t("delete")}
- </Button>
- </Stack>
+ {t("delete")}
+ </Button>
</Stack>
- </Box>
+ </Stack>
</Box>
);
diff --git a/web/apps/locker/src/components/sidebar/LockerSidebar.tsx b/web/apps/locker/src/components/sidebar/LockerSidebar.tsx
index b8bfc97a2e..0c5ea8f088 100644
--- a/web/apps/locker/src/components/sidebar/LockerSidebar.tsx
+++ b/web/apps/locker/src/components/sidebar/LockerSidebar.tsx
@@ -6,6 +6,7 @@ import {
InformationCircleIcon,
Logout05Icon,
SecurityCheckIcon,
+ Sun03Icon,
UserIcon,
Wallet05Icon,
} from "@hugeicons/core-free-icons";
@@ -29,6 +30,7 @@ import {
} from "./LockerSidebarShell";
import { LockerSocialFooter } from "./LockerSocialFooter";
import { LockerSupportDrawer } from "./LockerSupportDrawer";
+import { LockerThemeDrawer } from "./LockerThemeDrawer";
import { LockerSecurityDrawer } from "./LockerSecurityDrawer";
import {
@@ -83,6 +85,7 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
userDetails,
}) => {
const { logout } = useBaseContext();
+ const [isThemeOpen, setIsThemeOpen] = useState(false);
const [isAccountOpen, setIsAccountOpen] = useState(false);
const [isLegacyAuthenticateOpen, setIsLegacyAuthenticateOpen] =
useState(false);
@@ -134,6 +137,7 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
setIsSupportOpen(false);
setIsAboutOpen(false);
setIsSecurityOpen(false);
+ setIsThemeOpen(false);
}
}, [open]);
@@ -269,6 +273,12 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
endIcon={<ChevronRightIcon />}
onClick={() => setIsSecurityOpen(true)}
/>
+ <LockerSidebarCardButton
+ icon={Sun03Icon}
+ label={t("appearance")}
+ endIcon={<ChevronRightIcon />}
+ onClick={() => setIsThemeOpen(true)}
+ />
<LockerSidebarCardButton
icon={HelpCircleIcon}
label={t("help_and_support")}
@@ -327,6 +337,11 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({
onClose={() => setIsAboutOpen(false)}
onRootClose={onClose}
/>
+ <LockerThemeDrawer
+ open={isThemeOpen}
+ onClose={() => setIsThemeOpen(false)}
+ onRootClose={onClose}
+ />
</>
);
};
diff --git a/web/apps/locker/src/components/sidebar/LockerThemeDrawer.tsx b/web/apps/locker/src/components/sidebar/LockerThemeDrawer.tsx
new file mode 100644
index 0000000000..3cdf4e422e
--- /dev/null
+++ b/web/apps/locker/src/components/sidebar/LockerThemeDrawer.tsx
@@ -0,0 +1,145 @@
+import {
+ Moon02Icon,
+ SmartPhone01Icon,
+ Sun03Icon,
+ Tick02Icon,
+} from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+import { Box, FormControlLabel, Radio, RadioGroup } from "@mui/material";
+import { useColorScheme } from "@mui/material/styles";
+import { t } from "i18next";
+import type { ChangeEvent } from "react";
+import {
+ LockerTitledNestedSidebarDrawer,
+ type LockerNestedSidebarDrawerVisibilityProps,
+} from "./LockerSidebarShell";
+import {
+ bodySx,
+ rowSurfaceSx,
+ textBaseSx,
+ textLightSx,
+} from "./locker-sidebar-styles";
+
+const themeOptions = [
+ { value: "system", icon: SmartPhone01Icon },
+ { value: "light", icon: Sun03Icon },
+ { value: "dark", icon: Moon02Icon },
+] as const;
+
+export function LockerThemeDrawer({
+ open,
+ onClose,
+ onRootClose,
+}: LockerNestedSidebarDrawerVisibilityProps) {
+ const { mode, setMode } = useColorScheme();
+
+ function handleChange(
+ _event: ChangeEvent<HTMLInputElement>,
+ value: string,
+ ) {
+ if (value === "system" || value === "light" || value === "dark") {
+ setMode(value);
+ }
+ }
+
+ return (
+ <LockerTitledNestedSidebarDrawer
+ {...{ open, onClose, onRootClose }}
+ title={t("theme")}
+ >
+ {mode && (
+ <RadioGroup
+ aria-label={t("theme")}
+ value={mode}
+ onChange={handleChange}
+ sx={{ borderRadius: "20px", overflow: "hidden" }}
+ >
+ {themeOptions.map(({ value, icon }) => (
+ <FormControlLabel
+ key={value}
+ value={value}
+ label={
+ <Box
+ sx={{
+ display: "flex",
+ alignItems: "center",
+ gap: 1.5,
+ }}
+ >
+ <Box
+ sx={[
+ textLightSx,
+ {
+ width: 36,
+ height: 36,
+ display: "grid",
+ placeItems: "center",
+ flexShrink: 0,
+ },
+ ]}
+ >
+ <HugeiconsIcon
+ icon={icon}
+ size={18}
+ strokeWidth={1.6}
+ />
+ </Box>
+ {t(value)}
+ </Box>
+ }
+ labelPlacement="start"
+ control={
+ <Radio
+ icon={
+ <Box sx={{ width: 24, height: 24 }} />
+ }
+ checkedIcon={
+ <HugeiconsIcon
+ icon={Tick02Icon}
+ size={24}
+ strokeWidth={1.6}
+ />
+ }
+ sx={{
+ p: "6px",
+ "&.Mui-checked": {
+ color: "accent.main",
+ },
+ }}
+ />
+ }
+ sx={[
+ rowSurfaceSx,
+ textBaseSx,
+ {
+ m: 0,
+ p: "9px 12px",
+ minHeight: 54,
+ boxSizing: "border-box",
+ position: "relative",
+ justifyContent: "space-between",
+ "& .MuiFormControlLabel-label": bodySx,
+ "&:not(:last-child)::after": {
+ content: '""',
+ position: "absolute",
+ bottom: 0,
+ left: 60,
+ right: 0,
+ borderBottom: "1px solid",
+ borderColor: "divider",
+ opacity: 0.5,
+ },
+ "&:has(.Mui-focusVisible)": {
+ outline: "2px solid",
+ outlineColor: "accent.main",
+ outlineOffset: -2,
+ },
+ },
+ ]}
+ />
+ ))}
+ </RadioGroup>
+ )}
+ </LockerTitledNestedSidebarDrawer>
+ );
+}
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.json
index d37f9bf4f4..07c7946b86 100644
--- a/web/packages/base/locales/en-US/translation.json
+++ b/web/packages/base/locales/en-US/translation.json
@@ -1037,6 +1037,7 @@
"save": "Save",
"save_changes": "Save changes",
"theme": "Theme",
+ "appearance": "Appearance",
"system": "System",
"light": "Light",
"dark": "Dark",