π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Update list view
vishnukvmd152859d5d3b6
diff --git a/web/apps/locker/src/components/ItemCard.tsx b/web/apps/locker/src/components/ItemCard.tsxindex d21d3b5dcc..9a1c4dcbc9 100644--- a/web/apps/locker/src/components/ItemCard.tsx+++ b/web/apps/locker/src/components/ItemCard.tsx@@ -1,15 +1,12 @@+import { CircleArrowDownLeftIcon } from "@hugeicons/core-free-icons";+import { HugeiconsIcon } from "@hugeicons/react";import CheckCircleRoundedIcon from "@mui/icons-material/CheckCircleRounded";-import ContentCopyIcon from "@mui/icons-material/ContentCopy";import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";import EditOutlinedIcon from "@mui/icons-material/EditOutlined";-import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";-import LinkOutlinedIcon from "@mui/icons-material/LinkOutlined";import MoreVertIcon from "@mui/icons-material/MoreVert";import RadioButtonUncheckedRoundedIcon from "@mui/icons-material/RadioButtonUncheckedRounded";import RestoreIcon from "@mui/icons-material/Restore";import ShareOutlinedIcon from "@mui/icons-material/ShareOutlined";-import VisibilityIcon from "@mui/icons-material/Visibility";-import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";import {Box,ButtonBase,@@ -28,19 +25,18 @@ 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";+import type { GenericFileData, LockerItem } from "types";import { getItemTitle, hasDownloadableObject } from "types";interface ItemCardProps {item: LockerItem;/** The user's master key, needed for file downloads. */masterKey?: string;- secondaryText?: string;onClick: () => void;/** Whether this card is shown in the trash view. */isTrashView?: boolean;+ isIncomingShared?: boolean;/** Called when the user wants to edit this item. */onEdit?: (item: LockerItem) => void;/** Called when the user wants to delete (trash) this item. */@@ -52,7 +48,6 @@ interface ItemCardProps {/** Called when the user wants to restore this item from trash. */onRestore?: (item: LockerItem) => void;onShareLink?: (item: LockerItem) => void;- fileShareLink?: LockerFileShareLinkSummary;selectionMode?: boolean;selectable?: boolean;selected?: boolean;@@ -67,23 +62,21 @@ interface ItemCardProps {export const ItemCard: React.FC<ItemCardProps> = ({item,masterKey,- secondaryText,onClick,isTrashView,+ isIncomingShared,onEdit,onDelete,deleteDisabledHint,onPermanentlyDelete,onRestore,onShareLink,- fileShareLink,selectionMode,selectable,selected,onToggleSelection,onLongPressSelect,}) => {- const [copiedField, setCopiedField] = useState<string | null>(null);const [downloadError, setDownloadError] = useState(false);const [downloading, setDownloading] = useState(false);const [downloadProgress, setDownloadProgress] = useState<number | null>(@@ -92,13 +85,6 @@ export const ItemCard: React.FC<ItemCardProps> = ({const longPressTimerRef = React.useRef<number | null>(null);const longPressTriggeredRef = React.useRef(false);- const copyToClipboard = useCallback((value: string, fieldName: string) => {- void navigator.clipboard.writeText(value).then(() => {- setCopiedField(fieldName);- setDownloadError(false);- });- }, []);-const handleDownload = useCallback(async () => {if (!masterKey || downloading || !hasDownloadableObject(item)) return;setDownloading(true);@@ -128,10 +114,6 @@ export const ItemCard: React.FC<ItemCardProps> = ({const title = getItemTitle(item);const downloadable = hasDownloadableObject(item);- const isExpiredShareLink =- !!fileShareLink?.validTill &&- fileShareLink.validTill > 0 &&- fileShareLink.validTill < Date.now() * 1000;const clearLongPress = useCallback(() => {if (longPressTimerRef.current !== null) {window.clearTimeout(longPressTimerRef.current);@@ -201,25 +183,39 @@ export const ItemCard: React.FC<ItemCardProps> = ({}return;}+ if (+ !isTrashView &&+ item.type === "file" &&+ masterKey &&+ downloadable+ ) {+ void handleDownload();+ return;+ }onClick();}}sx={(theme) => ({display: "flex",width: "100%",textAlign: "left",- borderRadius: "14px",+ borderRadius: "18px",overflow: "hidden",px: 1.5,py: 1.25,- gap: 1.5,+ gap: 1.25,alignItems: "center",backgroundColor: theme.vars.palette.fill.faint,- mb: 0.75,transition: "background-color 0.15s",opacity: selectionMode && !selectable ? 0.58 : 1,"&:hover": {backgroundColor: theme.vars.palette.fill.faintHover,},+ ...theme.applyStyles("light", {+ backgroundColor: "#FFFFFF",+ "&:hover": {+ backgroundColor: "#FFFFFF",+ },+ }),})}>{selectionMode && (@@ -248,179 +244,121 @@ export const ItemCard: React.FC<ItemCardProps> = ({{/* Type icon β colored per type in rounded square */}<Boxsx={{- display: "flex",- alignItems: "center",- justifyContent: "center",- width: 40,- height: 40,- borderRadius: "10px",- backgroundColor: iconBgColor(item),+ position: "relative",+ width: 52,+ height: 52,flexShrink: 0,}}>- {itemIcon(item)}+ <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>+ {isIncomingShared && !selectionMode && (+ <Box+ sx={(theme) => ({+ position: "absolute",+ right: 1,+ bottom: 6,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",+ width: 18,+ height: 18,+ borderRadius: "50%",+ backgroundColor:+ theme.vars.palette.fill.faint,+ p: "1px",+ zIndex: 2,+ })}+ >+ <HugeiconsIcon+ icon={CircleArrowDownLeftIcon}+ size={16}+ strokeWidth={2}+ color="rgba(16, 113, 255, 1)"+ style={{ zIndex: 3 }}+ />+ </Box>+ )}</Box>- {/* Title */}<Box sx={{ flex: 1, minWidth: 0 }}><Typographyvariant="body"- sx={{ fontWeight: "medium", lineHeight: 1.4 }}+ sx={{ fontWeight: "regular", lineHeight: 1.45 }}noWrap>{title}</Typography>- {secondaryText && (- <Typography- variant="small"- sx={{- color: "text.muted",- display: "block",- mt: 0.25,- }}- noWrap- >- {secondaryText}- </Typography>- )}</Box>- {/* Quick actions */}{selectionMode ? null : isTrashView ? (<TrashActionsitem={item}onRestore={onRestore}onPermanentlyDelete={onPermanentlyDelete}/>- ) : item.type === "accountCredential" ? (- <Stack- direction="row"- sx={{ gap: 0, alignItems: "center" }}- data-no-long-press="true"- onClick={(e) => e.stopPropagation()}- >- <CredentialActions- data={item.data as AccountCredentialData}- onCopy={copyToClipboard}- />- <ItemOverflowMenu- item={item}- masterKey={masterKey}- onEdit={onEdit}- onDelete={onDelete}- deleteDisabledHint={deleteDisabledHint}- onDownload={handleDownload}- onShareLink={onShareLink}- downloading={downloading}- />- </Stack>- ) : item.type === "file" && masterKey && downloadable ? (+ ) : (<Stackdirection="row"- sx={{ gap: 0, alignItems: "center" }}+ sx={{ gap: 1, alignItems: "center", flexShrink: 0 }}data-no-long-press="true"onClick={(e) => e.stopPropagation()}>- {fileShareLink && onShareLink && (- <Tooltip- title={shareLinkTooltipLabel(fileShareLink)}- >- <IconButton- size="small"- onClick={() => onShareLink(item)}- sx={{- color: isExpiredShareLink- ? "warning.main"- : "primary.main",- }}- >- <LinkOutlinedIcon sx={{ fontSize: 18 }} />- </IconButton>- </Tooltip>- )}- <Tooltip title={t("download")}>- <IconButton- size="small"- onClick={() => void handleDownload()}+ {item.type === "file" && downloading && (+ <Boxsx={{- color: downloading- ? "primary.main"- : "text.faint",+ width: 24,+ height: 24,+ display: "flex",+ alignItems: "center",+ justifyContent: "center",}}- disabled={downloading}>- {downloading && downloadProgress !== null ? (- <Box- sx={{- position: "relative",- display: "inline-flex",- alignItems: "center",- justifyContent: "center",- }}- >- <CircularProgress- variant="determinate"- value={downloadProgress}- size={20}- thickness={5}- />- </Box>- ) : (- <FileDownloadOutlinedIcon- sx={{ fontSize: 20 }}- />- )}- </IconButton>- </Tooltip>- {downloading && downloadProgress !== null && (- <Typography- variant="mini"- sx={{ color: "text.faint", minWidth: 34 }}- >- {downloadProgress}%- </Typography>+ <CircularProgress+ variant={+ downloadProgress !== null+ ? "determinate"+ : "indeterminate"+ }+ value={downloadProgress ?? undefined}+ sx={(theme) => ({+ color: theme.vars.palette.primary.main,+ })}+ size={20}+ thickness={5}+ />+ </Box>)}<ItemOverflowMenuitem={item}- masterKey={masterKey}onEdit={onEdit}onDelete={onDelete}deleteDisabledHint={deleteDisabledHint}- onDownload={handleDownload}onShareLink={onShareLink}- downloading={downloading}/></Stack>- ) : (- <Box- sx={{ flexShrink: 0 }}- data-no-long-press="true"- onClick={(e) => e.stopPropagation()}- >- <ItemOverflowMenu- item={item}- masterKey={masterKey}- onEdit={onEdit}- onDelete={onDelete}- deleteDisabledHint={deleteDisabledHint}- onDownload={handleDownload}- onShareLink={onShareLink}- downloading={downloading}- />- </Box>)}</ButtonBase><Snackbar- open={copiedField !== null || downloadError}- message={- downloadError- ? t("downloadFailed")- : t("copiedToClipboard", { fieldName: copiedField })- }+ open={downloadError}+ message={t("downloadFailed")}autoHideDuration={2000}onClose={() => {- setCopiedField(null);setDownloadError(false);}}/>@@ -428,48 +366,16 @@ export const ItemCard: React.FC<ItemCardProps> = ({);};-const formatShareLinkDate = (timestamp: number) =>- new Intl.DateTimeFormat(undefined, { dateStyle: "medium" }).format(- new Date(timestamp / 1000),- );--const shareLinkTooltipLabel = (fileShareLink: LockerFileShareLinkSummary) => {- const parts = [- fileShareLink.validTill &&- fileShareLink.validTill > 0 &&- fileShareLink.validTill < Date.now() * 1000- ? t("shareLinkExpiredHint")- : t("shareLinkActiveHint"),- ];-- if (fileShareLink.validTill && fileShareLink.validTill > 0) {- parts.push(- t("shareLinkExpiresOn", {- date: formatShareLinkDate(fileShareLink.validTill),- }),- );- }-- if (!fileShareLink.enableDownload) {- parts.push(t("shareLinkDownloadDisabledHint"));- }-- return parts.join(" β’ ");-};-// ---------------------------------------------------------------------------// Overflow menu for item actions// ---------------------------------------------------------------------------const ItemOverflowMenu: React.FC<{item: LockerItem;- masterKey?: string;onEdit?: (item: LockerItem) => void;onDelete?: (item: LockerItem) => void;deleteDisabledHint?: string;- onDownload: () => Promise<void>;onShareLink?: (item: LockerItem) => void;- downloading: boolean;}> = ({ item, onEdit, onDelete, deleteDisabledHint, onShareLink }) => (<OverflowMenuariaID={`item-menu-${item.id}`}@@ -554,41 +460,6 @@ const TrashActions: React.FC<{</Stack>);-/** Inline credential quick-actions (password show/copy). */-const CredentialActions: React.FC<{- data: AccountCredentialData;- onCopy: (value: string, field: string) => void;-}> = ({ data, onCopy }) => {- const [showPassword, setShowPassword] = useState(false);-- return (- <Stack direction="row" sx={{ gap: 0.25, flexShrink: 0 }}>- <Tooltip- title={showPassword ? t("hidePassword") : t("showPassword")}- >- <IconButton- size="small"- onClick={() => setShowPassword(!showPassword)}- >- {showPassword ? (- <VisibilityOffIcon sx={{ fontSize: 18 }} />- ) : (- <VisibilityIcon sx={{ fontSize: 18 }} />- )}- </IconButton>- </Tooltip>- <Tooltip title={t("copyPassword")}>- <IconButton- size="small"- onClick={() => onCopy(data.password, t("password"))}- >- <ContentCopyIcon sx={{ fontSize: 16 }} />- </IconButton>- </Tooltip>- </Stack>- );-};-/*** Background color for the icon square, per item type.*/@@ -606,7 +477,7 @@ const itemIcon = (item: LockerItem) => {item.type === "file"? (item.data as GenericFileData).name: undefined,- size: 20,+ size: item.type === "file" ? 24 : 20,strokeWidth: 1.9,});};diff --git a/web/apps/locker/src/components/ItemList.tsx b/web/apps/locker/src/components/ItemList.tsxindex 67df04fc21..cb45d283fe 100644--- a/web/apps/locker/src/components/ItemList.tsx+++ b/web/apps/locker/src/components/ItemList.tsx@@ -31,7 +31,6 @@ import {OverflowMenuOption,} from "ente-base/components/OverflowMenu";import { isHTTPErrorWithStatus } from "ente-base/http";-import { formattedDate } from "ente-base/i18n-date";import log from "ente-base/log";import { t } from "i18next";import React, { useCallback, useMemo, useState } from "react";@@ -76,7 +75,7 @@ interface ItemListProps {onShareCollection?: (collection: LockerCollection) => void;}-const contentMaxWidth = 620;+const contentMaxWidth = 560;export const ItemList: React.FC<ItemListProps> = ({collections,@@ -352,39 +351,6 @@ export const ItemList: React.FC<ItemListProps> = ({onShareCollection(selectedCollection);}}, [onShareCollection, selectedCollection]);- const itemTypeLabel = useCallback((item: LockerItem) => {- switch (item.type) {- case "note":- return t("personalNote");- case "accountCredential":- return t("secret");- case "physicalRecord":- return t("thing");- case "emergencyContact":- return t("emergencyContact");- case "file":- return t("document");- }- }, []);- const getItemSecondaryText = useCallback(- (item: LockerItem) => {- const parts = [itemTypeLabel(item)];- const isSharedWithUser =- (item.ownerID ?? currentUserID) !== currentUserID;- if (isSharedWithUser) {- parts.push(t("sharedWithYou"));- }- if (item.updatedAt ?? item.createdAt) {- parts.push(- formattedDate(- new Date((item.updatedAt ?? item.createdAt!) / 1000),- ),- );- }- return parts.join(" β’ ");- },- [currentUserID, itemTypeLabel],- );const toggleHomeCollection = useCallback((collectionID: number) => {setHomeSelectedCollectionIDs((current) =>current.includes(collectionID)@@ -646,13 +612,16 @@ export const ItemList: React.FC<ItemListProps> = ({sx={{ flex: 1, minHeight: 0, overflow: "hidden", height: "100%" }}><Box- sx={{+ sx={(theme) => ({flex: 1,minHeight: 0,overflowY: "auto",overscrollBehavior: "contain",WebkitOverflowScrolling: "touch",- }}+ ...theme.applyStyles("light", {+ backgroundColor: "#F3F4F6",+ }),+ })}><Boxsx={{@@ -689,8 +658,12 @@ export const ItemList: React.FC<ItemListProps> = ({}}sx={{"& .MuiOutlinedInput-root": {+ minHeight: 48,borderRadius: "24px",backgroundColor: "background.paper",+ "& .MuiOutlinedInput-input": {+ py: 1.5,+ },"& fieldset": {borderColor: "transparent",},@@ -707,12 +680,15 @@ export const ItemList: React.FC<ItemListProps> = ({</Box><Box- sx={{+ sx={(theme) => ({px: { xs: 2, sm: 3 },pb: isTrashView? 3: "calc(env(safe-area-inset-bottom) + 120px)",- }}+ ...theme.applyStyles("light", {+ backgroundColor: "#F3F4F6",+ }),+ })}>{isHomeView && (<>@@ -752,7 +728,7 @@ export const ItemList: React.FC<ItemListProps> = ({onClick={clearHomeCollectionSelection}- sx={{+ sx={(theme) => ({width: 32,height: 32,color: "text.muted",@@ -763,7 +739,19 @@ export const ItemList: React.FC<ItemListProps> = ({backgroundColor:"rgba(255, 255, 255, 0.065)",},- }}+ ...theme.applyStyles(+ "light",+ {+ border: "1px solid rgba(17, 24, 39, 0.08)",+ backgroundColor:+ "#FFFFFF",+ "&:hover": {+ backgroundColor:+ "#FFFFFF",+ },+ },+ ),+ })}><ClearRoundedIconsx={{ fontSize: 18 }}@@ -785,11 +773,9 @@ export const ItemList: React.FC<ItemListProps> = ({setRestoreItem(item);setRestoreCollectionID(null);}}- getSecondaryText={getItemSecondaryText}onSelectItem={setSelectedItem}currentUserID={currentUserID}onShareLink={openFileLinkDialog}- fileShareLinksByFileID={knownFileShareLinksByID}selectionMode={selectionMode}selectedItemIDSet={selectedItemIDSet}onToggleItemSelection={toggleItemSelection}@@ -935,11 +921,9 @@ export const ItemList: React.FC<ItemListProps> = ({setRestoreItem(item);setRestoreCollectionID(null);}}- getSecondaryText={getItemSecondaryText}onSelectItem={setSelectedItem}currentUserID={currentUserID}onShareLink={openFileLinkDialog}- fileShareLinksByFileID={knownFileShareLinksByID}selectionMode={selectionMode}selectedItemIDSet={selectedItemIDSet}onToggleItemSelection={toggleItemSelection}@@ -1054,13 +1038,11 @@ export const ItemList: React.FC<ItemListProps> = ({setRestoreItem(item);setRestoreCollectionID(null);}}- getSecondaryText={getItemSecondaryText}onSelectItem={setSelectedItem}currentUserID={currentUserID}onShareLink={isTrashView ? undefined : openFileLinkDialog}- fileShareLinksByFileID={knownFileShareLinksByID}selectionMode={selectionMode}selectedItemIDSet={selectedItemIDSet}onToggleItemSelection={toggleItemSelection}@@ -1362,11 +1344,9 @@ const ItemsSection: React.FC<{onDeleteItem?: (item: LockerItem) => void;onPermanentlyDelete?: (items: LockerItem[]) => void;onRequestRestore: (item: LockerItem) => void;- getSecondaryText: (item: LockerItem) => string;onSelectItem: (item: LockerItem) => void;currentUserID: number;onShareLink?: (item: LockerItem) => void;- fileShareLinksByFileID: Map<number, LockerFileShareLinkSummary>;selectionMode?: boolean;selectedItemIDSet?: Set<number>;onToggleItemSelection?: (item: LockerItem) => void;@@ -1380,11 +1360,9 @@ const ItemsSection: React.FC<{onDeleteItem,onPermanentlyDelete,onRequestRestore,- getSecondaryText,onSelectItem,currentUserID,onShareLink,- fileShareLinksByFileID,selectionMode,selectedItemIDSet,onToggleItemSelection,@@ -1393,7 +1371,7 @@ const ItemsSection: React.FC<{}) =>items.length > 0 ? (<Stack- sx={{ maxWidth: contentMaxWidth, mx: "auto", gap: 0, mt: 1 }}+ sx={{ maxWidth: contentMaxWidth, mx: "auto", gap: 1.1, mt: 1.25 }}>{items.map((item) => {const isOwnedByCurrentUser =@@ -1404,7 +1382,9 @@ const ItemsSection: React.FC<{item={item}masterKey={masterKey}isTrashView={isTrashView}- secondaryText={getSecondaryText(item)}+ isIncomingShared={+ (item.ownerID ?? currentUserID) !== currentUserID+ }onClick={() => onSelectItem(item)}onEdit={onEditItem && isOwnedByCurrentUser@@ -1437,7 +1417,6 @@ const ItemsSection: React.FC<{? onShareLink: undefined}- fileShareLink={fileShareLinksByFileID.get(item.id)}selectionMode={selectionMode}selectableselected={selectedItemIDSet?.has(item.id)}@@ -1735,6 +1714,13 @@ const CollectionChipFilters: React.FC<{backgroundColor:theme.vars.palette.fill.faintHover,},+ ...theme.applyStyles("light", {+ backgroundColor: "#FFFFFF",+ border: "1px solid rgba(17, 24, 39, 0.06)",+ "&:hover": {+ backgroundColor: "#FFFFFF",+ },+ }),})}/>);diff --git a/web/apps/locker/src/components/LockerNavbar.tsx b/web/apps/locker/src/components/LockerNavbar.tsxindex b3307643a2..0fbbbeb466 100644--- a/web/apps/locker/src/components/LockerNavbar.tsx+++ b/web/apps/locker/src/components/LockerNavbar.tsx@@ -4,7 +4,7 @@ import WarningAmberRoundedIcon from "@mui/icons-material/WarningAmberRounded";import { Box, IconButton, Stack, Typography } from "@mui/material";import React from "react";-const contentMaxWidth = 620;+const contentMaxWidth = 560;interface LockerNavbarProps {/** Called when the user taps the hamburger menu icon. */@@ -108,7 +108,7 @@ export const LockerNavbar: React.FC<LockerNavbarProps> = ({variant="small"sx={{ color: "#3B2500", lineHeight: 1.4, fontWeight: 700 }}>- The web version of Locker is unstable+ You are using an unstable version of Locker.</Typography></Stack></Box>