feat: Enhance dashboard widget configuration and introduce new widgets
- Updated the dashboard layout schema to include new widgets: DashboardGreeting, QuickWeightToday, BodyStatStrip, StatusPills, ProfileGoalsProgress, TrendKcalWeight, NutritionActivitySummary, RecoverySleepRest, and TrainingTypeDistribution. - Improved widget configuration validation to support new features, including chart days for trend and distribution widgets. - Refactored the default lab layout to align with the updated widget catalog and ensure proper default activation. - Bumped app_dashboard version to 1.6.0 to reflect the addition of new widgets and configuration enhancements.
This commit is contained in:
1 parent
c0c512e942
commit
3d498d03c1
28 files changed
+1487
-243
No files matched your search
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Standard-Layout v1 (nur Pilot-Fallback ohne API).
|
||||
* Reihenfolge: gleich backend/widget_catalog.WIDGET_CATALOG bei Änderung dort mitpflegen
|
||||
* (oder später nur noch aus GET /api/app/dashboard-layout default_layout beziehen).
|
||||
* Standard-Layout v1 (nur Pilot `/pilot/viz` ohne API).
|
||||
* API-Nutzer: default_layout aus Backend (alle Katalog-IDs; aktiv = DEFAULT_LAB_WIDGET_IDS).
|
||||
* Diese Datei: kompakte feste 5 Widgets für den Pilot – nicht automatisch alle P1-Widgets.
|
||||
*/
|
||||
export const DEFAULT_LAB_LAYOUT = {
|
||||
version: 1,
|
||||
|
||||
@@ -6,6 +6,17 @@ import PilotQuickCapture from '../components/pilot/PilotQuickCapture'
|
||||
import PilotKpiBoard from '../components/pilot/PilotKpiBoard'
|
||||
import PilotBodySection from '../components/pilot/PilotBodySection'
|
||||
import PilotActivitySection from '../components/pilot/PilotActivitySection'
|
||||
import DashboardGreetingWidget from '../components/dashboard-widgets/DashboardGreetingWidget'
|
||||
import QuickWeightTodayWidget from '../components/dashboard-widgets/QuickWeightTodayWidget'
|
||||
import BodyStatStripWidget from '../components/dashboard-widgets/BodyStatStripWidget'
|
||||
import StatusPillsWidget from '../components/dashboard-widgets/StatusPillsWidget'
|
||||
import ProfileGoalsProgressWidget from '../components/dashboard-widgets/ProfileGoalsProgressWidget'
|
||||
import TrendKcalWeightWidget from '../components/dashboard-widgets/TrendKcalWeightWidget'
|
||||
import NutritionActivitySummaryWidget from '../components/dashboard-widgets/NutritionActivitySummaryWidget'
|
||||
import RecoverySleepRestWidget from '../components/dashboard-widgets/RecoverySleepRestWidget'
|
||||
import TrainingTypeDistributionWidget from '../components/dashboard-widgets/TrainingTypeDistributionWidget'
|
||||
import GoalsFocusTeaserWidget from '../components/dashboard-widgets/GoalsFocusTeaserWidget'
|
||||
import AiPipelineInsightWidget from '../components/dashboard-widgets/AiPipelineInsightWidget'
|
||||
import { normalizeBodyChartDays } from './bodyChartDays'
|
||||
import { registerDashboardWidget } from './dashboardWidgetRegistry'
|
||||
|
||||
@@ -49,6 +60,71 @@ export function ensurePilotLabWidgetsRegistered() {
|
||||
chartDays: normalizeBodyChartDays(ctx.layoutEntry?.config?.chart_days),
|
||||
}),
|
||||
})
|
||||
|
||||
registerDashboardWidget({
|
||||
id: 'dashboard_greeting',
|
||||
Component: DashboardGreetingWidget,
|
||||
mapProps: (ctx) => ({ refreshTick: ctx.refreshTick }),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'quick_weight_today',
|
||||
Component: QuickWeightTodayWidget,
|
||||
mapProps: (ctx) => ({ onSaved: ctx.requestRefresh }),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'body_stat_strip',
|
||||
Component: BodyStatStripWidget,
|
||||
mapProps: (ctx) => ({ refreshTick: ctx.refreshTick }),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'status_pills',
|
||||
Component: StatusPillsWidget,
|
||||
mapProps: (ctx) => ({ refreshTick: ctx.refreshTick }),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'profile_goals_progress',
|
||||
Component: ProfileGoalsProgressWidget,
|
||||
mapProps: (ctx) => ({ refreshTick: ctx.refreshTick }),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'trend_kcal_weight',
|
||||
Component: TrendKcalWeightWidget,
|
||||
mapProps: (ctx) => ({
|
||||
refreshTick: ctx.refreshTick,
|
||||
chartDays: ctx.layoutEntry?.config?.chart_days,
|
||||
}),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'nutrition_activity_summary',
|
||||
Component: NutritionActivitySummaryWidget,
|
||||
mapProps: (ctx) => ({ refreshTick: ctx.refreshTick }),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'recovery_sleep_rest',
|
||||
Component: RecoverySleepRestWidget,
|
||||
mapProps: () => ({}),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'training_type_distribution',
|
||||
Component: TrainingTypeDistributionWidget,
|
||||
mapProps: (ctx) => ({
|
||||
refreshTick: ctx.refreshTick,
|
||||
distributionDays:
|
||||
ctx.layoutEntry?.config?.distribution_days != null
|
||||
? Number(ctx.layoutEntry.config.distribution_days)
|
||||
: 28,
|
||||
}),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'goals_focus_teaser',
|
||||
Component: GoalsFocusTeaserWidget,
|
||||
mapProps: (ctx) => ({ refreshTick: ctx.refreshTick }),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'ai_pipeline_insight',
|
||||
Component: AiPipelineInsightWidget,
|
||||
mapProps: (ctx) => ({ refreshTick: ctx.refreshTick }),
|
||||
})
|
||||
}
|
||||
|
||||
/** @internal Nur für Tests */
|
||||
|
||||
Reference in new issue
Block a user