feat: add fitness_history_viz widget and enhance configuration handling
- Introduced the `fitness_history_viz` widget to the dashboard, enabling users to visualize fitness history data. - Updated widget configuration to include `fitness_history_viz` in the allowed widgets and added validation for its configuration. - Enhanced the widget catalog with details for the new `fitness_history_viz` entry. - Implemented default values and validation logic for the widget's configuration, ensuring proper handling of user inputs. - Added tests to ensure proper validation of the `fitness_history_viz` widget configuration. - Bumped application version to reflect the addition of the new widget.
This commit is contained in:
1 parent
db5557e4aa
commit
d22e0ba0a7
14 files changed
+616
-179
No files matched your search
@@ -13,6 +13,7 @@ import KpiBoardConfigEditor from '../widgetSystem/KpiBoardConfigEditor'
|
||||
import QuickCaptureConfigEditor from '../widgetSystem/QuickCaptureConfigEditor'
|
||||
import BodyHistoryVizConfigEditor from '../widgetSystem/BodyHistoryVizConfigEditor'
|
||||
import NutritionHistoryVizConfigEditor from '../widgetSystem/NutritionHistoryVizConfigEditor'
|
||||
import FitnessHistoryVizConfigEditor from '../widgetSystem/FitnessHistoryVizConfigEditor'
|
||||
import {
|
||||
moveWidget,
|
||||
moveWidgetToIndex,
|
||||
@@ -26,6 +27,7 @@ const CHART_DAYS_WIDGET_IDS = new Set([
|
||||
'activity_overview',
|
||||
'nutrition_detail_charts',
|
||||
'nutrition_history_viz',
|
||||
'fitness_history_viz',
|
||||
'recovery_charts_panel',
|
||||
])
|
||||
|
||||
@@ -533,6 +535,23 @@ export default function DashboardConfigurePage({ adminMode = false } = {}) {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{w.id === 'fitness_history_viz' && (
|
||||
<FitnessHistoryVizConfigEditor
|
||||
config={w.config || {}}
|
||||
onChange={(next) =>
|
||||
setLayout((L) =>
|
||||
normalizeLayoutForEditor({
|
||||
...L,
|
||||
widgets: L.widgets.map((x, j) => {
|
||||
if (j !== i) return x
|
||||
if (Object.keys(next).length === 0) return { ...x, config: {} }
|
||||
return { ...x, config: { ...(x.config || {}), ...next } }
|
||||
}),
|
||||
})
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
|
||||
@@ -14,6 +14,7 @@ import KpiBoardConfigEditor from '../widgetSystem/KpiBoardConfigEditor'
|
||||
import QuickCaptureConfigEditor from '../widgetSystem/QuickCaptureConfigEditor'
|
||||
import BodyHistoryVizConfigEditor from '../widgetSystem/BodyHistoryVizConfigEditor'
|
||||
import NutritionHistoryVizConfigEditor from '../widgetSystem/NutritionHistoryVizConfigEditor'
|
||||
import FitnessHistoryVizConfigEditor from '../widgetSystem/FitnessHistoryVizConfigEditor'
|
||||
import { moveWidget, normalizeLayoutForEditor, toggleWidget } from '../widgetSystem/layoutEditor'
|
||||
|
||||
/** Widgets mit optionalem config.chart_days (7–90), gleiche UX im Editor */
|
||||
@@ -23,6 +24,7 @@ const CHART_DAYS_WIDGET_IDS = new Set([
|
||||
'activity_overview',
|
||||
'nutrition_detail_charts',
|
||||
'nutrition_history_viz',
|
||||
'fitness_history_viz',
|
||||
'recovery_charts_panel',
|
||||
])
|
||||
|
||||
@@ -330,7 +332,9 @@ export default function DashboardLabPage() {
|
||||
? 'Ernährung — Charts'
|
||||
: w.id === 'nutrition_history_viz'
|
||||
? 'Ernährung (Verlauf-Bundle)'
|
||||
: 'Erholung — Charts'}{' '}
|
||||
: w.id === 'fitness_history_viz'
|
||||
? 'Fitness (Verlauf-Bundle)'
|
||||
: 'Erholung — Charts'}{' '}
|
||||
— Zeitraum (Tage): {BODY_CHART_DAYS_MIN}–{BODY_CHART_DAYS_MAX}
|
||||
</label>
|
||||
<input
|
||||
@@ -350,7 +354,9 @@ export default function DashboardLabPage() {
|
||||
? 'Ernährungs-Charts Zeitraum in Tagen'
|
||||
: w.id === 'nutrition_history_viz'
|
||||
? 'Ernährung Verlauf-Bundle Zeitraum in Tagen'
|
||||
: 'Erholungs-Charts Zeitraum in Tagen'
|
||||
: w.id === 'fitness_history_viz'
|
||||
? 'Fitness Verlauf-Bundle Zeitraum in Tagen'
|
||||
: 'Erholungs-Charts Zeitraum in Tagen'
|
||||
}
|
||||
value={
|
||||
chartDaysDraftByWidgetId[w.id] !== undefined
|
||||
@@ -420,6 +426,23 @@ export default function DashboardLabPage() {
|
||||
}
|
||||
/>
|
||||
)}
|
||||
{w.id === 'fitness_history_viz' && (
|
||||
<FitnessHistoryVizConfigEditor
|
||||
config={w.config || {}}
|
||||
onChange={(next) =>
|
||||
setLayout((L) =>
|
||||
normalizeLayoutForEditor({
|
||||
...L,
|
||||
widgets: L.widgets.map((x, j) => {
|
||||
if (j !== i) return x
|
||||
if (Object.keys(next).length === 0) return { ...x, config: {} }
|
||||
return { ...x, config: { ...(x.config || {}), ...next } }
|
||||
}),
|
||||
})
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
|
||||
@@ -12,7 +12,7 @@ import { api } from '../utils/api'
|
||||
import { photoMonthKey, photoSortKey, formatPhotoCaption } from '../utils/photoDisplay'
|
||||
import { getStatusColor, getStatusBg } from '../utils/interpret'
|
||||
import Markdown from '../utils/Markdown'
|
||||
import FitnessDashboardOverview from '../components/FitnessDashboardOverview'
|
||||
import FitnessHistoryVizSection from '../components/history/FitnessHistoryVizSection'
|
||||
import RecoveryDashboardOverview from '../components/RecoveryDashboardOverview'
|
||||
import BodyHistoryVizSection from '../components/history/BodyHistoryVizSection'
|
||||
import NutritionHistoryVizSection from '../components/history/NutritionHistoryVizSection'
|
||||
@@ -100,7 +100,7 @@ function ActivitySection({ activityLastDate, insights, onRequest, loadingSlug, f
|
||||
<p style={{ fontSize: 11, color: 'var(--text3)', lineHeight: 1.45, marginBottom: 10 }}>
|
||||
Fitness und Erholung aus den Data-Layer-Bundles (Issue 53). Zeitraum-Buttons steuern beide Bereiche gleichzeitig.
|
||||
</p>
|
||||
<FitnessDashboardOverview period={period} onPeriodChange={setPeriod} hidePeriodSelector />
|
||||
<FitnessHistoryVizSection period={period} onPeriodChange={setPeriod} hidePeriodSelector />
|
||||
|
||||
<div style={{ fontSize: 12, fontWeight: 600, color: 'var(--text3)', marginBottom: 8, marginTop: 20 }}>
|
||||
Erholung (Schlaf, HRV, Vitalwerte)
|
||||
|
||||
Reference in new issue
Block a user