π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update(locker):improve-dashboard-ui
Aswin Asok7170bb4434d7
diff --git a/web/apps/locker/src/components/ItemCard.tsx b/web/apps/locker/src/components/ItemCard.tsxindex dc5b050779..15523fb526 100644--- a/web/apps/locker/src/components/ItemCard.tsx+++ b/web/apps/locker/src/components/ItemCard.tsx@@ -1,7 +1,4 @@-import {- lockerItemIcon,- lockerItemIconConfig,-} from "@/components/locker-item-icons";+import { lockerItemIcon } from "@/components/locker-item-icons";import { downloadLockerFile } from "@/services/remote";import type { GenericFileData, LockerItem } from "@/types";import { getItemTitle, hasDownloadableObject } from "@/types";@@ -31,6 +28,7 @@ import {import log from "ente-base/log";import { t } from "i18next";import React, { useCallback, useState } from "react";+import { lockerColors, lockerColorSx, lockerTextBodySx } from "./locker-tokens";interface ItemCardProps {item: LockerItem;@@ -178,22 +176,19 @@ export const ItemCard: React.FC<ItemCardProps> = React.memo(function ItemCard({display: "flex",width: "100%",textAlign: "left",- borderRadius: "18px",+ borderRadius: "20px",overflow: "hidden",- px: 1.5,- py: 1.25,- gap: 1.25,+ p: 1.5,+ gap: 1.5,alignItems: "center",- backgroundColor: theme.vars.palette.fill.faint,+ ...lockerColorSx(theme, { backgroundColor: "fillLight" }),transition: "background-color 0.15s",opacity: selectionMode && !selectable ? 0.58 : 1,"&:hover": {- backgroundColor: theme.vars.palette.fill.faintHover,+ ...lockerColorSx(theme, {+ backgroundColor: "fillDark",+ }),},- ...theme.applyStyles("light", {- backgroundColor: "#FFFFFF",- "&:hover": { backgroundColor: "#FFFFFF" },- }),})}>{selectionMode && (@@ -220,64 +215,50 @@ export const ItemCard: React.FC<ItemCardProps> = React.memo(function ItemCard({)}<Box- sx={{+ sx={(theme) => ({position: "relative",- width: 52,- height: 52,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ width: 40,+ height: 40,flexShrink: 0,- }}+ borderRadius: "12px",+ ...lockerColorSx(theme, {+ backgroundColor: "backgroundBase",+ }),+ })}>- <Box- sx={{- position: "relative",- zIndex: 1,- display: "flex",- alignItems: "center",- justifyContent: "center",- width: 40,- height: 40,- m: "6px",- borderRadius:- item.type === "file" ? "12px" : "10px",- backgroundColor: iconBgColor(item),- }}- >- {itemIcon(item)}- </Box>+ {itemIcon(item)}{isIncomingShared && !selectionMode && (<Boxsx={(theme) => ({position: "absolute",- right: 1,- bottom: 6,+ right: -4,+ bottom: -4,display: "flex",alignItems: "center",justifyContent: "center",width: 18,height: 18,borderRadius: "50%",- backgroundColor: theme.vars.palette.fill.faint,- p: "1px",- zIndex: 2,+ ...lockerColorSx(theme, {+ backgroundColor: "fillLight",+ }),})}><HugeiconsIconicon={CircleArrowDownLeftIcon}size={16}strokeWidth={2}- color="rgba(16, 113, 255, 1)"- style={{ zIndex: 3 }}+ color={lockerColors.primary.dark}/></Box>)}</Box><Box sx={{ flex: 1, minWidth: 0 }}>- <Typography- variant="body"- sx={{ fontWeight: "regular", lineHeight: 1.45 }}- noWrap- >+ <Typography variant="body" sx={lockerTextBodySx} noWrap>{title}</Typography></Box>@@ -355,7 +336,12 @@ const ItemOverflowMenu: React.FC<{<OverflowMenuariaID={`item-menu-${item.id}`}triggerButtonIcon={<MoreVertIcon sx={{ fontSize: 20 }} />}- triggerButtonSxProps={{ color: "text.faint", p: 0.5 }}+ triggerButtonSxProps={(theme) => ({+ width: 24,+ height: 24,+ p: 0,+ ...lockerColorSx(theme, { color: "textLight" }),+ })}>{onEdit && (<OverflowMenuOption@@ -431,20 +417,13 @@ const TrashActions: React.FC<{</Stack>);-const iconBgColor = (item: LockerItem): string => {- return lockerItemIconConfig(- item.type,- item.type === "file" ? (item.data as GenericFileData).name : undefined,- ).backgroundColor;-};-const itemIcon = (item: LockerItem) => {return lockerItemIcon(item.type, {fileName:item.type === "file"? (item.data as GenericFileData).name: undefined,- size: item.type === "file" ? 24 : 20,- strokeWidth: 1.9,+ size: 24,+ strokeWidth: 1.5,});};diff --git a/web/apps/locker/src/components/ItemList.tsx b/web/apps/locker/src/components/ItemList.tsxindex 3de3953151..7bd6a0ec53 100644--- a/web/apps/locker/src/components/ItemList.tsx+++ b/web/apps/locker/src/components/ItemList.tsx@@ -20,6 +20,7 @@ import {import AddOutlinedIcon from "@mui/icons-material/AddOutlined";import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";import CheckCircleRoundedIcon from "@mui/icons-material/CheckCircleRounded";+import ChevronLeftRoundedIcon from "@mui/icons-material/ChevronLeftRounded";import ChevronRightRoundedIcon from "@mui/icons-material/ChevronRightRounded";import ClearRoundedIcon from "@mui/icons-material/ClearRounded";import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined";@@ -58,6 +59,12 @@ import React, {import { ItemCard } from "./ItemCard";import { ItemDetailView } from "./ItemDetailView";import { ItemListDialogs } from "./itemList/ItemListDialogs";+import {+ lockerColors,+ lockerColorSx,+ lockerContentMaxWidth,+ lockerTextBodySx,+} from "./locker-tokens";const uniqueCollectionsByID = (collections: LockerCollection[]) => {const seen = new Set<number>();@@ -98,8 +105,6 @@ interface ItemListProps {onNavigateBack?: () => void;}-const contentMaxWidth = 560;-export const ItemList: React.FC<ItemListProps> = ({collections,trashItems,@@ -800,44 +805,35 @@ export const ItemList: React.FC<ItemListProps> = ({overflowY: "auto",overscrollBehavior: "contain",WebkitOverflowScrolling: "touch",- backgroundColor: "#08090A",- ...theme.applyStyles("light", {- backgroundColor: "#F3F4F6",+ ...lockerColorSx(theme, {+ backgroundColor: "backgroundBase",}),})}><Boxsx={(theme) => ({- px: { xs: 2, sm: 3 },+ px: 2,+ pt: 2,pb: isTrashView? 3: "calc(env(safe-area-inset-bottom) + 120px)",- backgroundColor: "#08090A",- ...theme.applyStyles("light", {- backgroundColor: "#F3F4F6",+ ...lockerColorSx(theme, {+ backgroundColor: "backgroundBase",}),})}>{isHomeView && (<>- <SectionHeader- title={t("recents")}- countLabel={t("lockerItemsCount", {- count: homeFilteredItems.length,- })}- />-{displayCollections.length > 0 && (<Stackdirection="row"sx={{width: "100%",- maxWidth: contentMaxWidth,+ maxWidth: lockerContentMaxWidth,mx: "auto",alignItems: "center",- gap: 0.75,- mt: -0.25,- mb: 1.75,+ gap: 1,+ mb: 2,minWidth: 0,}}>@@ -1367,9 +1363,9 @@ const SectionHeader: React.FC<{alignItems: "center",justifyContent: "space-between",gap: 2,- maxWidth: contentMaxWidth,+ maxWidth: lockerContentMaxWidth,mx: "auto",- mt: 3,+ mt: 1,mb: 2.25,}}>@@ -1446,7 +1442,7 @@ const ItemsSection: React.FC<{}) =>items.length > 0 ? (<Stack- sx={{ maxWidth: contentMaxWidth, mx: "auto", gap: 1.1, mt: 1.25 }}+ sx={{ maxWidth: lockerContentMaxWidth, mx: "auto", gap: 1, mt: 0 }}>{items.map((item) => {const isOwnedByCurrentUser = isLockerItemOwner(@@ -1501,7 +1497,9 @@ const ItemsSection: React.FC<{})}</Stack>) : (- <Box sx={{ maxWidth: contentMaxWidth, mx: "auto" }}>{emptyState}</Box>+ <Box sx={{ maxWidth: lockerContentMaxWidth, mx: "auto" }}>+ {emptyState}+ </Box>);const SelectionActionBar: React.FC<{@@ -1696,7 +1694,7 @@ const CollectionGrid: React.FC<{<Boxsx={{width: "100%",- maxWidth: contentMaxWidth,+ maxWidth: lockerContentMaxWidth,mx: "auto",display: "grid",gap: 2,@@ -1746,6 +1744,18 @@ const CollectionChipFilters: React.FC<{const [showLeftScrollHint, setShowLeftScrollHint] = useState(false);const [showRightScrollHint, setShowRightScrollHint] = useState(false);+ const scrollLeft = () => {+ const container = scrollContainerRef.current;+ if (!container) {+ return;+ }++ container.scrollBy({+ left: -Math.max(container.clientWidth * 0.6, 160),+ behavior: "smooth",+ });+ };+const scrollRight = () => {const container = scrollContainerRef.current;if (!container) {@@ -1787,14 +1797,32 @@ const CollectionChipFilters: React.FC<{return (<Box- sx={{- width: "100%",- maxWidth: contentMaxWidth,- mx: "auto",- mt: 0.5,- }}+ sx={{ width: "100%", maxWidth: lockerContentMaxWidth, mx: "auto" }}><Stack direction="row" sx={{ alignItems: "stretch", gap: 0 }}>+ {showLeftScrollHint && (+ <Box+ sx={{+ width: 28,+ flexShrink: 0,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ }}+ >+ <ButtonBase+ onClick={scrollLeft}+ sx={(theme) => ({+ width: 28,+ height: "100%",+ borderRadius: "999px",+ ...lockerColorSx(theme, { color: "iconColor" }),+ })}+ >+ <ChevronLeftRoundedIcon sx={{ fontSize: 28 }} />+ </ButtonBase>+ </Box>+ )}<Box sx={{ position: "relative", flex: 1, minWidth: 0 }}><Stackref={scrollContainerRef}@@ -1823,28 +1851,25 @@ const CollectionChipFilters: React.FC<{onToggleCollection(collection.id)}sx={(theme) => ({- borderRadius: "999px",- px: 1.5,- py: 0.875,+ minHeight: 44,+ padding: "12px 20px",+ borderRadius: "16px",whiteSpace: "nowrap",flexShrink: 0,- backgroundColor: isSelected- ? "#1071FF"- : theme.vars.palette.fill.faint,- color: isSelected- ? "#FFFFFF"- : theme.vars.palette.text.base,- ...theme.applyStyles("light", {+ ...lockerColorSx(theme, {backgroundColor: isSelected- ? "#1071FF"- : "#FFFFFF",- border: isSelected- ? "none"- : "1px solid rgba(17, 24, 39, 0.06)",+ ? "primary"+ : "fillLight",+ color: isSelected+ ? "specialWhite"+ : "textLight",}),})}>- <Typography variant="small">+ <Typography+ variant="small"+ sx={lockerTextBodySx}+ >{collection.name}</Typography></ButtonBase>@@ -1860,11 +1885,9 @@ const CollectionChipFilters: React.FC<{bottom: 0,width: 40,pointerEvents: "none",- background:- "linear-gradient(90deg, #08090A 0%, rgba(8, 9, 10, 0) 100%)",+ background: `linear-gradient(90deg, ${lockerColors.backgroundBase.dark} 0%, ${lockerColors.backgroundBase.dark}00 100%)`,...theme.applyStyles("light", {- background:- "linear-gradient(90deg, #F3F4F6 0%, rgba(243, 244, 246, 0) 100%)",+ background: `linear-gradient(90deg, ${lockerColors.backgroundBase.light} 0%, ${lockerColors.backgroundBase.light}00 100%)`,}),})}/>@@ -1878,42 +1901,37 @@ const CollectionChipFilters: React.FC<{bottom: 0,width: 72,pointerEvents: "none",- background:- "linear-gradient(90deg, rgba(8, 9, 10, 0) 0%, #08090A 100%)",+ background: `linear-gradient(90deg, ${lockerColors.backgroundBase.dark}00 0%, ${lockerColors.backgroundBase.dark} 100%)`,...theme.applyStyles("light", {- background:- "linear-gradient(90deg, rgba(243, 244, 246, 0) 0%, #F3F4F6 100%)",+ background: `linear-gradient(90deg, ${lockerColors.backgroundBase.light}00 0%, ${lockerColors.backgroundBase.light} 100%)`,}),})}/>)}</Box>- <Box- sx={{- width: 28,- flexShrink: 0,- display: "flex",- alignItems: "center",- justifyContent: "center",- }}- >- {showRightScrollHint && (+ {showRightScrollHint && (+ <Box+ sx={{+ width: 28,+ flexShrink: 0,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ }}+ ><ButtonBaseonClick={scrollRight}sx={(theme) => ({width: 28,height: "100%",- color: "#4A4A4A",borderRadius: "999px",- ...theme.applyStyles("dark", {- color: "#FFFFFF",- }),+ ...lockerColorSx(theme, { color: "iconColor" }),})}><ChevronRightRoundedIcon sx={{ fontSize: 28 }} /></ButtonBase>- )}- </Box>+ </Box>+ )}</Stack></Box>);@@ -1927,29 +1945,23 @@ const CollectionFilterChip: React.FC<{<ButtonBaseonClick={onClick}sx={(theme) => ({- borderRadius: "999px",- px: 1.25,- py: 0.875,+ width: 36,+ height: 36,+ borderRadius: "12px",flexShrink: 0,- minWidth: 44,- color: selected ? "#FFFFFF" : theme.vars.palette.text.base,- backgroundColor: selected- ? "#1071FF"- : theme.vars.palette.fill.faint,+ padding: 0,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ ...lockerColorSx(theme, {+ backgroundColor: selected ? "primary" : "fillLight",+ color: selected ? "specialWhite" : "iconColor",+ }),"&:hover": {- backgroundColor: selected- ? "#1071FF"- : theme.vars.palette.fill.faintHover,+ ...lockerColorSx(theme, {+ backgroundColor: selected ? "primary" : "fillDark",+ }),},- ...theme.applyStyles("light", {- backgroundColor: selected ? "#1071FF" : "#FFFFFF",- border: selected- ? "none"- : "1px solid rgba(17, 24, 39, 0.06)",- "&:hover": {- backgroundColor: selected ? "#1071FF" : "#F8FAFC",- },- }),})}><FilterListRoundedIcon sx={{ fontSize: 18 }} />@@ -1992,7 +2004,7 @@ const CollectionCard: React.FC<{px: 1.5,py: 1.25,minHeight: 84,- borderRadius: "18px",+ borderRadius: "20px",backgroundColor:collection.items.length > 0? theme.vars.palette.fill.faintdiff --git a/web/apps/locker/src/components/LockerNavbar.tsx b/web/apps/locker/src/components/LockerNavbar.tsxindex 51b33086bf..c2036c7586 100644--- a/web/apps/locker/src/components/LockerNavbar.tsx+++ b/web/apps/locker/src/components/LockerNavbar.tsx@@ -11,7 +11,7 @@ import {import { t } from "i18next";import React, { useDeferredValue, useEffect, useState } from "react";-const contentMaxWidth = 560;+import { lockerContentMaxWidth } from "./locker-tokens";interface LockerNavbarProps {onOpenSidebar: () => void;@@ -48,7 +48,7 @@ export const LockerNavbar: React.FC<LockerNavbarProps> = ({zIndex: 1,background: "linear-gradient(135deg, #1071FF 0%, #0056CC 100%)",color: "#fff",- px: { xs: 2, sm: 3 },+ px: 2,pt: 1,pb: 0.25,}}@@ -80,7 +80,12 @@ export const LockerNavbar: React.FC<LockerNavbarProps> = ({</Stack><Box- sx={{ maxWidth: contentMaxWidth, mx: "auto", mt: 0.5, pb: 1.5 }}+ sx={{+ maxWidth: lockerContentMaxWidth,+ mx: "auto",+ mt: 0.5,+ pb: 1.5,+ }}><TextFieldsize="small"diff --git a/web/apps/locker/src/components/locker-item-icons.tsx b/web/apps/locker/src/components/locker-item-icons.tsxindex 3b429c4e0a..1234750ec8 100644--- a/web/apps/locker/src/components/locker-item-icons.tsx+++ b/web/apps/locker/src/components/locker-item-icons.tsx@@ -23,17 +23,17 @@ interface LockerIconConfig {const itemTypeIconConfigs: Record<LockerItemType, LockerIconConfig> = {note: {icon: NoteIcon,- color: "rgba(255, 152, 0, 1)",+ color: "#f08a1e",backgroundColor: "rgba(255, 152, 0, 0.06)",},physicalRecord: {icon: Briefcase01Icon,- color: "rgba(156, 39, 176, 1)",+ color: "#9610d6",backgroundColor: "rgba(156, 39, 176, 0.06)",},accountCredential: {icon: LockPasswordIcon,- color: "rgba(16, 113, 255, 1)",+ color: "#1071ff",backgroundColor: "rgba(16, 113, 255, 0.06)",},emergencyContact: {@@ -41,28 +41,28 @@ const itemTypeIconConfigs: Record<LockerItemType, LockerIconConfig> = {color: "rgba(244, 67, 54, 1)",backgroundColor: "rgba(244, 67, 54, 0.06)",},- file: { icon: File02Icon, color: "#757575", backgroundColor: "#FAFAFA" },+ file: { icon: File02Icon, color: "#666666", backgroundColor: "#FAFAFA" },};const fileIconConfigs: Record<string, LockerIconConfig> = {pdf: {icon: File01Icon,- color: "rgba(246, 58, 58, 1)",+ color: "#f63a3a",backgroundColor: "rgba(255, 58, 58, 0.06)",},image: {icon: Image01Icon,- color: "rgba(8, 194, 37, 1)",+ color: "#08c225",backgroundColor: "rgba(8, 194, 37, 0.06)",},presentation: {icon: Presentation01Icon,- color: "rgba(16, 113, 255, 1)",+ color: "#1071ff",backgroundColor: "rgba(16, 113, 255, 0.06)",},spreadsheet: {icon: Table01Icon,- color: "#388E3C",+ color: "#08c225",backgroundColor: "#E8F5E9",},default: itemTypeIconConfigs.file,@@ -70,7 +70,7 @@ const fileIconConfigs: Record<string, LockerIconConfig> = {export const createDocumentIconConfig: LockerIconConfig = {icon: FileUploadIcon,- color: "rgba(16, 113, 255, 1)",+ color: "#1071ff",backgroundColor: "rgba(16, 113, 255, 0.06)",};diff --git a/web/apps/locker/src/components/locker-tokens.ts b/web/apps/locker/src/components/locker-tokens.tsnew file mode 100644index 0000000000..5febd9130b--- /dev/null+++ b/web/apps/locker/src/components/locker-tokens.ts@@ -0,0 +1,42 @@+// Mirrors the Locker mobile design tokens in mobile/packages/ente_components/lib/theme/*.dart.+import type { Theme } from "@mui/material";++export const lockerColors = {+ backgroundBase: { light: "#f4f4f4", dark: "#161616" },+ fillLight: { light: "#ffffff", dark: "#212121" },+ fillDark: { light: "#eaeaea", dark: "#0a0a0a" },+ strokeFaint: { light: "#ebebeb", dark: "#2a2a2a" },+ textBase: { light: "#000000", dark: "#ffffff" },+ textLight: { light: "#666666", dark: "#999999" },+ textLighter: { light: "#969696", dark: "#969696" },+ iconColor: { light: "rgba(0, 0, 0, 0.75)", dark: "#ffffff" },+ primary: { light: "#1071ff", dark: "#1071ff" },+ primaryDark: { light: "#0e5fd9", dark: "#0e5fd9" },+ specialWhite: { light: "#ffffff", dark: "#ffffff" },+} as const;++export const lockerColorSx = (+ theme: Theme,+ colors: Partial<+ Record<+ "backgroundColor" | "color" | "borderColor",+ keyof typeof lockerColors+ >+ >,+) => {+ const darkValues: Record<string, string> = {};+ const lightValues: Record<string, string> = {};+ for (const [prop, role] of Object.entries(colors)) {+ darkValues[prop] = lockerColors[role].dark;+ lightValues[prop] = lockerColors[role].light;+ }+ return { ...darkValues, ...theme.applyStyles("light", lightValues) };+};++export const lockerContentMaxWidth = 700;++export const lockerTextBodySx = {+ fontSize: "14px",+ lineHeight: "20px",+ fontWeight: 500,+};diff --git a/web/apps/locker/src/pages/locker.tsx b/web/apps/locker/src/pages/locker.tsxindex c5b1cb670a..e6c880beb6 100644--- a/web/apps/locker/src/pages/locker.tsx+++ b/web/apps/locker/src/pages/locker.tsx@@ -3,6 +3,7 @@ import { ItemList } from "@/components/ItemList";import { LockerCollectionShareDrawer } from "@/components/LockerCollectionShareDrawer";import { LockerNavbar } from "@/components/LockerNavbar";import { LockerSidebar } from "@/components/LockerSidebar";+import { lockerColorSx } from "@/components/locker-tokens";import { DeleteCollectionDialog } from "@/components/lockerPage/DeleteCollectionDialog";import { LockerDragOverlay } from "@/components/lockerPage/LockerDragOverlay";import { useLockerActions } from "@/components/lockerPage/use-locker-actions";@@ -10,7 +11,8 @@ import { useLockerData } from "@/components/lockerPage/use-locker-data";import { useLockerNavigation } from "@/components/lockerPage/use-locker-navigation";import { useSetupLockerI18n } from "@/i18n/locker";import { fetchCollectionSharees } from "@/services/remote";-import AddIcon from "@mui/icons-material/Add";+import { PlusSignIcon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import { Box, Button, Fab, Snackbar, Stack, Typography } from "@mui/material";import { LoadingIndicator } from "ente-base/components/loaders";import { useBaseContext } from "ente-base/context";@@ -251,26 +253,32 @@ export const LockerPage: React.FC = () => {color="primary"aria-label={t("saveToLocker")}onClick={openCreateDialog}- sx={{+ sx={(theme) => ({position: "fixed",- right: "max(24px, env(safe-area-inset-right))",- bottom: "max(24px, env(safe-area-inset-bottom))",- width: 72,- height: 72,- minHeight: 72,- color: "#FFFFFF",- background:- "linear-gradient(135deg, #1071FF 0%, #0056CC 100%)",- boxShadow: "0 16px 40px rgba(0, 66, 173, 0.32)",+ right: "max(16px, env(safe-area-inset-right))",+ bottom: "max(16px, env(safe-area-inset-bottom))",+ width: 56,+ height: 56,+ minHeight: 56,+ ...lockerColorSx(theme, {+ color: "specialWhite",+ backgroundColor: "primary",+ }),+ boxShadow: "0px 8px 16px rgba(0, 0, 0, 0.08)",zIndex: 1200,"&:hover": {- background:- "linear-gradient(135deg, #1A7AFF 0%, #004DB8 100%)",- boxShadow: "0 18px 44px rgba(0, 66, 173, 0.36)",+ ...lockerColorSx(theme, {+ backgroundColor: "primaryDark",+ }),+ boxShadow: "0px 12px 24px rgba(0, 0, 0, 0.14)",},- }}+ })}>- <AddIcon sx={{ fontSize: 36 }} />+ <HugeiconsIcon+ icon={PlusSignIcon}+ size={24}+ strokeWidth={1.5}+ /></Fab>)}