feat: enhance KPI tiles with contextual hints and improve chart legends
Deploy Development / deploy (push) Successful in 54s
Build Test / pytest-backend (push) Successful in 4s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 17s

- Added contextual hints to KPI tiles in the nutrition interpretation to provide users with actionable insights regarding protein intake and weight assessment.
- Updated the KpiTilesOverview component to display these hints, improving user understanding of nutrition metrics.
- Introduced a new KcalVsWeightLegend component to clarify chart data representation, enhancing the overall user experience in the history visualization.
This commit is contained in:
Lars committed 2026-04-19 17:36:45 +02:00
1 parent 31fbf33031
commit fc816da335
3 files changed
+100 -6

No files matched your search

@@ -103,6 +103,7 @@ def build_nutrition_history_kpi_tiles(
"sublabel": "Referenzgewicht fehlt",
"status": "warn",
"verdict": _verdict("warn"),
"hint": "Ohne aktuelles Körpergewicht lässt sich das Protein-Ziel (g/kg) nicht bewerten.",
"hoverTop": "Protein-Ziel nicht berechenbar",
"hoverBody": "Für 1,6–2,2 g/kg wird ein aktuelles Körpergewicht benötigt.",
"keys": ["protein_adequacy"],
@@ -119,6 +120,10 @@ def build_nutrition_history_kpi_tiles(
"sublabel": f"Unterversorgung: {avg_protein}g/Tag (Ziel {pt_low}–{pt_high}g)",
"status": "bad",
"verdict": _verdict("bad"),
"hint": (
f"Es fehlen rund {miss} g Protein pro Tag – bei Kaloriendefizit "
"steigt das Risiko für Muskelerhalt."
),
"hoverTop": f"Unterversorgung: {avg_protein}g/Tag (Ziel {pt_low}–{pt_high}g)",
"hoverBody": (
f"1,6–2,2g/kg KG. Fehlend: ~{miss}g täglich. "
@@ -153,6 +158,10 @@ def build_nutrition_history_kpi_tiles(
"sublabel": f"Protein-Anteil niedrig: {prot_pct}% der Kalorien",
"status": "warn",
"verdict": _verdict("warn"),
"hint": (
f"Viele Kalorien kommen aus KH/Fett; Proteinanteil oft sinnvoll bei 25–35 % "
f"(aktuell P {prot_pct} % / KH {kh_pct} % / F {fat_pct} %)."
),
"hoverTop": f"Protein-Anteil niedrig: {prot_pct}% der Kalorien",
"hoverBody": (
f"Empfehlung oft 25–35%. Aktuell: {prot_pct}% P / {kh_pct}% KH / {fat_pct}% F"