π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Update icons
vishnukvmdd17e6e5177d2
diff --git a/web/apps/locker/package.json b/web/apps/locker/package.jsonindex c5dbc460f1..d5a5961a26 100644--- a/web/apps/locker/package.json+++ b/web/apps/locker/package.json@@ -3,6 +3,8 @@"version": "0.0.0","private": true,"dependencies": {+ "@hugeicons/core-free-icons": "^1.1.0",+ "@hugeicons/react": "^1.1.4","ente-accounts-rs": "*","ente-base": "*","ente-wasm": "*"diff --git a/web/apps/locker/src/components/CreateItemDialog.tsx b/web/apps/locker/src/components/CreateItemDialog.tsxindex 09948e9215..f49c1f959e 100644--- a/web/apps/locker/src/components/CreateItemDialog.tsx+++ b/web/apps/locker/src/components/CreateItemDialog.tsx@@ -1,9 +1,5 @@import AddOutlinedIcon from "@mui/icons-material/AddOutlined";import CloudUploadOutlinedIcon from "@mui/icons-material/CloudUploadOutlined";-import InsertDriveFileOutlinedIcon from "@mui/icons-material/InsertDriveFileOutlined";-import KeyOutlinedIcon from "@mui/icons-material/KeyOutlined";-import LocationOnOutlinedIcon from "@mui/icons-material/LocationOnOutlined";-import NoteOutlinedIcon from "@mui/icons-material/NoteOutlined";import VisibilityIcon from "@mui/icons-material/Visibility";import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";import {@@ -19,6 +15,12 @@ import {TextField,Typography,} from "@mui/material";+import {+ createDocumentIcon,+ createDocumentIconConfig,+ lockerItemIcon,+ lockerItemIconConfig,+} from "components/lockerItemIcons";import { FocusVisibleButton } from "ente-base/components/mui/FocusVisibleButton";import { LoadingButton } from "ente-base/components/mui/LoadingButton";import log from "ente-base/log";@@ -47,35 +49,35 @@ const CREATABLE_TYPES: {type: "file",labelKey: "saveDocumentTitle",descriptionKey: "saveDocumentDescription",- icon: (- <InsertDriveFileOutlinedIcon- sx={{ fontSize: 28, color: "#E53935" }}- />- ),- bgColor: "rgba(229, 57, 53, 0.12)",+ icon: createDocumentIcon(28, 1.9),+ bgColor: createDocumentIconConfig.backgroundColor,},{type: "note",labelKey: "personalNote",descriptionKey: "personalNoteDescription",- icon: <NoteOutlinedIcon sx={{ fontSize: 28, color: "#FFB347" }} />,- bgColor: "rgba(255, 179, 71, 0.15)",+ icon: lockerItemIcon("note", { size: 28, strokeWidth: 1.9 }),+ bgColor: lockerItemIconConfig("note").backgroundColor,},{type: "physicalRecord",labelKey: "thing",descriptionKey: "physicalRecordsDescription",- icon: (- <LocationOnOutlinedIcon sx={{ fontSize: 28, color: "#4CAF50" }} />- ),- bgColor: "rgba(76, 175, 80, 0.15)",+ icon: lockerItemIcon("physicalRecord", {+ size: 28,+ strokeWidth: 1.9,+ }),+ bgColor: lockerItemIconConfig("physicalRecord").backgroundColor,},{type: "accountCredential",labelKey: "secret",descriptionKey: "accountCredentialsDescription",- icon: <KeyOutlinedIcon sx={{ fontSize: 28, color: "#1071FF" }} />,- bgColor: "rgba(16, 113, 255, 0.15)",+ icon: lockerItemIcon("accountCredential", {+ size: 28,+ strokeWidth: 1.9,+ }),+ bgColor: lockerItemIconConfig("accountCredential").backgroundColor,},];@@ -354,9 +356,27 @@ export const CreateItemDialog: React.FC<CreateItemDialogProps> = ({theme.vars.palette.fill.faint,}}>- <InsertDriveFileOutlinedIcon- sx={{ fontSize: 32, color: "#E53935" }}- />+ <Box+ sx={{+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ width: 48,+ height: 48,+ borderRadius: "12px",+ backgroundColor: lockerItemIconConfig(+ "file",+ selectedFile.name,+ ).backgroundColor,+ flexShrink: 0,+ }}+ >+ {lockerItemIcon("file", {+ fileName: selectedFile.name,+ size: 24,+ strokeWidth: 1.9,+ })}+ </Box><Box sx={{ flex: 1, minWidth: 0 }}><Typography variant="body" noWrap>{selectedFile.name}diff --git a/web/apps/locker/src/components/ItemCard.tsx b/web/apps/locker/src/components/ItemCard.tsxindex d0f4ad082a..d21d3b5dcc 100644--- a/web/apps/locker/src/components/ItemCard.tsx+++ b/web/apps/locker/src/components/ItemCard.tsx@@ -1,22 +1,13 @@-import AudioFileOutlinedIcon from "@mui/icons-material/AudioFileOutlined";import CheckCircleRoundedIcon from "@mui/icons-material/CheckCircleRounded";-import ContactEmergencyOutlinedIcon from "@mui/icons-material/ContactEmergencyOutlined";import ContentCopyIcon from "@mui/icons-material/ContentCopy";import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";-import DescriptionOutlinedIcon from "@mui/icons-material/DescriptionOutlined";import EditOutlinedIcon from "@mui/icons-material/EditOutlined";import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";-import ImageOutlinedIcon from "@mui/icons-material/ImageOutlined";-import InsertDriveFileOutlinedIcon from "@mui/icons-material/InsertDriveFileOutlined";-import KeyOutlinedIcon from "@mui/icons-material/KeyOutlined";import LinkOutlinedIcon from "@mui/icons-material/LinkOutlined";-import LocationOnOutlinedIcon from "@mui/icons-material/LocationOnOutlined";import MoreVertIcon from "@mui/icons-material/MoreVert";-import NoteOutlinedIcon from "@mui/icons-material/NoteOutlined";import RadioButtonUncheckedRoundedIcon from "@mui/icons-material/RadioButtonUncheckedRounded";import RestoreIcon from "@mui/icons-material/Restore";import ShareOutlinedIcon from "@mui/icons-material/ShareOutlined";-import VideoFileOutlinedIcon from "@mui/icons-material/VideoFileOutlined";import VisibilityIcon from "@mui/icons-material/Visibility";import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";import {@@ -36,6 +27,7 @@ import {import log from "ente-base/log";import { t } from "i18next";import React, { useCallback, useState } from "react";+import { lockerItemIcon, lockerItemIconConfig } from "components/lockerItemIcons";import type { LockerFileShareLinkSummary } from "services/remote";import { downloadLockerFile } from "services/remote";import type { AccountCredentialData, GenericFileData, LockerItem } from "types";@@ -601,102 +593,20 @@ const CredentialActions: React.FC<{* Background color for the icon square, per item type.*/const iconBgColor = (item: LockerItem): string => {- switch (item.type) {- case "note":- return "rgba(255, 179, 71, 0.15)";- case "accountCredential":- return "rgba(16, 113, 255, 0.15)";- case "physicalRecord":- return "rgba(76, 175, 80, 0.15)";- case "emergencyContact":- return "rgba(244, 67, 54, 0.15)";- case "file": {- const name = (item.data as GenericFileData).name;- const ext = name.split(".").pop()?.toLowerCase() ?? "";- if (- [- "pdf",- "doc",- "docx",- "txt",- "rtf",- "xlsx",- "pptx",- "csv",- ].includes(ext)- )- return "rgba(244, 67, 54, 0.12)";- if (- ["jpg", "jpeg", "png", "gif", "heic", "webp", "svg"].includes(- ext,- )- )- return "rgba(76, 175, 80, 0.12)";- if (- ["mp3", "m4a", "wav", "ogg", "flac", "aac", "wma"].includes(ext)- )- return "rgba(156, 39, 176, 0.12)";- if (["mp4", "mov", "avi", "mkv", "webm"].includes(ext))- return "rgba(33, 150, 243, 0.12)";- return "rgba(158, 158, 158, 0.10)";- }- default:- return "rgba(158, 158, 158, 0.10)";- }+ return lockerItemIconConfig(+ item.type,+ item.type === "file" ? (item.data as GenericFileData).name : undefined,+ ).backgroundColor;};/** Icon for a LockerItem. */const itemIcon = (item: LockerItem) => {- switch (item.type) {- case "note":- return <NoteOutlinedIcon sx={{ fontSize: 20, color: "#FFB347" }} />;- case "accountCredential":- return <KeyOutlinedIcon sx={{ fontSize: 20, color: "#1071FF" }} />;- case "physicalRecord":- return (- <LocationOnOutlinedIcon- sx={{ fontSize: 20, color: "#4CAF50" }}- />- );- case "emergencyContact":- return (- <ContactEmergencyOutlinedIcon- sx={{ fontSize: 20, color: "#F44336" }}- />- );- case "file":- return fileIcon((item.data as GenericFileData).name);- default:- return (- <InsertDriveFileOutlinedIcon- sx={{ fontSize: 20, color: "#9E9E9E" }}- />- );- }-};--/** Pick an icon based on the file extension. */-const fileIcon = (name: string) => {- const ext = name.split(".").pop()?.toLowerCase() ?? "";- if (["mp3", "m4a", "wav", "ogg", "flac", "aac", "wma"].includes(ext))- return (- <AudioFileOutlinedIcon sx={{ fontSize: 20, color: "#9C27B0" }} />- );- if (["mp4", "mov", "avi", "mkv", "webm"].includes(ext))- return (- <VideoFileOutlinedIcon sx={{ fontSize: 20, color: "#2196F3" }} />- );- if (["jpg", "jpeg", "png", "gif", "heic", "webp", "svg"].includes(ext))- return <ImageOutlinedIcon sx={{ fontSize: 20, color: "#4CAF50" }} />;- if (- ["pdf", "doc", "docx", "txt", "rtf", "xlsx", "pptx", "csv"].includes(- ext,- )- )- return (- <DescriptionOutlinedIcon sx={{ fontSize: 20, color: "#F44336" }} />- );- return (- <InsertDriveFileOutlinedIcon sx={{ fontSize: 20, color: "#9E9E9E" }} />- );+ return lockerItemIcon(item.type, {+ fileName:+ item.type === "file"+ ? (item.data as GenericFileData).name+ : undefined,+ size: 20,+ strokeWidth: 1.9,+ });};diff --git a/web/apps/locker/src/components/LockerNavbar.tsx b/web/apps/locker/src/components/LockerNavbar.tsxindex c10efeb515..b3307643a2 100644--- a/web/apps/locker/src/components/LockerNavbar.tsx+++ b/web/apps/locker/src/components/LockerNavbar.tsx@@ -1,4 +1,5 @@-import MenuIcon from "@mui/icons-material/Menu";+import { Menu01Icon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import WarningAmberRoundedIcon from "@mui/icons-material/WarningAmberRounded";import { Box, IconButton, Stack, Typography } from "@mui/material";import React from "react";@@ -42,7 +43,11 @@ export const LockerNavbar: React.FC<LockerNavbarProps> = ({>{showMenuButton ? (<IconButton onClick={onOpenSidebar} sx={{ color: "#fff" }}>- <MenuIcon />+ <HugeiconsIcon+ icon={Menu01Icon}+ size={24}+ strokeWidth={2.25}+ /></IconButton>) : (<Box sx={{ width: 40 }} />diff --git a/web/apps/locker/src/components/LockerSidebar.tsx b/web/apps/locker/src/components/LockerSidebar.tsxindex c60c4e3f64..fdbd33a2c6 100644--- a/web/apps/locker/src/components/LockerSidebar.tsx+++ b/web/apps/locker/src/components/LockerSidebar.tsx@@ -1,9 +1,15 @@+import {+ Delete02Icon,+ HelpCircleIcon,+ Home01Icon,+ InformationCircleIcon,+ Logout05Icon,+ 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 DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";-import FolderOutlinedIcon from "@mui/icons-material/FolderOutlined";-import HomeOutlinedIcon from "@mui/icons-material/HomeOutlined";-import LogoutOutlinedIcon from "@mui/icons-material/LogoutOutlined";import {Box,IconButton,@@ -12,11 +18,6 @@ import {useTheme,} from "@mui/material";import { EnteLogo } from "ente-base/components/EnteLogo";-import {- RowButton,- RowButtonDivider,- RowButtonGroup,-} from "ente-base/components/RowButton";import { SidebarDrawer } from "ente-base/components/mui/SidebarDrawer";import { useBaseContext } from "ente-base/context";import { t } from "i18next";@@ -318,64 +319,60 @@ export const LockerSidebar: React.FC<LockerSidebarProps> = ({)}<Box sx={{ px: 0.5, mt: 0.5 }}>- <RowButtonGroup>- <RowButton- startIcon={<HomeOutlinedIcon />}+ <Stack sx={{ gap: 1 }}>+ <SidebarCardButton+ icon={Home01Icon}label={t("home")}caption={String(totalItems)}- fontWeight={isHomeView ? "bold" : "medium"}+ selected={isHomeView}onClick={onSelectHome}/>- <RowButtonDivider />- <RowButton- startIcon={<FolderOutlinedIcon />}+ <SidebarCardButton+ icon={Wallet05Icon}label={t("menuCollections")}caption={String(displayCollections.length)}- fontWeight={- isCollectionsView ? "bold" : "medium"- }+ selected={isCollectionsView}onClick={onSelectCollections}/>- <RowButtonDivider />- <RowButton- startIcon={<DeleteOutlineIcon />}+ <SidebarCardButton+ icon={Delete02Icon}label={t("menuTrash")}caption={String(trashItemCount)}- fontWeight={isTrashView ? "bold" : "medium"}+ selected={isTrashView}onClick={onSelectTrash}/>- </RowButtonGroup>+ </Stack></Box><Box sx={{ px: 0.5, mt: 2, pb: 1 }}>- <RowButtonGroup>- <RowButton+ <Stack sx={{ gap: 1 }}>+ <SidebarCardButton+ icon={UserIcon}label={t("account")}endIcon={<ChevronRightIcon />}onClick={() => setIsAccountOpen(true)}/>- <RowButtonDivider />- <RowButton+ <SidebarCardButton+ icon={HelpCircleIcon}label={t("help_and_support")}endIcon={<ChevronRightIcon />}onClick={() => setIsSupportOpen(true)}/>- <RowButtonDivider />- <RowButton+ <SidebarCardButton+ icon={InformationCircleIcon}label={t("about")}endIcon={<ChevronRightIcon />}onClick={() => setIsAboutOpen(true)}/>- </RowButtonGroup>+ </Stack></Box></Box><Box sx={{ px: 0.5, pb: 1 }}>- <RowButton- variant="secondary"- color="critical"- startIcon={<LogoutOutlinedIcon />}+ <SidebarCardButton+ icon={Logout05Icon}label={t("logout")}+ color="warning.main"onClick={logout}/></Box>@@ -409,3 +406,106 @@ 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/lockerItemIcons.tsx b/web/apps/locker/src/components/lockerItemIcons.tsxnew file mode 100644index 0000000000..7d7127cc06--- /dev/null+++ b/web/apps/locker/src/components/lockerItemIcons.tsx@@ -0,0 +1,132 @@+import {+ Briefcase01Icon,+ ContactBookIcon,+ File01Icon,+ File02Icon,+ FileUploadIcon,+ Image01Icon,+ LockPasswordIcon,+ NoteIcon,+ Presentation01Icon,+ Table01Icon,+} from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";+import type { ComponentProps } from "react";+import type { LockerItemType } from "types";++type LockerIconConfig = {+ icon: ComponentProps<typeof HugeiconsIcon>["icon"];+ color: string;+ backgroundColor: string;+};++const itemTypeIconConfigs: Record<LockerItemType, LockerIconConfig> = {+ note: {+ icon: NoteIcon,+ color: "rgba(255, 152, 0, 1)",+ backgroundColor: "rgba(255, 152, 0, 0.06)",+ },+ physicalRecord: {+ icon: Briefcase01Icon,+ color: "rgba(156, 39, 176, 1)",+ backgroundColor: "rgba(156, 39, 176, 0.06)",+ },+ accountCredential: {+ icon: LockPasswordIcon,+ color: "rgba(16, 113, 255, 1)",+ backgroundColor: "rgba(16, 113, 255, 0.06)",+ },+ emergencyContact: {+ icon: ContactBookIcon,+ color: "rgba(244, 67, 54, 1)",+ backgroundColor: "rgba(244, 67, 54, 0.06)",+ },+ file: {+ icon: File02Icon,+ color: "#757575",+ backgroundColor: "#FAFAFA",+ },+};++const fileIconConfigs: Record<string, LockerIconConfig> = {+ pdf: {+ icon: File01Icon,+ color: "rgba(246, 58, 58, 1)",+ backgroundColor: "rgba(255, 58, 58, 0.06)",+ },+ image: {+ icon: Image01Icon,+ color: "rgba(8, 194, 37, 1)",+ backgroundColor: "rgba(8, 194, 37, 0.06)",+ },+ presentation: {+ icon: Presentation01Icon,+ color: "rgba(16, 113, 255, 1)",+ backgroundColor: "rgba(16, 113, 255, 0.06)",+ },+ spreadsheet: {+ icon: Table01Icon,+ color: "#388E3C",+ backgroundColor: "#E8F5E9",+ },+ default: itemTypeIconConfigs.file,+};++export const createDocumentIconConfig: LockerIconConfig = {+ icon: FileUploadIcon,+ color: "rgba(16, 113, 255, 1)",+ backgroundColor: "rgba(16, 113, 255, 0.06)",+};++export const createDocumentIcon = (size = 20, strokeWidth = 1.9) => (+ <HugeiconsIcon+ icon={createDocumentIconConfig.icon}+ size={size}+ strokeWidth={strokeWidth}+ color={createDocumentIconConfig.color}+ />+);++export const lockerItemIconConfig = (+ type: LockerItemType,+ fileName?: string,+): LockerIconConfig => {+ if (type !== "file") {+ return itemTypeIconConfigs[type];+ }++ const ext = fileName?.split(".").pop()?.toLowerCase() ?? "";+ if (ext === "pdf") {+ return fileIconConfigs.pdf!;+ }+ if (["jpg", "jpeg", "png", "heic"].includes(ext)) {+ return fileIconConfigs.image!;+ }+ if (ext === "pptx") {+ return fileIconConfigs.presentation!;+ }+ if (ext === "xlsx") {+ return fileIconConfigs.spreadsheet!;+ }++ return fileIconConfigs.default!;+};++export const lockerItemIcon = (+ type: LockerItemType,+ options?: {+ fileName?: string;+ size?: number;+ strokeWidth?: number;+ },+) => {+ const { icon, color } = lockerItemIconConfig(type, options?.fileName);+ return (+ <HugeiconsIcon+ icon={icon}+ size={options?.size ?? 20}+ strokeWidth={options?.strokeWidth ?? 1.9}+ color={color}+ />+ );+};