Skip to content

armgit / ente

Public Imported from GitHub
0

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

Tweak

Manav Rathi184bb6ec6cc5
diff --git a/web/apps/photos/src/components/PhotoFrame.tsx b/web/apps/photos/src/components/PhotoFrame.tsx
index e814b19623..aa8ff9d797 100644
--- a/web/apps/photos/src/components/PhotoFrame.tsx
+++ b/web/apps/photos/src/components/PhotoFrame.tsx
@@ -10,7 +10,7 @@ import { FileType } from "@/media/file-type";
import type { GalleryBarMode } from "@/new/photos/components/gallery/reducer";
import { TRASH_SECTION } from "@/new/photos/services/collection";
import { styled } from "@mui/material";
-import PhotoViewer, { type PhotoViewerProps } from "components/PhotoViewer";
+import { PhotoViewer, type PhotoViewerProps } from "components/PhotoViewer";
import { useRouter } from "next/router";
import { GalleryContext } from "pages/gallery";
import PhotoSwipe from "photoswipe";
@@ -87,14 +87,25 @@ export interface PhotoFrameProps {
*/
favoriteFileIDs?: Set<number>;
/**
- * Callback to invoke when the in-memory, unsynced, favorite status of a
- * file is changed. For more details, see {@link unsyncedFavoriteUpdates} in
- * the gallery reducer's documentation.
+ * Called when the component wants to update the in-memory, unsynced,
+ * favorite status of a file.
+ *
+ * For more details, see {@link unsyncedFavoriteUpdates} in the gallery
+ * reducer's documentation.
*
* Not set in the context of the shared albums app.
*/
markUnsyncedFavoriteUpdate?: (fileID: number, isFavorite: boolean) => void;
- markTempDeleted?: (tempDeletedFiles: EnteFile[]) => void;
+ /**
+ * Called when the component wants to mark the given files as deleted in the
+ * the in-memory, unsynced, state maintained by the top level gallery.
+ *
+ * For more details, see {@link unsyncedFavoriteUpdates} in the gallery
+ * reducer's documentation.
+ *
+ * Not set in the context of the shared albums app.
+ */
+ markTempDeleted?: (files: EnteFile[]) => void;
/** This will be set if mode is not "people". */
activeCollectionID: number;
/** This will be set if mode is "people". */
@@ -510,7 +521,6 @@ const PhotoFrame = ({
onClose={handleClose}
gettingData={getSlideData}
forceConvertItem={forceConvertItem}
- markTempDeleted={markTempDeleted}
isTrashCollection={activeCollectionID === TRASH_SECTION}
isInHiddenSection={isInHiddenSection}
enableDownload={enableDownload}
@@ -520,7 +530,7 @@ const PhotoFrame = ({
setFilesDownloadProgressAttributesCreator
}
onSelectPerson={onSelectPerson}
- {...{ favoriteFileIDs, markUnsyncedFavoriteUpdate }}
+ {...{ favoriteFileIDs, markUnsyncedFavoriteUpdate, markTempDeleted }}
/>
</Container>
);
diff --git a/web/apps/photos/src/components/PhotoViewer/index.tsx b/web/apps/photos/src/components/PhotoViewer/index.tsx
index 7ab0a9c954..d7d73d91e3 100644
--- a/web/apps/photos/src/components/PhotoViewer/index.tsx
+++ b/web/apps/photos/src/components/PhotoViewer/index.tsx
@@ -69,7 +69,7 @@ import { ImageEditorOverlay } from "./ImageEditorOverlay";
export type PhotoViewerProps = Pick<
PhotoFrameProps,
- "favoriteFileIDs" | "markUnsyncedFavoriteUpdate"
+ "favoriteFileIDs" | "markUnsyncedFavoriteUpdate" | "markTempDeleted"
> & {
isOpen: boolean;
items: any[];
@@ -78,7 +78,6 @@ export type PhotoViewerProps = Pick<
gettingData: (instance: any, index: number, item: EnteFile) => void;
forceConvertItem: (instance: any, index: number, item: EnteFile) => void;
id?: string;
- markTempDeleted?: (tempDeletedFiles: EnteFile[]) => void;
isTrashCollection: boolean;
isInHiddenSection: boolean;
enableDownload: boolean;
@@ -101,12 +100,15 @@ export type PhotoViewerProps = Pick<
*
* The underlying library that we use is called PhotoSwipe.
*/
-function PhotoViewer(props: PhotoViewerProps) {
+export const PhotoViewer: React.FC<PhotoViewerProps> = (props) => {
const {
id,
+ isOpen,
+ items,
forceConvertItem,
favoriteFileIDs,
markUnsyncedFavoriteUpdate,
+ markTempDeleted,
} = props;
const galleryContext = useContext(GalleryContext);
@@ -116,8 +118,6 @@ function PhotoViewer(props: PhotoViewerProps) {
PublicCollectionGalleryContext,
);
- const { isOpen, items, markTempDeleted } = props;
-
const pswpElement = useRef<HTMLDivElement>();
const [photoSwipe, setPhotoSwipe] =
useState<Photoswipe<Photoswipe.Options>>();
@@ -966,9 +966,7 @@ function PhotoViewer(props: PhotoViewerProps) {
/>
</>
);
-}
-
-export default PhotoViewer;
+};
interface PhotoswipeFullscreenAPI {
enter: () => void;
diff --git a/web/apps/photos/src/utils/file/index.ts b/web/apps/photos/src/utils/file/index.ts
index 2b07d7251d..1c2bdc2826 100644
--- a/web/apps/photos/src/utils/file/index.ts
+++ b/web/apps/photos/src/utils/file/index.ts
@@ -469,9 +469,9 @@ export const shouldShowAvatar = (file: EnteFile, user: User) => {
export const handleFileOps = async (
ops: FILE_OPS_TYPE,
files: EnteFile[],
- markTempDeleted: (tempDeletedFiles: EnteFile[]) => void,
+ markTempDeleted: (files: EnteFile[]) => void,
clearTempDeleted: () => void,
- markTempHidden: (tempHiddenFiles: EnteFile[]) => void,
+ markTempHidden: (files: EnteFile[]) => void,
clearTempHidden: () => void,
fixCreationTime: (files: EnteFile[]) => void,
setFilesDownloadProgressAttributesCreator: SetFilesDownloadProgressAttributesCreator,