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
@@ -22,9 +22,20 @@ const PERIODS = [
|
||||
|
||||
/**
|
||||
* Layer 2b: Kennzahlen und Charts nur aus GET /api/charts/fitness-dashboard-viz (activity_metrics).
|
||||
*
|
||||
* @param {number} [period] – gesteuert von außen (z. B. Verlauf `PeriodSelector`); mit `onPeriodChange` koppeln.
|
||||
* @param {(n: number) => void} [onPeriodChange]
|
||||
* @param {boolean} [hidePeriodSelector] – eigenes Zeitraum-Dropdown ausblenden (wenn die Seite oben schon einen Zeitraum wählt).
|
||||
*/
|
||||
export default function FitnessDashboardOverview() {
|
||||
const [period, setPeriod] = useState(28)
|
||||
export default function FitnessDashboardOverview({
|
||||
period: periodProp,
|
||||
onPeriodChange,
|
||||
hidePeriodSelector = false,
|
||||
}) {
|
||||
const [internalPeriod, setInternalPeriod] = useState(28)
|
||||
const controlled = periodProp !== undefined && typeof onPeriodChange === 'function'
|
||||
const period = controlled ? periodProp : internalPeriod
|
||||
const setPeriod = controlled ? onPeriodChange : setInternalPeriod
|
||||
const [viz, setViz] = useState(null)
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [err, setErr] = useState(null)
|
||||
@@ -104,25 +115,31 @@ export default function FitnessDashboardOverview() {
|
||||
const wUsed = viz.training_volume_weeks_used
|
||||
const dTyp = viz.training_type_dist_days_used
|
||||
|
||||
const showPeriodDropdown = !hidePeriodSelector && !controlled
|
||||
|
||||
return (
|
||||
<div className="card section-gap">
|
||||
<div className="card-title" style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 12 }}>
|
||||
<span>Fitness-Übersicht</span>
|
||||
<label style={{ fontSize: 12, fontWeight: 500, color: 'var(--text3)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
||||
Zeitraum
|
||||
<select
|
||||
className="form-input"
|
||||
style={{ maxWidth: 140, padding: '6px 10px', fontSize: 13 }}
|
||||
value={period}
|
||||
onChange={(e) => setPeriod(Number(e.target.value))}
|
||||
{showPeriodDropdown ? (
|
||||
<label
|
||||
style={{ fontSize: 12, fontWeight: 500, color: 'var(--text3)', display: 'flex', alignItems: 'center', gap: 8 }}
|
||||
>
|
||||
{PERIODS.map((p) => (
|
||||
<option key={p.v} value={p.v}>
|
||||
{p.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
Zeitraum
|
||||
<select
|
||||
className="form-input"
|
||||
style={{ maxWidth: 140, padding: '6px 10px', fontSize: 13 }}
|
||||
value={period}
|
||||
onChange={(e) => setPeriod(Number(e.target.value))}
|
||||
>
|
||||
{PERIODS.map((p) => (
|
||||
<option key={p.v} value={p.v}>
|
||||
{p.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<p style={{ fontSize: 11, color: 'var(--text3)', lineHeight: 1.45, marginBottom: 10 }}>
|
||||
|
||||
Reference in new issue
Block a user