2026-04-07 11:47:16 +02:00
|
|
|
|
"""
|
|
|
|
|
|
Öffentlicher Widget-Katalog (Dashboard-Lab / später Produkt-Dashboard).
|
|
|
|
|
|
|
|
|
|
|
|
Single Source für: erlaubte IDs, Standard-Reihenfolge, Anzeige-Metadaten für API/GUI.
|
|
|
|
|
|
Frontend-Komponenten registrieren dieselben IDs lokal (siehe widgetSystem/registerPilotLabWidgets).
|
|
|
|
|
|
"""
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
|
|
from typing import Any, TypedDict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WidgetCatalogEntry(TypedDict):
|
|
|
|
|
|
id: str
|
|
|
|
|
|
title: str
|
|
|
|
|
|
description: str
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Reihenfolge in der Liste = Standard-Layout (alle default_enabled: True im Default-Layout)
|
|
|
|
|
|
WIDGET_CATALOG: list[WidgetCatalogEntry] = [
|
|
|
|
|
|
{
|
|
|
|
|
|
"id": "welcome",
|
|
|
|
|
|
"title": "Willkommen",
|
|
|
|
|
|
"description": "Begrüßung und Kurzkontext",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"id": "quick_capture",
|
|
|
|
|
|
"title": "Schnelleingabe",
|
|
|
|
|
|
"description": "Gewicht und Vitalwerte erfassen",
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"id": "kpi_board",
|
|
|
|
|
|
"title": "KPI-Kacheln",
|
2026-04-07 12:46:18 +02:00
|
|
|
|
"description": "Referenzwerte, KF%, Ø-Kalorien — optional Kacheln & Reihenfolge (config.tiles, max. 9)",
|
2026-04-07 11:47:16 +02:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"id": "body_overview",
|
|
|
|
|
|
"title": "Körper (Chart)",
|
2026-04-07 11:58:07 +02:00
|
|
|
|
"description": "Gewicht & Kennzahlen (optional: config chart_days 7–90)",
|
2026-04-07 11:47:16 +02:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
"id": "activity_overview",
|
|
|
|
|
|
"title": "Aktivität",
|
2026-04-07 12:20:23 +02:00
|
|
|
|
"description": "Training & Konsistenz (optional: config chart_days 7–90)",
|
2026-04-07 11:47:16 +02:00
|
|
|
|
},
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
ALLOWED_WIDGET_IDS: frozenset[str] = frozenset(e["id"] for e in WIDGET_CATALOG)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def catalog_response() -> dict[str, Any]:
|
|
|
|
|
|
"""Payload für GET /api/app/widgets/catalog."""
|
|
|
|
|
|
return {
|
|
|
|
|
|
"catalog_version": 1,
|
|
|
|
|
|
"widgets": list(WIDGET_CATALOG),
|
|
|
|
|
|
}
|