mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-01-18 19:56:01 +01:00
hide upload image button when user can not edit pack
This commit is contained in:
parent
f4bf351743
commit
4618ab5cdc
1 changed files with 52 additions and 48 deletions
|
@ -330,54 +330,58 @@ export const ImagePackContent = as<'div', ImagePackContentProps>(
|
|||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Images</Text>
|
||||
<SequenceCard
|
||||
style={{ padding: config.space.S300 }}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Upload Images"
|
||||
description="Select images from your storage to upload them in pack."
|
||||
after={
|
||||
<Button
|
||||
variant="Secondary"
|
||||
fill="Soft"
|
||||
size="300"
|
||||
radii="300"
|
||||
type="button"
|
||||
outlined
|
||||
onClick={() => pickFiles('image/*')}
|
||||
>
|
||||
<Text size="B300">Select</Text>
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
{files.map((file) => (
|
||||
<SequenceCard
|
||||
key={file.name}
|
||||
style={{ padding: config.space.S300 }}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<ImageTileUpload file={file}>
|
||||
{(uploadAtom) => (
|
||||
<CompactUploadCardRenderer
|
||||
uploadAtom={uploadAtom}
|
||||
onRemove={handleUploadRemove}
|
||||
onComplete={handleUploadComplete}
|
||||
/>
|
||||
)}
|
||||
</ImageTileUpload>
|
||||
</SequenceCard>
|
||||
))}
|
||||
{uploadedImages.map(renderImage)}
|
||||
{images.map(renderImage)}
|
||||
</Box>
|
||||
{images.length === 0 && !canEdit ? null : (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Images</Text>
|
||||
{canEdit && (
|
||||
<SequenceCard
|
||||
style={{ padding: config.space.S300 }}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Upload Images"
|
||||
description="Select images from your storage to upload them in pack."
|
||||
after={
|
||||
<Button
|
||||
variant="Secondary"
|
||||
fill="Soft"
|
||||
size="300"
|
||||
radii="300"
|
||||
type="button"
|
||||
outlined
|
||||
onClick={() => pickFiles('image/*')}
|
||||
>
|
||||
<Text size="B300">Select</Text>
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
)}
|
||||
{files.map((file) => (
|
||||
<SequenceCard
|
||||
key={file.name}
|
||||
style={{ padding: config.space.S300 }}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<ImageTileUpload file={file}>
|
||||
{(uploadAtom) => (
|
||||
<CompactUploadCardRenderer
|
||||
uploadAtom={uploadAtom}
|
||||
onRemove={handleUploadRemove}
|
||||
onComplete={handleUploadComplete}
|
||||
/>
|
||||
)}
|
||||
</ImageTileUpload>
|
||||
</SequenceCard>
|
||||
))}
|
||||
{uploadedImages.map(renderImage)}
|
||||
{images.map(renderImage)}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue