feat: introduce recovery dashboard visualization and refactor recovery charts
- Added a new endpoint for the recovery dashboard visualization in `charts.py`, integrating multiple recovery metrics and insights. - Implemented the `get_recovery_dashboard_viz` function to streamline data retrieval for recovery-related charts. - Refactored the `RecoveryCharts` component to utilize the new `RecoveryDashboardOverview`, simplifying the component structure and enhancing maintainability. - Updated the `RecoveryChartsPanelWidget` and `History` page to reflect the new recovery dashboard, improving user navigation and experience. - Deprecated the old recovery charts component, encouraging the use of the new overview for better data presentation.
This commit is contained in:
1 parent
bf84e3c2a5
commit
f42d3a9c92
9 files changed
+1219
-857
No files matched your search
@@ -15,7 +15,7 @@ import { MACRO_CHART, macroFillByName, NUTRITION_MACRO_CHART_BLOCK_PX } from '..
|
||||
import Markdown from '../utils/Markdown'
|
||||
import FitnessDashboardOverview from '../components/FitnessDashboardOverview'
|
||||
import NutritionCharts, { WeeklyMacroDistributionPanel } from '../components/NutritionCharts'
|
||||
import RecoveryCharts from '../components/RecoveryCharts'
|
||||
import RecoveryDashboardOverview from '../components/RecoveryDashboardOverview'
|
||||
import KpiTilesOverview from '../components/KpiTilesOverview'
|
||||
import dayjs from 'dayjs'
|
||||
import 'dayjs/locale/de'
|
||||
@@ -1108,11 +1108,15 @@ function ActivitySection({ activities, insights, onRequest, loadingSlug, filterA
|
||||
<SectionHeader title="🏋️ Fitness" to="/activity" toLabel="Alle Einträge" lastUpdated={actList[0]?.date}/>
|
||||
<PeriodSelector value={period} onChange={setPeriod}/>
|
||||
<p style={{ fontSize: 11, color: 'var(--text3)', lineHeight: 1.45, marginBottom: 10 }}>
|
||||
Auswertung ausschließlich aus dem Fitness-Bundle (Data-Layer / Issue 53). Zeitraum-Buttons steuern dasselbe
|
||||
Fenster wie die API.
|
||||
Fitness und Erholung aus den Data-Layer-Bundles (Issue 53). Zeitraum-Buttons steuern beide Bereiche gleichzeitig.
|
||||
</p>
|
||||
<FitnessDashboardOverview period={period} onPeriodChange={setPeriod} hidePeriodSelector />
|
||||
|
||||
<div style={{ fontSize: 12, fontWeight: 600, color: 'var(--text3)', marginBottom: 8, marginTop: 20 }}>
|
||||
Erholung (Schlaf, HRV, Vitalwerte)
|
||||
</div>
|
||||
<RecoveryDashboardOverview period={period} onPeriodChange={setPeriod} hidePeriodSelector />
|
||||
|
||||
{hasList && globalQualityLevel && globalQualityLevel !== 'all' && (
|
||||
<div style={{
|
||||
marginTop: 12,
|
||||
@@ -1134,9 +1138,12 @@ function ActivitySection({ activities, insights, onRequest, loadingSlug, filterA
|
||||
</div>
|
||||
)}
|
||||
|
||||
{hasList ? (
|
||||
<InsightBox insights={insights} slugs={filterActiveSlugs(['aktivitaet'])} onRequest={onRequest} loading={loadingSlug}/>
|
||||
) : null}
|
||||
<InsightBox
|
||||
insights={insights}
|
||||
slugs={filterActiveSlugs(['aktivitaet', 'gesundheit'])}
|
||||
onRequest={onRequest}
|
||||
loading={loadingSlug}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1432,32 +1439,10 @@ function PhotoGrid() {
|
||||
}
|
||||
|
||||
// ── Main ──────────────────────────────────────────────────────────────────────
|
||||
// ── Recovery Section ──────────────────────────────────────────────────────────
|
||||
function RecoverySection({ insights, onRequest, loadingSlug, filterActiveSlugs }) {
|
||||
const [period, setPeriod] = useState(28)
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SectionHeader title="😴 Erholung & Vitalwerte" to="/vitals" toLabel="Daten"/>
|
||||
<PeriodSelector value={period} onChange={setPeriod}/>
|
||||
|
||||
<div style={{marginBottom:12,fontSize:13,color:'var(--text2)',lineHeight:1.6}}>
|
||||
Erholung, Schlaf, HRV, Ruhepuls und weitere Vitalwerte im Überblick.
|
||||
</div>
|
||||
|
||||
{/* Recovery Charts (Phase 0c) */}
|
||||
<RecoveryCharts days={period === 9999 ? 90 : period} />
|
||||
|
||||
<InsightBox insights={insights} slugs={filterActiveSlugs(['gesundheit'])} onRequest={onRequest} loading={loadingSlug}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const TABS = [
|
||||
{ id:'body', label:'⚖️ Körper' },
|
||||
{ id:'nutrition', label:'🍽️ Ernährung' },
|
||||
{ id:'activity', label:'🏋️ Fitness' },
|
||||
{ id:'recovery', label:'😴 Erholung' },
|
||||
{ id:'correlation', label:'🔗 Korrelation' },
|
||||
{ id:'photos', label:'📷 Fotos' },
|
||||
]
|
||||
@@ -1497,6 +1482,10 @@ export default function History() {
|
||||
|
||||
useEffect(() => {
|
||||
const t = location.state?.tab
|
||||
if (t === 'recovery') {
|
||||
setTab('activity')
|
||||
return
|
||||
}
|
||||
if (t && TABS.some(x => x.id === t)) setTab(t)
|
||||
}, [location.state?.tab])
|
||||
|
||||
@@ -1544,7 +1533,6 @@ export default function History() {
|
||||
{tab==='body' && <BodySection profile={profile} {...sp}/>}
|
||||
{tab==='nutrition' && <NutritionSection profile={profile} {...sp}/>}
|
||||
{tab==='activity' && <ActivitySection activities={activities} globalQualityLevel={activeProfile?.quality_filter_level} {...sp}/>}
|
||||
{tab==='recovery' && <RecoverySection {...sp}/>}
|
||||
{tab==='correlation' && <CorrelationSection corrData={corrData} profile={profile} {...sp}/>}
|
||||
{tab==='photos' && <PhotoGrid/>}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user