Merge pull request #317 from ente-io/disable-edits-options-shared-album

disable edits for shared collections
This commit is contained in:
Abhinav Kumar 2022-01-21 20:19:37 +05:30 committed by GitHub
commit 5a07a0705b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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