Skip to content

armgit / ente

Public Imported from GitHub
0

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

D3

Manav Rathib4b864a869f0
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index 5b906194fc..8f2e586ac6 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -64,8 +64,7 @@ export interface PhotoFrameProps {
selected: SelectedState | ((selected: SelectedState) => SelectedState),
) => void;
selected: SelectedState;
- tempDeletedFileIds?: Set<number>;
- setTempDeletedFileIds?: (value: Set<number>) => void;
+ markTempDeleted?: (tempDeletedFiles: EnteFile[]) => void;
/** This will be set if mode is not "people". */
activeCollectionID: number;
/** This will be set if mode is "people". */
@@ -91,8 +90,7 @@ const PhotoFrame = ({
favItemIds,
setSelected,
selected,
- tempDeletedFileIds,
- setTempDeletedFileIds,
+ markTempDeleted,
activeCollectionID,
activePersonID,
enableDownload,
@@ -581,8 +579,7 @@ const PhotoFrame = ({
gettingData={getSlideData}
getConvertedItem={getConvertedItem}
favItemIds={favItemIds}
- tempDeletedFileIds={tempDeletedFileIds}
- setTempDeletedFileIds={setTempDeletedFileIds}
+ markTempDeleted={markTempDeleted}
isTrashCollection={activeCollectionID === TRASH_SECTION}
isInHiddenSection={isInHiddenSection}
enableDownload={enableDownload}
diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx
index 61a5eb8ff8..961201b46d 100644
--- a/web/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx
@@ -106,8 +106,7 @@ export interface PhotoViewerProps {
getConvertedItem: (instance: any, index: number, item: EnteFile) => void;
id?: string;
favItemIds: Set<number>;
- tempDeletedFileIds: Set<number>;
- setTempDeletedFileIds?: (value: Set<number>) => void;
+ markTempDeleted?: (tempDeletedFiles: EnteFile[]) => void;
isTrashCollection: boolean;
isInHiddenSection: boolean;
enableDownload: boolean;
@@ -124,7 +123,7 @@ function PhotoViewer(props: PhotoViewerProps) {
PublicCollectionGalleryContext,
);
- const { isOpen, items } = props;
+ const { isOpen, items, markTempDeleted } = props;
const pswpElement = useRef<HTMLDivElement>();
const [photoSwipe, setPhotoSwipe] =
@@ -537,13 +536,11 @@ function PhotoViewer(props: PhotoViewerProps) {
};
const trashFile = async (file: EnteFile) => {
- const { tempDeletedFileIds, setTempDeletedFileIds } = props;
try {
appContext.startLoading();
await trashFiles([file]);
appContext.finishLoading();
- tempDeletedFileIds.add(file.id);
- setTempDeletedFileIds(new Set(tempDeletedFileIds));
+ markTempDeleted?.([file]);
updateItems(props.items.filter((item) => item.id !== file.id));
needUpdate.current = true;
} catch (e) {
diff --git a/web/apps/photos/src/pages/gallery.tsx b/web/apps/photos/src/pages/gallery.tsx
index f7b1e1035b..ed77cb7c1f 100644
--- a/web/apps/photos/src/pages/gallery.tsx
+++ b/web/apps/photos/src/pages/gallery.tsx
@@ -1242,8 +1242,9 @@ export default function Gallery() {
favItemIds={state.favoriteFileIDs}
setSelected={setSelected}
selected={selected}
- tempDeletedFileIds={tempDeletedFileIds}
- setTempDeletedFileIds={setTempDeletedFileIds}
+ markTempDeleted={(files) =>
+ dispatch({ type: "markTempDeleted", files })
+ }
setIsPhotoSwipeOpen={setIsPhotoSwipeOpen}
activeCollectionID={activeCollectionID}
activePersonID={galleryPeopleState?.activePerson?.id}