hide upload image button when user can not edit pack

This commit is contained in:
Ajay Bura 2025-01-15 17:39:48 +05:30
parent f4bf351743
commit 4618ab5cdc

View file

@ -330,54 +330,58 @@ export const ImagePackContent = as<'div', ImagePackContentProps>(
/> />
</SequenceCard> </SequenceCard>
</Box> </Box>
<Box direction="Column" gap="100"> {images.length === 0 && !canEdit ? null : (
<Text size="L400">Images</Text> <Box direction="Column" gap="100">
<SequenceCard <Text size="L400">Images</Text>
style={{ padding: config.space.S300 }} {canEdit && (
variant="SurfaceVariant" <SequenceCard
direction="Column" style={{ padding: config.space.S300 }}
gap="400" variant="SurfaceVariant"
> direction="Column"
<SettingTile gap="400"
title="Upload Images" >
description="Select images from your storage to upload them in pack." <SettingTile
after={ title="Upload Images"
<Button description="Select images from your storage to upload them in pack."
variant="Secondary" after={
fill="Soft" <Button
size="300" variant="Secondary"
radii="300" fill="Soft"
type="button" size="300"
outlined radii="300"
onClick={() => pickFiles('image/*')} type="button"
> outlined
<Text size="B300">Select</Text> onClick={() => pickFiles('image/*')}
</Button> >
} <Text size="B300">Select</Text>
/> </Button>
</SequenceCard> }
{files.map((file) => ( />
<SequenceCard </SequenceCard>
key={file.name} )}
style={{ padding: config.space.S300 }} {files.map((file) => (
variant="SurfaceVariant" <SequenceCard
direction="Column" key={file.name}
gap="400" style={{ padding: config.space.S300 }}
> variant="SurfaceVariant"
<ImageTileUpload file={file}> direction="Column"
{(uploadAtom) => ( gap="400"
<CompactUploadCardRenderer >
uploadAtom={uploadAtom} <ImageTileUpload file={file}>
onRemove={handleUploadRemove} {(uploadAtom) => (
onComplete={handleUploadComplete} <CompactUploadCardRenderer
/> uploadAtom={uploadAtom}
)} onRemove={handleUploadRemove}
</ImageTileUpload> onComplete={handleUploadComplete}
</SequenceCard> />
))} )}
{uploadedImages.map(renderImage)} </ImageTileUpload>
{images.map(renderImage)} </SequenceCard>
</Box> ))}
{uploadedImages.map(renderImage)}
{images.map(renderImage)}
</Box>
)}
</Box> </Box>
); );
} }