Files
homepage/src/routes/fitness/profile/+page.server.ts
Alexander Bocken 1c62819d18 fitness: add complete fitness tracker frontend
- 5-tab layout (Profile, History, Workout, Exercises, Measure) with shared header nav
- Workout system: template CRUD, active workout on /fitness/workout/active with localStorage persistence, pause/resume timer, rest timer, RPE input
- Shared workout singleton (getWorkout) so active workout state is accessible across all fitness routes
- Floating workout FAB indicator on all /fitness routes when workout is active
- AddActionButton component for button-based FABs (measure + template creation)
- Profile page with workouts-per-week bar chart and weight line chart with SMA trend line + ±1σ confidence band
- Exercise detail with history, charts, and records tabs using static exercise data
- Session history with grouped-by-month list, session detail with stats/PRs
- Body measurements with latest values, body part display, add form
- Card styling matching rosary/prayer route patterns (accent-dark, nord5 light, box-shadow, hover lift)
- FitnessChart: fix SSR hang by moving Chart.register to client-side, remove redundant $effect
- Exercise API: use static in-repo data instead of empty MongoDB collection
- Workout finish: include exercise name for WorkoutSession model validation
2026-03-19 08:17:55 +01:00

21 lines
634 B
TypeScript

import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ fetch, locals }) => {
console.time('[profile] total load');
console.time('[profile] auth');
const session = await locals.auth();
console.timeEnd('[profile] auth');
console.time('[profile] fetch /api/fitness/stats/profile');
const res = await fetch('/api/fitness/stats/profile');
console.timeEnd('[profile] fetch /api/fitness/stats/profile');
console.time('[profile] parse json');
const stats = await res.json();
console.timeEnd('[profile] parse json');
console.timeEnd('[profile] total load');
return { session, stats };
};