Skip to content

armgit / ente

Public Imported from GitHub
0

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

update(locker):trash-page-updated

Aswin Asok27c6729af024
diff --git a/web/apps/locker/public/images/collection_delete_icon.png b/web/apps/locker/public/images/collection_delete_icon.png
new file mode 100644
index 0000000000..3dc70133b7
Binary files /dev/null and b/web/apps/locker/public/images/collection_delete_icon.png differ
diff --git a/web/apps/locker/public/images/[email protected] b/web/apps/locker/public/images/[email protected]
new file mode 100644
index 0000000000..6163bfad4a
Binary files /dev/null and b/web/apps/locker/public/images/[email protected] differ
diff --git a/web/apps/locker/public/images/[email protected] b/web/apps/locker/public/images/[email protected]
new file mode 100644
index 0000000000..41c6c52c91
Binary files /dev/null and b/web/apps/locker/public/images/[email protected] differ
diff --git a/web/apps/locker/public/images/empty_state.png b/web/apps/locker/public/images/empty_state.png
new file mode 100644
index 0000000000..fbd0d32c5b
Binary files /dev/null and b/web/apps/locker/public/images/empty_state.png differ
diff --git a/web/apps/locker/public/images/[email protected] b/web/apps/locker/public/images/[email protected]
new file mode 100644
index 0000000000..3d023dc649
Binary files /dev/null and b/web/apps/locker/public/images/[email protected] differ
diff --git a/web/apps/locker/public/images/[email protected] b/web/apps/locker/public/images/[email protected]
new file mode 100644
index 0000000000..eae2656859
Binary files /dev/null and b/web/apps/locker/public/images/[email protected] differ
diff --git a/web/apps/locker/src/components/ItemCard.tsx b/web/apps/locker/src/components/ItemCard.tsx
index 15523fb526..bf5a4a301f 100644
--- a/web/apps/locker/src/components/ItemCard.tsx
+++ b/web/apps/locker/src/components/ItemCard.tsx
@@ -2,14 +2,17 @@ import { lockerItemIcon } from "@/components/locker-item-icons";
import { downloadLockerFile } from "@/services/remote";
import type { GenericFileData, LockerItem } from "@/types";
import { getItemTitle, hasDownloadableObject } from "@/types";
-import { CircleArrowDownLeftIcon } from "@hugeicons/core-free-icons";
+import {
+ ArrowReloadHorizontalIcon,
+ CircleArrowDownLeftIcon,
+ Delete02Icon,
+} from "@hugeicons/core-free-icons";
import { HugeiconsIcon } from "@hugeicons/react";
import CheckCircleRoundedIcon from "@mui/icons-material/CheckCircleRounded";
import DeleteOutlinedIcon from "@mui/icons-material/DeleteOutlined";
import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
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 {
Box,
@@ -25,10 +28,16 @@ import {
OverflowMenu,
OverflowMenuOption,
} from "ente-base/components/OverflowMenu";
+import { formatTimeAgo } from "ente-base/date";
import log from "ente-base/log";
import { t } from "i18next";
import React, { useCallback, useState } from "react";
-import { lockerColors, lockerColorSx, lockerTextBodySx } from "./locker-tokens";
+import {
+ lockerColors,
+ lockerColorSx,
+ lockerTextBodySx,
+ lockerTextMiniSx,
+} from "./locker-tokens";
interface ItemCardProps {
item: LockerItem;
@@ -261,6 +270,20 @@ export const ItemCard: React.FC<ItemCardProps> = React.memo(function ItemCard({
<Typography variant="body" sx={lockerTextBodySx} noWrap>
{title}
</Typography>
+ {isTrashView && item.updatedAt !== undefined && (
+ <Typography
+ sx={(theme) => ({
+ ...lockerTextMiniSx,
+ ...lockerColorSx(theme, { color: "textLight" }),
+ mt: 0.5,
+ })}
+ noWrap
+ >
+ {t("deletedTimeAgo", {
+ time: formatTimeAgo(item.updatedAt),
+ })}
+ </Typography>
+ )}
</Box>
{selectionMode ? null : isTrashView ? (
@@ -397,9 +420,13 @@ const TrashActions: React.FC<{
<IconButton
size="small"
onClick={() => onRestore(item)}
- sx={{ color: "text.faint" }}
+ sx={(theme) => lockerColorSx(theme, { color: "iconColor" })}
>
- <RestoreIcon sx={{ fontSize: 20 }} />
+ <HugeiconsIcon
+ icon={ArrowReloadHorizontalIcon}
+ size={18}
+ strokeWidth={1.5}
+ />
</IconButton>
</Tooltip>
)}
@@ -408,9 +435,13 @@ const TrashActions: React.FC<{
<IconButton
size="small"
onClick={() => onPermanentlyDelete([item])}
- sx={{ color: "critical.main" }}
+ sx={(theme) => lockerColorSx(theme, { color: "warning" })}
>
- <DeleteOutlinedIcon sx={{ fontSize: 20 }} />
+ <HugeiconsIcon
+ icon={Delete02Icon}
+ size={18}
+ strokeWidth={1.5}
+ />
</IconButton>
</Tooltip>
)}
diff --git a/web/apps/locker/src/components/ItemList.tsx b/web/apps/locker/src/components/ItemList.tsx
index 7bd6a0ec53..32226e7525 100644
--- a/web/apps/locker/src/components/ItemList.tsx
+++ b/web/apps/locker/src/components/ItemList.tsx
@@ -17,6 +17,8 @@ import {
sortLockerCollections,
visibleLockerCollections,
} from "@/types";
+import { Delete02Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
import AddOutlinedIcon from "@mui/icons-material/AddOutlined";
import ArrowBackRoundedIcon from "@mui/icons-material/ArrowBackRounded";
import CheckCircleRoundedIcon from "@mui/icons-material/CheckCircleRounded";
@@ -24,7 +26,6 @@ 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";
-import DeleteSweepOutlinedIcon from "@mui/icons-material/DeleteSweepOutlined";
import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
import FilterListRoundedIcon from "@mui/icons-material/FilterListRounded";
@@ -64,6 +65,9 @@ import {
lockerColorSx,
lockerContentMaxWidth,
lockerTextBodySx,
+ lockerTextDisplay2Sx,
+ lockerTextLargeSx,
+ lockerTextMiniSx,
} from "./locker-tokens";
const uniqueCollectionsByID = (collections: LockerCollection[]) => {
@@ -1078,9 +1082,13 @@ export const ItemList: React.FC<ItemListProps> = ({
: (selectedCollection?.name ??
t("allItems"))
}
- countLabel={t("lockerItemsCount", {
- count: sortedItems.length,
- })}
+ countLabel={
+ isTrashView && sortedItems.length === 0
+ ? undefined
+ : t("lockerItemsCount", {
+ count: sortedItems.length,
+ })
+ }
onBack={onNavigateBack}
action={
<Stack
@@ -1090,15 +1098,46 @@ export const ItemList: React.FC<ItemListProps> = ({
{isTrashView &&
sortedItems.length > 0 &&
onEmptyTrash && (
- <Button
- color="critical"
- startIcon={
- <DeleteSweepOutlinedIcon />
- }
- onClick={onEmptyTrash}
+ <Tooltip
+ title={t("empty_trash")}
>
- {t("empty_trash")}
- </Button>
+ <IconButton
+ aria-label={t(
+ "empty_trash",
+ )}
+ onClick={onEmptyTrash}
+ sx={(theme) => ({
+ width: 36,
+ height: 36,
+ borderRadius:
+ "12px",
+ padding: 0,
+ ...lockerColorSx(
+ theme,
+ {
+ backgroundColor:
+ "fillLight",
+ color: "warning",
+ },
+ ),
+ "&:hover": {
+ ...lockerColorSx(
+ theme,
+ {
+ backgroundColor:
+ "fillDark",
+ },
+ ),
+ },
+ })}
+ >
+ <HugeiconsIcon
+ icon={Delete02Icon}
+ size={18}
+ strokeWidth={1.5}
+ />
+ </IconButton>
+ </Tooltip>
)}
{selectedCollection &&
canShareSelectedCollection &&
@@ -1193,8 +1232,11 @@ export const ItemList: React.FC<ItemListProps> = ({
emptyState={
isTrashView ? (
<EmptyState
- title={t("trashIsEmpty")}
- subtitle={t("yourTrashIsEmpty")}
+ image={{
+ src: "/images/empty_state.png",
+ srcSet: "/images/[email protected] 2x, /images/[email protected] 3x",
+ }}
+ title={t("yourTrashIsEmpty")}
/>
) : (
<EmptyState
@@ -1353,46 +1395,83 @@ export const ItemList: React.FC<ItemListProps> = ({
const SectionHeader: React.FC<{
title: string;
- countLabel: string;
+ countLabel?: string;
action?: React.ReactNode;
onBack?: () => void;
-}> = ({ title, countLabel, action, onBack }) => (
- <Stack
- direction="row"
- sx={{
- alignItems: "center",
- justifyContent: "space-between",
- gap: 2,
- maxWidth: lockerContentMaxWidth,
- mx: "auto",
- mt: 1,
- mb: 2.25,
- }}
- >
+}> = ({ title, countLabel, action, onBack }) =>
+ onBack ? (
+ <Stack
+ sx={{
+ gap: 2,
+ maxWidth: lockerContentMaxWidth,
+ mx: "auto",
+ mt: 1,
+ mb: 2.25,
+ }}
+ >
+ <IconButton
+ aria-label="Back"
+ onClick={onBack}
+ sx={(theme) => ({
+ alignSelf: "flex-start",
+ width: 36,
+ height: 36,
+ flexShrink: 0,
+ borderRadius: "12px",
+ padding: 0,
+ ...lockerColorSx(theme, {
+ color: "iconColor",
+ backgroundColor: "fillLight",
+ }),
+ "&:hover": {
+ ...lockerColorSx(theme, {
+ backgroundColor: "fillDark",
+ }),
+ },
+ })}
+ >
+ <ArrowBackRoundedIcon sx={{ fontSize: 18 }} />
+ </IconButton>
+ <Stack
+ direction="row"
+ sx={{
+ alignItems: "center",
+ justifyContent: "space-between",
+ gap: 2,
+ }}
+ >
+ <Box sx={{ minWidth: 0 }}>
+ <Typography sx={{ ...lockerTextDisplay2Sx, minWidth: 0 }}>
+ {title}
+ </Typography>
+ {countLabel && (
+ <Typography
+ sx={(theme) => ({
+ ...lockerTextMiniSx,
+ mt: 1,
+ ...lockerColorSx(theme, { color: "textLight" }),
+ })}
+ >
+ {countLabel}
+ </Typography>
+ )}
+ </Box>
+ {action}
+ </Stack>
+ </Stack>
+ ) : (
<Stack
direction="row"
- sx={{ minWidth: 0, gap: 1.5, alignItems: "center" }}
+ sx={{
+ alignItems: "center",
+ justifyContent: "space-between",
+ gap: 2,
+ maxWidth: lockerContentMaxWidth,
+ mx: "auto",
+ mt: 1,
+ mb: 2.25,
+ }}
>
- {onBack && (
- <IconButton
- aria-label="Back"
- onClick={onBack}
- sx={{
- alignSelf: "center",
- width: 44,
- height: 44,
- flexShrink: 0,
- color: "text.secondary",
- border: "1px solid rgba(255, 255, 255, 0.10)",
- backgroundColor: "rgba(255, 255, 255, 0.03)",
- "&:hover": {
- backgroundColor: "rgba(255, 255, 255, 0.08)",
- },
- }}
- >
- <ArrowBackRoundedIcon sx={{ fontSize: 20 }} />
- </IconButton>
- )}
<Box sx={{ minWidth: 0 }}>
<Typography
variant="h3"
@@ -1400,14 +1479,18 @@ const SectionHeader: React.FC<{
>
{title}
</Typography>
- <Typography variant="small" sx={{ color: "text.muted", mt: 1 }}>
- {countLabel}
- </Typography>
+ {countLabel && (
+ <Typography
+ variant="small"
+ sx={{ color: "text.muted", mt: 1 }}
+ >
+ {countLabel}
+ </Typography>
+ )}
</Box>
+ {action}
</Stack>
- {action}
- </Stack>
-);
+ );
const ItemsSection: React.FC<{
items: LockerItem[];
@@ -1969,17 +2052,39 @@ const CollectionFilterChip: React.FC<{
</Tooltip>
);
-const EmptyState: React.FC<{ title: string; subtitle: string }> = ({
- title,
- subtitle,
-}) => (
+const EmptyState: React.FC<{
+ title: string;
+ subtitle?: string;
+ image?: { src: string; srcSet?: string; alt?: string };
+}> = ({ title, subtitle, image }) => (
<Box sx={{ textAlign: "center", py: 8 }}>
- <Typography variant="h4" sx={{ mb: 0.5 }}>
- {title}
- </Typography>
- <Typography variant="body" sx={{ color: "text.muted" }}>
- {subtitle}
- </Typography>
+ {image && (
+ <img
+ src={image.src}
+ srcSet={image.srcSet}
+ alt={image.alt ?? ""}
+ style={{
+ height: 112,
+ width: "auto",
+ display: "block",
+ margin: "0 auto",
+ }}
+ />
+ )}
+ {image ? (
+ <Typography sx={{ ...lockerTextLargeSx, mt: 2.5, mb: 0.5 }}>
+ {title}
+ </Typography>
+ ) : (
+ <Typography variant="h4" sx={{ mb: 0.5 }}>
+ {title}
+ </Typography>
+ )}
+ {subtitle && (
+ <Typography variant="body" sx={{ color: "text.muted" }}>
+ {subtitle}
+ </Typography>
+ )}
</Box>
);
diff --git a/web/apps/locker/src/components/locker-tokens.ts b/web/apps/locker/src/components/locker-tokens.ts
index 5febd9130b..11e078ece5 100644
--- a/web/apps/locker/src/components/locker-tokens.ts
+++ b/web/apps/locker/src/components/locker-tokens.ts
@@ -12,6 +12,8 @@ export const lockerColors = {
iconColor: { light: "rgba(0, 0, 0, 0.75)", dark: "#ffffff" },
primary: { light: "#1071ff", dark: "#1071ff" },
primaryDark: { light: "#0e5fd9", dark: "#0e5fd9" },
+ warning: { light: "#f63a3a", dark: "#f63a3a" },
+ warningDark: { light: "#dd3434", dark: "#dd3434" },
specialWhite: { light: "#ffffff", dark: "#ffffff" },
} as const;
@@ -40,3 +42,34 @@ export const lockerTextBodySx = {
lineHeight: "20px",
fontWeight: 500,
};
+
+// Mirrors the Locker design-system text styles.
+export const lockerTextDisplay2Sx = {
+ fontSize: "24px",
+ lineHeight: "32px",
+ fontWeight: 600,
+};
+
+export const lockerTextH2Sx = {
+ fontSize: "18px",
+ lineHeight: "24px",
+ fontWeight: 600,
+};
+
+export const lockerTextLargeSx = {
+ fontSize: "16px",
+ lineHeight: "20px",
+ fontWeight: 600,
+};
+
+export const lockerTextBodyBoldSx = {
+ fontSize: "14px",
+ lineHeight: "20px",
+ fontWeight: 600,
+};
+
+export const lockerTextMiniSx = {
+ fontSize: "12px",
+ lineHeight: "16px",
+ fontWeight: 500,
+};
diff --git a/web/apps/locker/src/components/lockerPage/EmptyTrashDialog.tsx b/web/apps/locker/src/components/lockerPage/EmptyTrashDialog.tsx
new file mode 100644
index 0000000000..19f199f10e
--- /dev/null
+++ b/web/apps/locker/src/components/lockerPage/EmptyTrashDialog.tsx
@@ -0,0 +1,160 @@
+import { lockerDialogPaperSx } from "@/components/locker-dialog-styles";
+import {
+ lockerColorSx,
+ lockerTextBodyBoldSx,
+ lockerTextBodySx,
+ lockerTextH2Sx,
+ lockerTextMiniSx,
+} from "@/components/locker-tokens";
+import { Cancel01Icon } from "@hugeicons/core-free-icons";
+import { HugeiconsIcon } from "@hugeicons/react";
+import { Box, Dialog, IconButton, Stack, Typography } from "@mui/material";
+import { LoadingButton } from "ente-base/components/mui/LoadingButton";
+import { t } from "i18next";
+
+export interface EmptyTrashDialogState {
+ loading: boolean;
+ error?: string;
+}
+
+interface EmptyTrashDialogProps {
+ dialogState: EmptyTrashDialogState | null;
+ visibleDialogState: EmptyTrashDialogState | null;
+ onClose: () => void;
+ onConfirm: () => Promise<void> | void;
+}
+
+export function EmptyTrashDialog({
+ dialogState,
+ visibleDialogState,
+ onClose,
+ onConfirm,
+}: EmptyTrashDialogProps) {
+ const handleClose = () => {
+ if (!dialogState?.loading) {
+ onClose();
+ }
+ };
+
+ return (
+ <Dialog
+ open={dialogState !== null}
+ onClose={handleClose}
+ fullWidth
+ maxWidth="xs"
+ slotProps={{
+ paper: {
+ sx: (theme) => ({
+ ...lockerDialogPaperSx,
+ borderRadius: "24px",
+ width: "min(100%, 440px)",
+ padding: "20px",
+ ...lockerColorSx(theme, {
+ backgroundColor: "backgroundBase",
+ }),
+ }),
+ },
+ }}
+ >
+ <Stack>
+ <Box sx={{ display: "flex", justifyContent: "flex-end" }}>
+ <IconButton
+ aria-label={t("cancel")}
+ onClick={handleClose}
+ disabled={visibleDialogState?.loading}
+ sx={(theme) => ({
+ width: 36,
+ height: 36,
+ borderRadius: "50%",
+ padding: 0,
+ ...lockerColorSx(theme, {
+ backgroundColor: "fillLight",
+ color: "iconColor",
+ }),
+ "&:hover": {
+ ...lockerColorSx(theme, {
+ backgroundColor: "fillDark",
+ }),
+ },
+ })}
+ >
+ <HugeiconsIcon
+ icon={Cancel01Icon}
+ size={18}
+ strokeWidth={1.5}
+ />
+ </IconButton>
+ </Box>
+ <img
+ src="/images/collection_delete_icon.png"
+ srcSet="/images/[email protected] 2x, /images/[email protected] 3x"
+ alt=""
+ style={{
+ width: 120,
+ height: 120,
+ objectFit: "contain",
+ display: "block",
+ margin: "4px auto 0",
+ }}
+ />
+ <Typography
+ sx={{ ...lockerTextH2Sx, textAlign: "center", mt: 2.5 }}
+ >
+ {t("empty_trash_title")}
+ </Typography>
+ <Typography
+ sx={(theme) => ({
+ ...lockerTextBodySx,
+ textAlign: "center",
+ mt: 1.5,
+ ...lockerColorSx(theme, { color: "textLight" }),
+ })}
+ >
+ {t("empty_trash_message")}
+ </Typography>
+ {visibleDialogState?.error && (
+ <Typography
+ sx={(theme) => ({
+ ...lockerTextMiniSx,
+ textAlign: "center",
+ mt: 1.5,
+ ...lockerColorSx(theme, { color: "warning" }),
+ })}
+ >
+ {visibleDialogState.error}
+ </Typography>
+ )}
+ <LoadingButton
+ fullWidth
+ color="critical"
+ loading={visibleDialogState?.loading}
+ onClick={onConfirm}
+ sx={(theme) => ({
+ ...lockerTextBodyBoldSx,
+ mt: 3,
+ minHeight: 52,
+ borderRadius: "20px",
+ textTransform: "none",
+ ...lockerColorSx(theme, {
+ backgroundColor: "warning",
+ color: "specialWhite",
+ }),
+ "&:hover": {
+ ...lockerColorSx(theme, {
+ backgroundColor: "warningDark",
+ }),
+ },
+ "&.Mui-disabled": {
+ ...lockerColorSx(theme, {
+ backgroundColor: "warning",
+ color: "specialWhite",
+ }),
+ },
+ })}
+ >
+ {t("empty_trash")}
+ </LoadingButton>
+ </Stack>
+ </Dialog>
+ );
+}
diff --git a/web/apps/locker/src/components/lockerPage/use-locker-actions.tsx b/web/apps/locker/src/components/lockerPage/use-locker-actions.tsx
index c44f664cbb..1581472de5 100644
--- a/web/apps/locker/src/components/lockerPage/use-locker-actions.tsx
+++ b/web/apps/locker/src/components/lockerPage/use-locker-actions.tsx
@@ -43,6 +43,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
import { Trans } from "react-i18next";
import { filterNonEmptyUploadItems } from "../createItemDialog/file-upload-helpers";
import type { CreateItemDialogEditItem } from "../createItemDialog/use-create-item-dialog-state";
+import type { EmptyTrashDialogState } from "./EmptyTrashDialog";
type DragDataTransferItem = DataTransferItem & {
webkitGetAsEntry?: () => FileSystemEntry | null;
@@ -328,6 +329,9 @@ export const useLockerActions = ({
useState<DeleteCollectionDialogState | null>(null);
const deleteCollectionDialogRef =
useRef<DeleteCollectionDialogState | null>(null);
+ const [emptyTrashDialog, setEmptyTrashDialog] =
+ useState<EmptyTrashDialogState | null>(null);
+ const emptyTrashDialogRef = useRef<EmptyTrashDialogState | null>(null);
const [toast, setToast] = useState<string | null>(null);
const [shareCollectionID, setShareCollectionID] = useState<number | null>(
null,
@@ -345,6 +349,12 @@ export const useLockerActions = ({
}
}, [deleteCollectionDialog]);
+ useEffect(() => {
+ if (emptyTrashDialog) {
+ emptyTrashDialogRef.current = emptyTrashDialog;
+ }
+ }, [emptyTrashDialog]);
+
useEffect(() => {
shareCollectionIDRef.current = shareCollectionID;
}, [shareCollectionID]);
@@ -400,6 +410,9 @@ export const useLockerActions = ({
const visibleDeleteCollectionDialog =
deleteCollectionDialog ?? deleteCollectionDialogRef.current;
+ const visibleEmptyTrashDialog =
+ emptyTrashDialog ?? emptyTrashDialogRef.current;
+
const uploadPreflightFailureMessage = useCallback(
(
failure: LockerUploadPreflightFailure,
@@ -705,20 +718,39 @@ export const useLockerActions = ({
);
const handleEmptyTrash = useCallback(() => {
- showMiniDialog({
- title: t("empty_trash_title"),
- message: t("empty_trash_message"),
- continue: {
- text: t("empty_trash"),
- color: "critical",
- action: async () => {
- await emptyTrashAPI(trashLastUpdatedAt);
- await refreshData();
- setToast(t("trashClearedSuccessfully"));
- },
- },
- });
- }, [refreshData, showMiniDialog, trashLastUpdatedAt]);
+ setEmptyTrashDialog({ loading: false });
+ }, []);
+
+ const handleConfirmEmptyTrash = useCallback(async () => {
+ if (!emptyTrashDialog || emptyTrashDialog.loading) {
+ return;
+ }
+
+ setEmptyTrashDialog({ loading: true });
+ try {
+ await emptyTrashAPI(trashLastUpdatedAt);
+ await refreshData();
+ setToast(t("trashClearedSuccessfully"));
+ setEmptyTrashDialog(null);
+ } catch (error) {
+ log.error("Failed to empty Locker trash", error);
+ setEmptyTrashDialog((current) =>
+ current
+ ? {
+ ...current,
+ error:
+ error instanceof Error
+ ? error.message
+ : t("generic_error"),
+ }
+ : current,
+ );
+ } finally {
+ setEmptyTrashDialog((current) =>
+ current ? { ...current, loading: false } : current,
+ );
+ }
+ }, [emptyTrashDialog, refreshData, trashLastUpdatedAt]);
const handleCreateCollection = useCallback(
async (name: string): Promise<number> => {
@@ -1107,8 +1139,10 @@ export const useLockerActions = ({
createDialogOpen,
deleteCollectionDialog,
editItem,
+ emptyTrashDialog,
ensureCollectionsExist,
handleConfirmDeleteCollection,
+ handleConfirmEmptyTrash,
handleCreateCollection,
handleCreateDialogClose,
handleCreateItem,
@@ -1138,10 +1172,12 @@ export const useLockerActions = ({
prefilledUploadItems,
setDeleteCollectionDialog,
setEditItem,
+ setEmptyTrashDialog,
setShareCollectionID,
shareCollectionID,
toast,
setToast,
visibleDeleteCollectionDialog,
+ visibleEmptyTrashDialog,
};
};
diff --git a/web/apps/locker/src/locales/en-US/translation.json b/web/apps/locker/src/locales/en-US/translation.json
index 2416b85fa4..a13245eb4f 100644
--- a/web/apps/locker/src/locales/en-US/translation.json
+++ b/web/apps/locker/src/locales/en-US/translation.json
@@ -32,6 +32,7 @@
"deleteCollectionConfirmation": "Are you sure you want to delete \"{{collectionName}}\"?",
"deleteCollectionDialogBody": "{{collectionName}} will be deleted permanently.",
"deleteCollectionFromEverywhere": "Also delete items from everywhere",
+ "deletedTimeAgo": "Deleted {{time}}",
"collectionDeletedSuccessfully": "Collection deleted successfully",
"collectionRenamedSuccessfully": "Collection renamed successfully",
"collectionNotFoundError": "Collection not found",
diff --git a/web/apps/locker/src/pages/locker.tsx b/web/apps/locker/src/pages/locker.tsx
index e6c880beb6..5f6f31ab1c 100644
--- a/web/apps/locker/src/pages/locker.tsx
+++ b/web/apps/locker/src/pages/locker.tsx
@@ -5,6 +5,7 @@ import { LockerNavbar } from "@/components/LockerNavbar";
import { LockerSidebar } from "@/components/LockerSidebar";
import { lockerColorSx } from "@/components/locker-tokens";
import { DeleteCollectionDialog } from "@/components/lockerPage/DeleteCollectionDialog";
+import { EmptyTrashDialog } from "@/components/lockerPage/EmptyTrashDialog";
import { LockerDragOverlay } from "@/components/lockerPage/LockerDragOverlay";
import { useLockerActions } from "@/components/lockerPage/use-locker-actions";
import { useLockerData } from "@/components/lockerPage/use-locker-data";
@@ -62,8 +63,10 @@ export const LockerPage: React.FC = () => {
createDialogOpen,
deleteCollectionDialog,
editItem,
+ emptyTrashDialog,
ensureCollectionsExist,
handleConfirmDeleteCollection,
+ handleConfirmEmptyTrash,
handleCreateCollection,
handleCreateDialogClose,
handleCreateItem,
@@ -92,11 +95,13 @@ export const LockerPage: React.FC = () => {
prefilledUploadItems,
setDeleteCollectionDialog,
setEditItem,
+ setEmptyTrashDialog,
setShareCollectionID,
shareCollectionID,
setToast,
toast,
visibleDeleteCollectionDialog,
+ visibleEmptyTrashDialog,
} = useLockerActions({
collections,
ensureUploadLimitState,
@@ -234,6 +239,12 @@ export const LockerPage: React.FC = () => {
onRefreshSharees={fetchCollectionSharees}
warmContacts={warmContacts}
/>
+ <EmptyTrashDialog
+ dialogState={emptyTrashDialog}
+ visibleDialogState={visibleEmptyTrashDialog}
+ onClose={() => setEmptyTrashDialog(null)}
+ onConfirm={handleConfirmEmptyTrash}
+ />
<DeleteCollectionDialog
dialogState={deleteCollectionDialog}
visibleDialogState={visibleDeleteCollectionDialog}