Rename and pass file

This commit is contained in:
Manav Rathi
2025-03-04 07:48:23 +05:30
parent 9c5adfe7cb
commit bad8a9c9b8
4 changed files with 49 additions and 28 deletions

View File

@@ -303,7 +303,7 @@ const FileViewer: React.FC<FileViewerProps> = ({
[user, isInTrashSection, isInHiddenSection, handleEditImage],
);
const handleScheduleUpdate = useCallback(() => setNeedsSync(true), []);
const handleNeedsRemoteSync = useCallback(() => setNeedsSync(true), []);
const handleSelectCollection = useCallback(
(collectionID: number) => {
@@ -339,9 +339,9 @@ const FileViewer: React.FC<FileViewerProps> = ({
const toggleFavorite = useCallback(
({ file }: FileViewerAnnotatedFile) =>
onToggleFavorite!(file)
.then(handleScheduleUpdate)
.then(handleNeedsRemoteSync)
.catch(onGenericError),
[onToggleFavorite, handleScheduleUpdate, onGenericError],
[onToggleFavorite, handleNeedsRemoteSync, onGenericError],
);
// Initial value of delegate.
@@ -394,7 +394,8 @@ const FileViewer: React.FC<FileViewerProps> = ({
handleMore,
]);
const handleRefreshPhotoswipe = useCallback(() => {
const handleUpdateCaption = useCallback((updatedFile: EnteFile) => {
console.log("TODO", updatedFile);
psRef.current!.refreshCurrentSlideContent();
}, []);
@@ -411,8 +412,8 @@ const FileViewer: React.FC<FileViewerProps> = ({
allowEdits={!!activeAnnotatedFile?.annotation.isOwnFile}
allowMap={haveUser}
showCollections={haveUser}
scheduleUpdate={handleScheduleUpdate}
refreshPhotoswipe={handleRefreshPhotoswipe}
onNeedsRemoteSync={handleNeedsRemoteSync}
onUpdateCaption={handleUpdateCaption}
onSelectCollection={handleSelectCollection}
onSelectPerson={handleSelectPerson}
{...{ fileCollectionIDs, allCollectionsNameByID }}