feat: enhance body_history_viz widget configuration and validation
- Added new configuration options for the `body_history_viz` widget, including visibility settings for various charts and KPIs. - Implemented default values for the widget's configuration to streamline user experience. - Enhanced validation logic to ensure proper handling of configuration inputs, including error handling for unknown keys and visibility requirements. - Updated tests to cover new configuration scenarios and validation rules for the `body_history_viz` widget. - Bumped application version to reflect these changes.
This commit is contained in:
1 parent
01c0d1745f
commit
20f195aca1
11 files changed
+400
-50
No files matched your search
@@ -1,16 +1,18 @@
|
||||
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'
|
||||
import { normalizeBodyChartDays } from '../../widgetSystem/bodyChartDays'
|
||||
import { normalizeBodyHistoryVizConfig } from '../../widgetSystem/bodyHistoryVizConfig'
|
||||
|
||||
/**
|
||||
* Verlauf → Körper als Dashboard-Widget: GET /charts/body-history-viz (Layer 2b), optional chart_days 7–90.
|
||||
* @param {{ refreshTick?: number, chartDays?: number }} props
|
||||
* Verlauf → Körper als Dashboard-Widget: GET /charts/body-history-viz (Layer 2b), Umfang über Layout-Config.
|
||||
* @param {{ refreshTick?: number, bodyHistoryVizConfig?: Record<string, unknown> }} props
|
||||
*/
|
||||
export default function BodyHistoryVizWidget({ refreshTick = 0, chartDays }) {
|
||||
export default function BodyHistoryVizWidget({ refreshTick = 0, bodyHistoryVizConfig }) {
|
||||
const nav = useNavigate()
|
||||
const { activeProfile } = useProfile()
|
||||
const days = chartDays != null ? normalizeBodyChartDays(chartDays) : BODY_CHART_DAYS_DEFAULT
|
||||
const cfg = normalizeBodyHistoryVizConfig(bodyHistoryVizConfig)
|
||||
const days = normalizeBodyChartDays(cfg.chart_days)
|
||||
|
||||
return (
|
||||
<div className="card section-gap" style={{ marginBottom: 16 }}>
|
||||
@@ -23,7 +25,13 @@ export default function BodyHistoryVizWidget({ refreshTick = 0, chartDays }) {
|
||||
Verlauf →
|
||||
</button>
|
||||
</div>
|
||||
<BodyHistoryVizSection key={`${refreshTick}-${days}`} profile={activeProfile} externalPeriod={days} embedded />
|
||||
<BodyHistoryVizSection
|
||||
key={`${refreshTick}-${days}`}
|
||||
profile={activeProfile}
|
||||
externalPeriod={days}
|
||||
embedded
|
||||
visibility={cfg}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user