From ad494f6dff60b082c03abfa9481450d24b022a36 Mon Sep 17 00:00:00 2001 From: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com> Date: Fri, 13 Dec 2024 00:49:56 +0100 Subject: [PATCH] Show if image is selected as a nutriment image (#1101) --- 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`, }} />