refactor: update fitness dashboard integration and terminology
- Changed the fitness overview path from `/activity` to `/history` and updated related navigation labels to reflect this change. - Refactored the `FitnessDashboardOverview` component to accept external period control and conditionally display the period selector. - Integrated the `FitnessDashboardOverview` into the `History` page, enhancing the user experience with consistent terminology and layout. - Removed the fitness overview from the `ActivityPage` to streamline the interface and focus on activity data collection.
This commit is contained in:
1 parent
b5c5f2f612
commit
22c5f695c9
5 files changed
+60
-35
No files matched your search
@@ -3,7 +3,6 @@ import { Upload, Pencil, Trash2, Check, X, CheckCircle } from 'lucide-react'
|
||||
import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer, CartesianGrid } from 'recharts'
|
||||
import { api } from '../utils/api'
|
||||
import UsageBadge from '../components/UsageBadge'
|
||||
import FitnessDashboardOverview from '../components/FitnessDashboardOverview'
|
||||
import TrainingTypeSelect from '../components/TrainingTypeSelect'
|
||||
import BulkCategorize from '../components/BulkCategorize'
|
||||
import dayjs from 'dayjs'
|
||||
@@ -913,12 +912,7 @@ export default function ActivityPage() {
|
||||
|
||||
return (
|
||||
<div className="capture-page">
|
||||
<h1 className="page-title">Fitness</h1>
|
||||
<p style={{ fontSize: 12, color: 'var(--text3)', marginTop: -8, marginBottom: 12 }}>
|
||||
Auswertung (Data-Layer) und Erfassung an einem Ort.
|
||||
</p>
|
||||
|
||||
<FitnessDashboardOverview />
|
||||
<h1 className="page-title">Aktivität</h1>
|
||||
|
||||
<div className="tabs" style={{overflowX:'auto',flexWrap:'nowrap'}}>
|
||||
<button className={'tab'+(tab==='list'?' active':'')} onClick={()=>setTab('list')}>Verlauf</button>
|
||||
|
||||
@@ -14,6 +14,7 @@ import { getStatusColor, getStatusBg } from '../utils/interpret'
|
||||
import { MACRO_CHART, macroFillByName, NUTRITION_MACRO_CHART_BLOCK_PX } from '../utils/macroChartTheme'
|
||||
import Markdown from '../utils/Markdown'
|
||||
import TrainingTypeDistribution from '../components/TrainingTypeDistribution'
|
||||
import FitnessDashboardOverview from '../components/FitnessDashboardOverview'
|
||||
import NutritionCharts, { WeeklyMacroDistributionPanel } from '../components/NutritionCharts'
|
||||
import RecoveryCharts from '../components/RecoveryCharts'
|
||||
import KpiTilesOverview from '../components/KpiTilesOverview'
|
||||
@@ -1097,16 +1098,14 @@ function NutritionSection({ profile, insights, onRequest, loadingSlug, filterAct
|
||||
)
|
||||
}
|
||||
|
||||
// ── Activity Section ──────────────────────────────────────────────────────────
|
||||
// ── Activity Section — Layer 2b Fitness-Bundle wie Körper/Ernährung auf /history ─
|
||||
function ActivitySection({ activities, insights, onRequest, loadingSlug, filterActiveSlugs, globalQualityLevel }) {
|
||||
const [period, setPeriod] = useState(30)
|
||||
if (!activities?.length) return (
|
||||
<EmptySection text="Noch keine Aktivitätsdaten." to="/activity" toLabel="Fitness erfassen"/>
|
||||
)
|
||||
const cutoff = dayjs().subtract(period,'day').format('YYYY-MM-DD')
|
||||
|
||||
// Issue #31: Backend already filters by global quality level - only filter by period here
|
||||
const filtA = activities.filter(d => period === 9999 || d.date >= cutoff)
|
||||
const actList = activities || []
|
||||
const filtA = actList.filter(d => period === 9999 || d.date >= cutoff)
|
||||
|
||||
const byDate={}
|
||||
filtA.forEach(a=>{ byDate[a.date]=(byDate[a.date]||0)+(a.kcal_active||0) })
|
||||
@@ -1130,13 +1129,24 @@ function ActivitySection({ activities, insights, onRequest, loadingSlug, filterA
|
||||
value:consistency+'%'
|
||||
}]
|
||||
|
||||
const hasList = actList.length > 0
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SectionHeader title="🏋️ Fitness" to="/activity" toLabel="Alle Einträge" lastUpdated={activities[0]?.date}/>
|
||||
<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 }}>
|
||||
Fitness-Kennzahlen und Diagramme (Layer 2b) kommen aus dem Aktivitäts-Data-Layer — dieselbe Quelle wie die
|
||||
KI-Platzhalter. Zeitraum gilt auch für die Liste unten.
|
||||
</p>
|
||||
<FitnessDashboardOverview period={period} onPeriodChange={setPeriod} hidePeriodSelector />
|
||||
|
||||
{!hasList ? (
|
||||
<EmptySection text="Noch keine Aktivitätsdaten im Verlauf." to="/activity" toLabel="Aktivität erfassen" />
|
||||
) : null}
|
||||
|
||||
{/* Issue #31: Show active global quality filter */}
|
||||
{globalQualityLevel && globalQualityLevel !== 'all' && (
|
||||
{hasList && globalQualityLevel && globalQualityLevel !== 'all' && (
|
||||
<div style={{
|
||||
marginBottom:12, padding:'8px 12px', borderRadius:8,
|
||||
background:'var(--surface2)', border:'1px solid var(--border)',
|
||||
@@ -1156,6 +1166,8 @@ function ActivitySection({ activities, insights, onRequest, loadingSlug, filterA
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!hasList ? null : (
|
||||
<>
|
||||
<div style={{display:'flex',gap:6,marginBottom:12}}>
|
||||
{[['Trainings',filtA.length,'var(--text1)'],['Kcal',totalKcal,'#EF9F27'],
|
||||
['Stunden',Math.round(totalMin/60*10)/10,'#378ADD'],
|
||||
@@ -1186,7 +1198,7 @@ function ActivitySection({ activities, insights, onRequest, loadingSlug, filterA
|
||||
<div key={type} style={{display:'flex',alignItems:'center',gap:8,padding:'4px 0',borderBottom:'1px solid var(--border)'}}>
|
||||
<div style={{flex:1,fontSize:13}}>{type}</div>
|
||||
<div style={{fontSize:12,color:'var(--text3)'}}>{count}×</div>
|
||||
<div style={{width:Math.max(4,Math.round(count/filtA.length*80)),height:6,background:'#EF9F2788',borderRadius:3}}/>
|
||||
<div style={{width:Math.max(4,Math.round(count/Math.max(1,filtA.length)*80)),height:6,background:'#EF9F2788',borderRadius:3}}/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
@@ -1199,6 +1211,8 @@ function ActivitySection({ activities, insights, onRequest, loadingSlug, filterA
|
||||
{actRules.map((item,i)=><RuleCard key={i} item={item}/>)}
|
||||
</div>
|
||||
<InsightBox insights={insights} slugs={filterActiveSlugs(['aktivitaet'])} onRequest={onRequest} loading={loadingSlug}/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user