import { NUTRITION_HISTORY_VIZ_WIDGET_DEFAULTS, normalizeNutritionHistoryVizConfig } from './nutritionHistoryVizConfig' const CHART_TOGGLES = [ { key: 'show_kcal_vs_weight', label: 'Kalorien vs. Gewicht' }, { key: 'show_calorie_balance_chart', label: 'Kalorienbilanz' }, { key: 'show_protein_lean_chart', label: 'Protein vs. Magermasse' }, { key: 'show_heuristics', label: 'Kurz-Einordnung (Heuristiken)' }, { key: 'show_macro_daily_bars', label: 'Makros täglich (Balken)' }, { key: 'show_macro_distribution_pair', label: 'Donut + Wochen-Makros' }, { key: 'show_energy_protein_charts', label: 'Zeitverläufe (NutritionCharts, Bundle-Payloads)' }, ] const OTHER_TOGGLES = [ { key: 'show_goals_strip', label: 'Ernährungs-Ziele (Strip)' }, { key: 'show_intro_blurb', label: 'Hinweistext (Data-Layer)' }, { key: 'show_kpis', label: 'KPI-Kacheln' }, ] /** * @param {{ config: Record, onChange: (next: Record) => void }} props */ export default function NutritionHistoryVizConfigEditor({ config, onChange }) { const merged = normalizeNutritionHistoryVizConfig(config) const patch = (partial) => { const next = { ...merged, ...partial } const def = NUTRITION_HISTORY_VIZ_WIDGET_DEFAULTS const stored = {} for (const k of Object.keys(def)) { if (next[k] !== def[k]) stored[k] = next[k] } onChange(stored) } const setBool = (key, checked) => { patch({ [key]: checked }) } return (
Ernährung (Verlauf-Bundle): welche Blöcke auf der Übersicht erscheinen. Unbelegte Felder = schlanker Standard (KPI kompakt, kcal vs. Gewicht, Makro-Balken + Donut/Woche).
KPI-Umfang
Bereiche
{OTHER_TOGGLES.map(({ key, label }) => ( ))}
Charts
{CHART_TOGGLES.map(({ key, label }) => ( ))}
) }