From 4618ab5cdcfe997b9ff9ee7b0f42f2524f60c919 Mon Sep 17 00:00:00 2001
From: Ajay Bura <32841439+ajbura@users.noreply.github.com>
Date: Wed, 15 Jan 2025 17:39:48 +0530
Subject: [PATCH] hide upload image button when user can not edit pack
---
.../image-pack-view/ImagePackContent.tsx | 100 +++++++++---------
1 file changed, 52 insertions(+), 48 deletions(-)
diff --git a/src/app/components/image-pack-view/ImagePackContent.tsx b/src/app/components/image-pack-view/ImagePackContent.tsx
index be171625..86a908c2 100644
--- a/src/app/components/image-pack-view/ImagePackContent.tsx
+++ b/src/app/components/image-pack-view/ImagePackContent.tsx
@@ -330,54 +330,58 @@ export const ImagePackContent = as<'div', ImagePackContentProps>(
/>
-
- Images
-
- pickFiles('image/*')}
- >
- Select
-
- }
- />
-
- {files.map((file) => (
-
-
- {(uploadAtom) => (
-
- )}
-
-
- ))}
- {uploadedImages.map(renderImage)}
- {images.map(renderImage)}
-
+ {images.length === 0 && !canEdit ? null : (
+
+ Images
+ {canEdit && (
+
+ pickFiles('image/*')}
+ >
+ Select
+
+ }
+ />
+
+ )}
+ {files.map((file) => (
+
+
+ {(uploadAtom) => (
+
+ )}
+
+
+ ))}
+ {uploadedImages.map(renderImage)}
+ {images.map(renderImage)}
+
+ )}
);
}