From 886296e7b83c76a0de0de47f6a7ecb2e7f8469e9 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 13 Dec 2024 00:45:49 +0100 Subject: [PATCH] Show if image is selected as a nutriment image --- src/pages/nutrition/PictureSection.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/pages/nutrition/PictureSection.tsx b/src/pages/nutrition/PictureSection.tsx index 7ffc7f76d..61da0c77b 100644 --- a/src/pages/nutrition/PictureSection.tsx +++ b/src/pages/nutrition/PictureSection.tsx @@ -38,6 +38,10 @@ export default function PictureSection(props: PictureSectionProps) { const imageTimestamp = product?.images?.[imageId]?.uploaded_t; + const selectedImagesIds = Object.keys(product?.images ?? {}) + .filter((imageKey) => imageKey.startsWith("nutrition")) + .map((imageKey) => product?.images[imageKey].imgid); + return (

@@ -50,6 +54,11 @@ export default function PictureSection(props: PictureSectionProps) { }) : "..."}

+

+ {selectedImagesIds.includes(imageId) + ? `Selected as nutriment image ✅` + : `Not selected as nutriment ❌`} +

setRotationIndex((p) => p - 1)}> @@ -64,7 +73,7 @@ export default function PictureSection(props: PictureSectionProps) { alt="" style={{ width: "100%", - maxHeight: "200vh", + maxHeight: "70vh", rotate: `${90 * rotationIndex}deg`, }} />