Skip to content

Commit

Permalink
Show if image is selected as a nutriment image
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette committed Dec 12, 2024
1 parent f6e0fae commit 886296e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/pages/nutrition/PictureSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<React.Fragment>
<p>
Expand All @@ -50,6 +54,11 @@ export default function PictureSection(props: PictureSectionProps) {
})
: "..."}
</p>
<p>
{selectedImagesIds.includes(imageId)
? `Selected as nutriment image ✅`
: `Not selected as nutriment ❌`}
</p>
<IconButton onClick={() => setRotationIndex((p) => p - 1)}>
<RotateLeftIcon />
</IconButton>
Expand All @@ -64,7 +73,7 @@ export default function PictureSection(props: PictureSectionProps) {
alt=""
style={{
width: "100%",
maxHeight: "200vh",
maxHeight: "70vh",
rotate: `${90 * rotationIndex}deg`,
}}
/>
Expand Down

0 comments on commit 886296e

Please sign in to comment.