diff --git a/frontend/src/pages/NutritionPage.jsx b/frontend/src/pages/NutritionPage.jsx index 04281c8..c2531fa 100644 --- a/frontend/src/pages/NutritionPage.jsx +++ b/frontend/src/pages/NutritionPage.jsx @@ -322,9 +322,10 @@ function CalorieBalance({ data, profile }) { // ── Main Page ───────────────────────────────────────────────────────────────── export default function NutritionPage() { - const [tab, setTab] = useState('overview') + const [tab, setTab] = useState('data') // BUG-002 fix: show data first const [corrData, setCorr] = useState([]) const [weekly, setWeekly] = useState([]) + const [entries, setEntries]= useState([]) // BUG-002 fix: raw data const [profile, setProf] = useState(null) const [loading, setLoad] = useState(true) const [hasData, setHasData]= useState(false) @@ -332,13 +333,15 @@ export default function NutritionPage() { const load = async () => { setLoad(true) try { - const [corr, wkly, prof] = await Promise.all([ + const [corr, wkly, ent, prof] = await Promise.all([ nutritionApi.nutritionCorrelations(), nutritionApi.nutritionWeekly(16), + nutritionApi.listNutrition(365), // BUG-002 fix: load raw entries api.getActiveProfile(), ]) setCorr(Array.isArray(corr)?corr:[]) setWeekly(Array.isArray(wkly)?wkly:[]) + setEntries(Array.isArray(ent)?ent:[]) // BUG-002 fix setProf(prof) setHasData(Array.isArray(corr) && corr.some(d=>d.kcal)) } catch(e) { console.error('load error:', e) } @@ -367,12 +370,45 @@ export default function NutritionPage() {
+
+ {tab==='data' && ( +
+
Alle Einträge ({entries.length})
+ {entries.length === 0 && ( +

Noch keine Ernährungsdaten. Importiere FDDB CSV oben.

+ )} + {entries.map((e, i) => ( +
+
+ {dayjs(e.date).format('dd, DD. MMMM YYYY')} +
+ {Math.round(e.kcal || 0)} kcal +
+
+
+ 🥩 Protein: {Math.round(e.protein_g || 0)}g + 🫙 Fett: {Math.round(e.fat_g || 0)}g + 🍞 Kohlenhydrate: {Math.round(e.carbs_g || 0)}g +
+ {e.source && ( +
+ Quelle: {e.source} +
+ )} +
+ ))} +
+ )} + {tab==='overview' && (
Makro-Verteilung pro Woche (Ø g/Tag)