2026-04-07 11:47:16 +02:00
|
|
|
/**
|
|
|
|
|
* Pilot/Lab-Widgets registrieren. IDs müssen zu backend/widget_catalog.WIDGET_CATALOG passen.
|
|
|
|
|
*/
|
|
|
|
|
import PilotWelcome from '../components/pilot/PilotWelcome'
|
|
|
|
|
import PilotQuickCapture from '../components/pilot/PilotQuickCapture'
|
|
|
|
|
import PilotKpiBoard from '../components/pilot/PilotKpiBoard'
|
|
|
|
|
import PilotBodySection from '../components/pilot/PilotBodySection'
|
|
|
|
|
import PilotActivitySection from '../components/pilot/PilotActivitySection'
|
2026-04-07 14:19:45 +02:00
|
|
|
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'
|
2026-04-07 12:46:18 +02:00
|
|
|
import { normalizeBodyChartDays } from './bodyChartDays'
|
2026-04-07 11:47:16 +02:00
|
|
|
import { registerDashboardWidget } from './dashboardWidgetRegistry'
|
|
|
|
|
|
|
|
|
|
let _registered = false
|
|
|
|
|
|
|
|
|
|
export function ensurePilotLabWidgetsRegistered() {
|
|
|
|
|
if (_registered) return
|
|
|
|
|
_registered = true
|
|
|
|
|
|
|
|
|
|
registerDashboardWidget({
|
|
|
|
|
id: 'welcome',
|
|
|
|
|
Component: PilotWelcome,
|
|
|
|
|
mapProps: () => ({}),
|
|
|
|
|
})
|
|
|
|
|
registerDashboardWidget({
|
|
|
|
|
id: 'quick_capture',
|
|
|
|
|
Component: PilotQuickCapture,
|
|
|
|
|
mapProps: (ctx) => ({ onSaved: ctx.requestRefresh }),
|
|
|
|
|
})
|
|
|
|
|
registerDashboardWidget({
|
|
|
|
|
id: 'kpi_board',
|
|
|
|
|
Component: PilotKpiBoard,
|
2026-04-07 12:37:04 +02:00
|
|
|
mapProps: (ctx) => ({
|
|
|
|
|
refreshTick: ctx.refreshTick,
|
2026-04-07 12:46:18 +02:00
|
|
|
kpiConfig: ctx.layoutEntry?.config || {},
|
2026-04-07 12:37:04 +02:00
|
|
|
}),
|
2026-04-07 11:47:16 +02:00
|
|
|
})
|
|
|
|
|
registerDashboardWidget({
|
|
|
|
|
id: 'body_overview',
|
|
|
|
|
Component: PilotBodySection,
|
2026-04-07 11:58:07 +02:00
|
|
|
mapProps: (ctx) => ({
|
|
|
|
|
refreshTick: ctx.refreshTick,
|
|
|
|
|
chartDays: normalizeBodyChartDays(ctx.layoutEntry?.config?.chart_days),
|
|
|
|
|
}),
|
2026-04-07 11:47:16 +02:00
|
|
|
})
|
|
|
|
|
registerDashboardWidget({
|
|
|
|
|
id: 'activity_overview',
|
|
|
|
|
Component: PilotActivitySection,
|
2026-04-07 12:20:23 +02:00
|
|
|
mapProps: (ctx) => ({
|
|
|
|
|
refreshTick: ctx.refreshTick,
|
|
|
|
|
chartDays: normalizeBodyChartDays(ctx.layoutEntry?.config?.chart_days),
|
|
|
|
|
}),
|
2026-04-07 11:47:16 +02:00
|
|
|
})
|
2026-04-07 14:19:45 +02:00
|
|
|
|
|
|
|
|
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 }),
|
|
|
|
|
})
|
2026-04-07 11:47:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @internal Nur für Tests */
|
|
|
|
|
export function __resetPilotLabRegistrationForTests() {
|
|
|
|
|
_registered = false
|
|
|
|
|
}
|