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,24 +162,25 @@ function RenderCreationTime({
<Value <Value
width={isInEditMode ? '20%' : '10%'} width={isInEditMode ? '20%' : '10%'}
style={{ cursor: 'pointer', marginLeft: '10px' }}> style={{ cursor: 'pointer', marginLeft: '10px' }}>
{!isInEditMode ? ( {!shouldDisableEdits &&
<IconButton onClick={openEditMode}> (!isInEditMode ? (
<EditIcon /> <IconButton onClick={openEditMode}>
</IconButton> <EditIcon />
) : (
<>
<IconButton onClick={saveEdits}>
{loading ? (
<SmallLoadingSpinner />
) : (
<TickIcon />
)}
</IconButton> </IconButton>
<IconButton onClick={discardEdits}> ) : (
<CloseIcon /> <>
</IconButton> <IconButton onClick={saveEdits}>
</> {loading ? (
)} <SmallLoadingSpinner />
) : (
<TickIcon />
)}
</IconButton>
<IconButton onClick={discardEdits}>
<CloseIcon />
</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>
<Value {!shouldDisableEdits && (
width="10%" <Value
style={{ cursor: 'pointer', marginLeft: '10px' }}> width="10%"
<IconButton onClick={openEditMode}> style={{
<EditIcon /> cursor: 'pointer',
</IconButton> marginLeft: '10px',
</Value> }}>
<IconButton onClick={openEditMode}>
<EditIcon />
</IconButton>
</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}