feat: add body_history_viz widget and enhance configuration handling
Deploy Development / deploy (push) Successful in 55s
Build Test / pytest-backend (push) Successful in 8s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 17s

- Introduced the `body_history_viz` widget to the dashboard, allowing users to visualize body history data.
- Updated widget configuration to include `body_history_viz` in the allowed widgets and added validation for its configuration.
- Enhanced the widget catalog with details for the new `body_history_viz` entry.
- Added tests to ensure proper validation of the `body_history_viz` widget configuration.
- Updated application version to reflect the addition of the new widget.
This commit is contained in:
Lars committed 2026-04-22 07:00:24 +02:00
1 parent 3eb7ef3ae6
commit 2453da0da1
13 files changed
+1952 -545

No files matched your search

@@ -0,0 +1,29 @@
import { useNavigate } from 'react-router-dom'
import BodyHistoryVizSection from '../history/BodyHistoryVizSection'
import { useProfile } from '../../context/ProfileContext'
import { BODY_CHART_DAYS_DEFAULT, normalizeBodyChartDays } from '../../widgetSystem/bodyChartDays'
/**
* Verlauf → Körper als Dashboard-Widget: GET /charts/body-history-viz (Layer 2b), optional chart_days 7–90.
* @param {{ refreshTick?: number, chartDays?: number }} props
*/
export default function BodyHistoryVizWidget({ refreshTick = 0, chartDays }) {
const nav = useNavigate()
const { activeProfile } = useProfile()
const days = chartDays != null ? normalizeBodyChartDays(chartDays) : BODY_CHART_DAYS_DEFAULT
return (
<div className="card section-gap" style={{ marginBottom: 16 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 10 }}>
<div>
<div style={{ fontSize: 14, fontWeight: 700, color: 'var(--text1)' }}>Körper (Verlauf-Bundle)</div>
<div style={{ fontSize: 12, color: 'var(--text3)' }}>body-history-viz · {days} Tage</div>
</div>
<button type="button" className="btn btn-secondary" style={{ fontSize: 12, padding: '6px 12px' }} onClick={() => nav('/history', { state: { tab: 'body' } })}>
Verlauf →
</button>
</div>
<BodyHistoryVizSection key={`${refreshTick}-${days}`} profile={activeProfile} externalPeriod={days} embedded />
</div>
)
}