From 6b6a75df222d23c854890244444c8667459ef2c1 Mon Sep 17 00:00:00 2001 From: Abhinav Date: Fri, 21 Jan 2022 18:45:08 +0530 Subject: [PATCH] disable edits for shared collections --- src/components/PhotoSwipe/PhotoSwipe.tsx | 62 +++++++++++++++--------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/src/components/PhotoSwipe/PhotoSwipe.tsx b/src/components/PhotoSwipe/PhotoSwipe.tsx index 22d922c75..e50425b21 100644 --- a/src/components/PhotoSwipe/PhotoSwipe.tsx +++ b/src/components/PhotoSwipe/PhotoSwipe.tsx @@ -91,9 +91,11 @@ const renderInfoItem = (label: string, value: string | JSX.Element) => ( ); function RenderCreationTime({ + disableEdits, file, scheduleUpdate, }: { + disableEdits: boolean; file: EnteFile; scheduleUpdate: () => void; }) { @@ -160,24 +162,25 @@ function RenderCreationTime({ - {!isInEditMode ? ( - - - - ) : ( - <> - - {loading ? ( - - ) : ( - - )} + {!disableEdits && + (!isInEditMode ? ( + + - - - - - )} + ) : ( + <> + + {loading ? ( + + ) : ( + + )} + + + + + + ))} @@ -275,9 +278,11 @@ const FileNameEditForm = ({ filename, saveEdits, discardEdits, extension }) => { }; function RenderFileName({ + disableEdits, file, scheduleUpdate, }: { + disableEdits: boolean; file: EnteFile; scheduleUpdate: () => void; }) { @@ -322,13 +327,18 @@ function RenderFileName({ {getFileTitle(filename, extension)} - - - - - + {!disableEdits && ( + + + + + + )} ) : ( )} {metadata?.creationTime && ( @@ -744,6 +757,7 @@ function PhotoSwipe(props: Iprops) {