From c53b81dcdbf0389ca2d54a6f6d2332815d9668d6 Mon Sep 17 00:00:00 2001
From: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Date: Fri, 6 Dec 2024 02:15:47 +0100
Subject: [PATCH] Show data from OFF (#1089)
* wip
* vite config
* show data
---
src/pages/nutrition/NutrimentCell.tsx | 52 +++-
src/pages/nutrition/index.tsx | 267 ++++++++++++------
.../nutrition/useRobotoffPredicitions.ts | 67 ++++-
src/pages/nutrition/utils.ts | 7 +
vite.config.js | 3 +
5 files changed, 287 insertions(+), 109 deletions(-)
diff --git a/src/pages/nutrition/NutrimentCell.tsx b/src/pages/nutrition/NutrimentCell.tsx
index 88c836faa..696a37261 100644
--- a/src/pages/nutrition/NutrimentCell.tsx
+++ b/src/pages/nutrition/NutrimentCell.tsx
@@ -8,11 +8,24 @@ interface NutrimentCellProps {
tabIndex: number;
value?: string;
unit?: string;
+ productValue?: number;
+ productUnit?: string;
+ displayOFFValue: boolean;
setValues: (object) => void;
}
export const NutrimentCell = (props: NutrimentCellProps) => {
- const { nutrimentId, nutrimentKey, tabIndex, value, unit, setValues } = props;
+ const {
+ nutrimentId,
+ nutrimentKey,
+ tabIndex,
+ value,
+ unit,
+ setValues,
+ productValue,
+ productUnit,
+ displayOFFValue,
+ } = props;
return (
{
element.classList.remove("focused");
}}
>
-
- setValues((p) => ({
- ...p,
- [nutrimentKey]: {
- ...p[nutrimentKey],
- value: event.target.value,
- },
- }))
- }
- />
+
+
+ setValues((p) => ({
+ ...p,
+ [nutrimentKey]: {
+ ...p[nutrimentKey],
+ value: event.target.value,
+ },
+ }))
+ }
+ />
+
+ {displayOFFValue && (
+
+ )}
+
{isValidUnit(unit) ? (
|