feat: update history_overview_viz configuration and validation
- Replaced the `show_area_summaries` option with individual section visibility settings (`show_section_body`, `show_section_nutrition`, `show_section_fitness`, `show_section_recovery`) in the `history_overview_viz` widget configuration. - Implemented migration logic to handle legacy `show_area_summaries` settings, ensuring backward compatibility. - Updated validation logic to enforce visibility requirements for the new section keys. - Enhanced tests to cover new configuration scenarios and validate the migration logic. - Bumped application version to reflect these changes.
This commit is contained in:
1 parent
97dbb0f80b
commit
725e7ffe4b
7 files changed
+121
-25
No files matched your search
@@ -363,6 +363,20 @@ export default function HistoryOverviewVizSection({
|
||||
const vis =
|
||||
visibilityProp != null ? normalizeHistoryOverviewVizConfig(visibilityProp) : HISTORY_OVERVIEW_VIZ_PAGE_FULL
|
||||
|
||||
const sectionTileEnabled = (id) => {
|
||||
if (id === 'body') return vis.show_section_body
|
||||
if (id === 'nutrition') return vis.show_section_nutrition
|
||||
if (id === 'fitness') return vis.show_section_fitness
|
||||
if (id === 'recovery') return vis.show_section_recovery
|
||||
return true
|
||||
}
|
||||
const wantsAnySectionTile =
|
||||
vis.show_section_body ||
|
||||
vis.show_section_nutrition ||
|
||||
vis.show_section_fitness ||
|
||||
vis.show_section_recovery
|
||||
const visibleSections = wantsAnySectionTile ? sections.filter((s) => sectionTileEnabled(s.id)) : []
|
||||
|
||||
return (
|
||||
<div>
|
||||
{!embedded && <SectionHeader title="📊 Gesamtansicht" />}
|
||||
@@ -402,11 +416,11 @@ export default function HistoryOverviewVizSection({
|
||||
</p>
|
||||
)}
|
||||
|
||||
{vis.show_area_summaries && (sections.length === 0 ? (
|
||||
{wantsAnySectionTile && (visibleSections.length === 0 ? (
|
||||
<EmptySection text="Keine Bereichsdaten." />
|
||||
) : (
|
||||
<div style={{ display: 'grid', gridTemplateColumns: '1fr', gap: 10 }}>
|
||||
{sections.map((sec) => {
|
||||
{visibleSections.map((sec) => {
|
||||
const tone = overviewSectionTone(sec)
|
||||
const stripe = getStatusColor(tone)
|
||||
const badgeBg = getStatusBg(tone)
|
||||
|
||||
Reference in new issue
Block a user