Merge branch 'master' into shareable-url

This commit is contained in:
Abhinav 2022-01-21 20:20:40 +05:30
commit a53e386d76

View file

@ -91,9 +91,11 @@ const renderInfoItem = (label: string, value: string | JSX.Element) => (
); );
function RenderCreationTime({ function RenderCreationTime({
shouldDisableEdits,
file, file,
scheduleUpdate, scheduleUpdate,
}: { }: {
shouldDisableEdits: boolean;
file: EnteFile; file: EnteFile;
scheduleUpdate: () => void; scheduleUpdate: () => void;
}) { }) {
@ -160,7 +162,8 @@ function RenderCreationTime({
<Value <Value
width={isInEditMode ? '20%' : '10%'} width={isInEditMode ? '20%' : '10%'}
style={{ cursor: 'pointer', marginLeft: '10px' }}> style={{ cursor: 'pointer', marginLeft: '10px' }}>
{!isInEditMode ? ( {!shouldDisableEdits &&
(!isInEditMode ? (
<IconButton onClick={openEditMode}> <IconButton onClick={openEditMode}>
<EditIcon /> <EditIcon />
</IconButton> </IconButton>
@ -177,7 +180,7 @@ function RenderCreationTime({
<CloseIcon /> <CloseIcon />
</IconButton> </IconButton>
</> </>
)} ))}
</Value> </Value>
</Row> </Row>
</> </>
@ -275,9 +278,11 @@ const FileNameEditForm = ({ filename, saveEdits, discardEdits, extension }) => {
}; };
function RenderFileName({ function RenderFileName({
shouldDisableEdits,
file, file,
scheduleUpdate, scheduleUpdate,
}: { }: {
shouldDisableEdits: boolean;
file: EnteFile; file: EnteFile;
scheduleUpdate: () => void; scheduleUpdate: () => void;
}) { }) {
@ -322,13 +327,18 @@ function RenderFileName({
{getFileTitle(filename, extension)} {getFileTitle(filename, extension)}
</FreeFlowText> </FreeFlowText>
</Value> </Value>
{!shouldDisableEdits && (
<Value <Value
width="10%" width="10%"
style={{ cursor: 'pointer', marginLeft: '10px' }}> style={{
cursor: 'pointer',
marginLeft: '10px',
}}>
<IconButton onClick={openEditMode}> <IconButton onClick={openEditMode}>
<EditIcon /> <EditIcon />
</IconButton> </IconButton>
</Value> </Value>
)}
</> </>
) : ( ) : (
<FileNameEditForm <FileNameEditForm
@ -396,6 +406,7 @@ function ExifData(props: { exif: any }) {
} }
function InfoModal({ function InfoModal({
shouldDisableEdits,
showInfo, showInfo,
handleCloseInfo, handleCloseInfo,
items, items,
@ -419,12 +430,14 @@ function InfoModal({
)} )}
{metadata?.title && ( {metadata?.title && (
<RenderFileName <RenderFileName
shouldDisableEdits={shouldDisableEdits}
file={items[photoSwipe?.getCurrentIndex()]} file={items[photoSwipe?.getCurrentIndex()]}
scheduleUpdate={scheduleUpdate} scheduleUpdate={scheduleUpdate}
/> />
)} )}
{metadata?.creationTime && ( {metadata?.creationTime && (
<RenderCreationTime <RenderCreationTime
shouldDisableEdits={shouldDisableEdits}
file={items[photoSwipe?.getCurrentIndex()]} file={items[photoSwipe?.getCurrentIndex()]}
scheduleUpdate={scheduleUpdate} scheduleUpdate={scheduleUpdate}
/> />
@ -744,6 +757,7 @@ function PhotoSwipe(props: Iprops) {
</div> </div>
</div> </div>
<InfoModal <InfoModal
shouldDisableEdits={props.isSharedCollection}
showInfo={showInfo} showInfo={showInfo}
handleCloseInfo={handleCloseInfo} handleCloseInfo={handleCloseInfo}
items={items} items={items}