feat: remove deprecated demo route and enhance dashboard widget registration
- Removed outdated visualization demo route and fixed demo layout in the frontend. - Updated widget registration logic in `frontend/src/widgetSystem/registerDashboardWidgets.js` to ensure proper integration of core widgets. - Adjusted documentation in `.claude/docs/technical/DASHBOARD_WIDGETS_AGENT_GUIDE.md` and comments in `backend/widget_catalog.py` to reflect changes. - Added new dashboard widgets for activity and body overview, enhancing user experience and data visualization capabilities. - Bumped application version to reflect these changes.
This commit is contained in:
1 parent
725e7ffe4b
commit
ddc87ba5ae
18 files changed
+70
-138
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
/** Gleiche Logik wie History.jsx für rollierende Mittel */
|
||||
export function rollingAvg(arr, key, window = 7) {
|
||||
return arr.map((d, i) => {
|
||||
const s = arr
|
||||
.slice(Math.max(0, i - window + 1), i + 1)
|
||||
.map((x) => x[key])
|
||||
.filter((v) => v != null)
|
||||
return s.length
|
||||
? { ...d, [`${key}_avg`]: Math.round((s.reduce((a, b) => a + b, 0) / s.length) * 10) / 10 }
|
||||
: d
|
||||
})
|
||||
}
|
||||
|
||||
export const fmtDate = (d) => dayjs(d).format('DD.MM')
|
||||
@@ -1,15 +0,0 @@
|
||||
/**
|
||||
* 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,
|
||||
widgets: [
|
||||
{ id: 'welcome', enabled: true },
|
||||
{ id: 'quick_capture', enabled: true },
|
||||
{ id: 'kpi_board', enabled: true },
|
||||
{ id: 'body_overview', enabled: true },
|
||||
{ id: 'activity_overview', enabled: true },
|
||||
],
|
||||
}
|
||||
+13
-13
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* Pilot/Lab-Widgets registrieren. IDs müssen zu backend/widget_catalog.WIDGET_CATALOG passen.
|
||||
* Dashboard-Widget-Registry: Katalog-IDs aus backend/widget_catalog.WIDGET_CATALOG → React-Komponenten.
|
||||
*/
|
||||
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'
|
||||
import WelcomeWidget from '../components/dashboard-widgets-legacy/WelcomeWidget'
|
||||
import QuickCaptureWidget from '../components/dashboard-widgets-legacy/QuickCaptureWidget'
|
||||
import KpiBoardWidget from '../components/dashboard-widgets-legacy/KpiBoardWidget'
|
||||
import BodyOverviewWidget from '../components/dashboard-widgets-legacy/BodyOverviewWidget'
|
||||
import ActivityOverviewWidget from '../components/dashboard-widgets-legacy/ActivityOverviewWidget'
|
||||
import DashboardGreetingWidget from '../components/dashboard-widgets/DashboardGreetingWidget'
|
||||
import QuickWeightTodayWidget from '../components/dashboard-widgets/QuickWeightTodayWidget'
|
||||
import BodyStatStripWidget from '../components/dashboard-widgets/BodyStatStripWidget'
|
||||
@@ -34,18 +34,18 @@ import { registerDashboardWidget } from './dashboardWidgetRegistry'
|
||||
|
||||
let _registered = false
|
||||
|
||||
export function ensurePilotLabWidgetsRegistered() {
|
||||
export function ensureDashboardWidgetsRegistered() {
|
||||
if (_registered) return
|
||||
_registered = true
|
||||
|
||||
registerDashboardWidget({
|
||||
id: 'welcome',
|
||||
Component: PilotWelcome,
|
||||
Component: WelcomeWidget,
|
||||
mapProps: () => ({}),
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'quick_capture',
|
||||
Component: PilotQuickCapture,
|
||||
Component: QuickCaptureWidget,
|
||||
mapProps: (ctx) => ({
|
||||
onSaved: ctx.requestRefresh,
|
||||
captureConfig: ctx.layoutEntry?.config || {},
|
||||
@@ -53,7 +53,7 @@ export function ensurePilotLabWidgetsRegistered() {
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'kpi_board',
|
||||
Component: PilotKpiBoard,
|
||||
Component: KpiBoardWidget,
|
||||
mapProps: (ctx) => ({
|
||||
refreshTick: ctx.refreshTick,
|
||||
kpiConfig: ctx.layoutEntry?.config || {},
|
||||
@@ -61,7 +61,7 @@ export function ensurePilotLabWidgetsRegistered() {
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'body_overview',
|
||||
Component: PilotBodySection,
|
||||
Component: BodyOverviewWidget,
|
||||
mapProps: (ctx) => ({
|
||||
refreshTick: ctx.refreshTick,
|
||||
chartDays: normalizeBodyChartDays(ctx.layoutEntry?.config?.chart_days),
|
||||
@@ -77,7 +77,7 @@ export function ensurePilotLabWidgetsRegistered() {
|
||||
})
|
||||
registerDashboardWidget({
|
||||
id: 'activity_overview',
|
||||
Component: PilotActivitySection,
|
||||
Component: ActivityOverviewWidget,
|
||||
mapProps: (ctx) => ({
|
||||
refreshTick: ctx.refreshTick,
|
||||
chartDays: normalizeBodyChartDays(ctx.layoutEntry?.config?.chart_days),
|
||||
@@ -193,6 +193,6 @@ export function ensurePilotLabWidgetsRegistered() {
|
||||
}
|
||||
|
||||
/** @internal Nur für Tests */
|
||||
export function __resetPilotLabRegistrationForTests() {
|
||||
export function __resetDashboardWidgetRegistrationForTests() {
|
||||
_registered = false
|
||||
}
|
||||
Reference in new issue
Block a user