Self-hosted fitness tracker. Log workouts, track nutrition, and monitor progress. Docker deployment, mobile-friendly.
Add workout/program detail pages, exercise seeding controls, and nav improvements
Cawlummb4b0c4a6c503
diff --git a/README.md b/README.mdindex f31f539..3be3ce9 100644--- a/README.md+++ b/README.md@@ -21,9 +21,9 @@<img src="docs/screenshots/dashboard-desktop.png" width="700" alt="Dashboard desktop" /></p>-> **Early beta** — actively being built. Expect rough edges and frequent updates. Issues and feedback are welcome.+> **Early beta** — actively being built. Expect rough edges and frequent updates. Issues and feedback are welcome. The software equivalent of going to the gym for the first time.-> **First official beta release coming soon** — stay tuned.+> **First official beta release coming soon** — stay tuned. Unlike your scheduled rest day, this one won't keep getting pushed back.---@@ -44,6 +44,8 @@## Quick Start+> Yes, it runs in Docker. No, you don't need to know Go. No, there's no cloud subscription. You're welcome.+```bashgit clone https://github.com/Cawlumm/lyftr.gitcd lyftr@@ -72,9 +74,35 @@ All variables live in `.env` at the project root.---+## Exercise Library++On first startup, Lyftr automatically seeds 800+ exercises from [free-exercise-db](https://github.com/yuhonas/free-exercise-db) in the background. No API key. No setup required. It just works.++```+[startup] exercises table empty — fetching from free-exercise-db...+[startup] seed: synced 868 exercises+```++The seed runs async so the server is immediately available. Exercises appear in the UI within a few seconds.++**Re-seed / reset exercises** (requires an account):++```bash+# Check seeding status+curl -H "Authorization: Bearer <token>" http://localhost/api/v1/admin/seed-status++# Force re-sync (upserts — does not wipe)+curl -X POST -H "Authorization: Bearer <token>" http://localhost/api/v1/admin/sync-exercises++# Wipe and re-seed from scratch+curl -X POST -H "Authorization: Bearer <token>" http://localhost/api/v1/admin/reset-exercises+```++---+## Data & Backups-All workout data is stored in `./data/lyftr.db` (SQLite). Back this up regularly.+All workout data is stored in `./data/lyftr.db` (SQLite). Back this up regularly. It's one file. You have no excuse.```bash# Backup@@ -88,6 +116,8 @@ docker compose pull && docker compose up -d## Running on a VPS+> Because paying $15/month for a fitness app subscription is money better spent on protein powder.+```bashsudo apt update && sudo apt install -y docker.io docker-compose-plugin@@ -145,7 +175,7 @@ See `backend/config/config.go` for all supported environment variables.## Contributing-Bug reports, feature requests, and pull requests are all welcome. Open an issue to start a discussion before submitting large changes.+Bug reports, feature requests, and pull requests are all welcome. Open an issue before submitting large changes — unlike leg day, communication should not be skipped.---diff --git a/backend/controllers/exercises.go b/backend/controllers/exercises.goindex 0feb905..d198bfb 100644--- a/backend/controllers/exercises.go+++ b/backend/controllers/exercises.go@@ -85,6 +85,20 @@ func SyncExercises(c *gin.Context) {utils.OK(c, gin.H{"synced": true, "total": count})}+// ExerciseSeedStatus returns exercise count and whether seeding is running.+func ExerciseSeedStatus(c *gin.Context) {+ utils.OK(c, seed.GetSeedStatus(db.DB))+}++// ResetExercises wipes the exercises table and triggers a fresh seed in background.+func ResetExercises(c *gin.Context) {+ if err := seed.WipeAndReseed(db.DB); err != nil {+ utils.BadRequest(c, err.Error())+ return+ }+ utils.OK(c, gin.H{"reset": true, "message": "exercises wiped, re-seeding in background"})+}+type scanner interface {Scan(dest ...any) error}diff --git a/backend/routes/routes.go b/backend/routes/routes.goindex d7eab68..29c7f27 100644--- a/backend/routes/routes.go+++ b/backend/routes/routes.go@@ -81,5 +81,7 @@ func Setup(r *gin.Engine) {// Adminprotected.POST("admin/sync-exercises", controllers.SyncExercises)+ protected.GET("admin/seed-status", controllers.ExerciseSeedStatus)+ protected.POST("admin/reset-exercises", controllers.ResetExercises)}}diff --git a/backend/seed/exercises.go b/backend/seed/exercises.goindex 6e9b8c6..4aa505a 100644--- a/backend/seed/exercises.go+++ b/backend/seed/exercises.go@@ -8,14 +8,17 @@ import ("log""net/http""strings"+ "sync/atomic""time")const (- exerciseDBURL = "https://raw.githubusercontent.com/yuhonas/free-exercise-db/main/dist/exercises.json"- imageBaseURL = "https://raw.githubusercontent.com/yuhonas/free-exercise-db/main/exercises"+ exerciseDBURL = "https://raw.githubusercontent.com/yuhonas/free-exercise-db/main/dist/exercises.json"+ imageBaseURL = "https://raw.githubusercontent.com/yuhonas/free-exercise-db/main/exercises")+var seeding atomic.Bool+type freeExerciseItem struct {ID string `json:"id"`Name string `json:"name"`@@ -30,6 +33,18 @@ type freeExerciseItem struct {Images []string `json:"images"`}+// SeedStatus returns current exercise count and whether a seed is running.+type SeedStatus struct {+ Count int `json:"count"`+ InProgress bool `json:"in_progress"`+}++func GetSeedStatus(db *sql.DB) SeedStatus {+ var count int+ db.QueryRow(`SELECT COUNT(*) FROM exercises`).Scan(&count)+ return SeedStatus{Count: count, InProgress: seeding.Load()}+}+// Exercises seeds on first run if the table is empty (async to avoid blocking startup).func Exercises(db *sql.DB) {var count int@@ -55,7 +70,23 @@ func SyncExercises(db *sql.DB) error {return fetchAndStore(db)}+// WipeAndReseed deletes all exercises then re-fetches from source.+func WipeAndReseed(db *sql.DB) error {+ if seeding.Load() {+ return fmt.Errorf("seed already in progress")+ }+ if _, err := db.Exec(`DELETE FROM exercises`); err != nil {+ return fmt.Errorf("wipe failed: %w", err)+ }+ log.Println("seed: exercises wiped, starting re-seed...")+ go fetchAndStoreAsync(db)+ return nil+}+func fetchAndStore(db *sql.DB) error {+ seeding.Store(true)+ defer seeding.Store(false)+items, err := fetchAll()if err != nil {return errdiff --git a/web/src/App.tsx b/web/src/App.tsxindex 7d94e62..e5287a0 100644--- a/web/src/App.tsx+++ b/web/src/App.tsx@@ -14,6 +14,8 @@ import AddProgram from './pages/AddProgram'import EditProgram from './pages/EditProgram'import AddWorkout from './pages/AddWorkout'import EditWorkout from './pages/EditWorkout'+import WorkoutDetail from './pages/WorkoutDetail'+import ProgramDetail from './pages/ProgramDetail'import Food from './pages/Food'import Weight from './pages/Weight'import Settings from './pages/Settings'@@ -41,14 +43,17 @@ function App() {<Route path="/" element={<Dashboard />} /><Route path="/workouts" element={<Workouts />} /><Route path="/workouts/new" element={<AddWorkout />} />+ <Route path="/workouts/:id" element={<WorkoutDetail />} /><Route path="/workouts/:id/edit" element={<EditWorkout />} /><Route path="/programs" element={<Programs />} /><Route path="/programs/new" element={<AddProgram />} />+ <Route path="/programs/:id" element={<ProgramDetail />} /><Route path="/programs/:id/edit" element={<EditProgram />} /><Route path="/workout/start" element={<StartWorkout />} /><Route path="/workout/active" element={<ActiveWorkout />} /><Route path="/workout/active/add-exercise" element={<WorkoutExercisePicker />} /><Route path="/workout/active/exercise/:exerciseId" element={<ExerciseDetail />} />+ <Route path="/exercises/:exerciseId" element={<ExerciseDetail />} /><Route path="/food" element={<Food />} /><Route path="/weight" element={<Weight />} /><Route path="/settings" element={<Settings />} />diff --git a/web/src/pages/Dashboard.tsx b/web/src/pages/Dashboard.tsxindex 10ceb41..fb6e1b6 100644--- a/web/src/pages/Dashboard.tsx+++ b/web/src/pages/Dashboard.tsx@@ -26,7 +26,7 @@ function greeting() {}const calcVolume = (w: types.Workout) =>- w.exercises.reduce((s, ex) => s + ex.sets.reduce((ss, set) => ss + set.reps * set.weight, 0), 0)+ (w.exercises ?? []).reduce((s, ex) => s + (ex.sets ?? []).reduce((ss, set) => ss + set.reps * set.weight, 0), 0)const DEFAULT_FOOD: types.DailyStats = {date: format(TODAY, 'yyyy-MM-dd'),@@ -201,9 +201,9 @@ export default function Dashboard() {// Muscle group donut: sets per muscle across all fetched workoutsconst muscleMap = new Map<string, number>()workouts.forEach(w => {- w.exercises.forEach(ex => {- const mg = ex.exercise.muscle_group || 'other'- muscleMap.set(mg, (muscleMap.get(mg) || 0) + ex.sets.length)+ (w.exercises ?? []).forEach(ex => {+ const mg = ex.exercise?.muscle_group || 'other'+ muscleMap.set(mg, (muscleMap.get(mg) || 0) + (ex.sets ?? []).length)})})const muscleData = Array.from(muscleMap.entries())@@ -217,9 +217,9 @@ export default function Dashboard() {const muscleSparklines = new Map<string, number[]>()muscleData.forEach(({ name }) => {muscleSparklines.set(name, sparklineWorkouts.map(w =>- w.exercises- .filter(ex => ex.exercise.muscle_group === name)- .reduce((s, ex) => s + ex.sets.length, 0)+ (w.exercises ?? [])+ .filter(ex => ex.exercise?.muscle_group === name)+ .reduce((s, ex) => s + (ex.sets ?? []).length, 0)))})const topMuscle = muscleData[0]?.name ?? null@@ -459,11 +459,13 @@ export default function Dashboard() {<div className="grid lg:grid-cols-2 gap-4 min-w-0">{lastWorkout ? (() => {- const totalSets = lastWorkout.exercises.reduce((s, ex) => s + ex.sets.length, 0)+ const exs = lastWorkout.exercises ?? []+ const totalSets = exs.reduce((s, ex) => s + (ex.sets ?? []).length, 0)const totalVolume = Math.round(calcVolume(lastWorkout))const mins = Math.round(lastWorkout.duration / 60)return (- <div className="card p-4 overflow-hidden min-w-0">+ <div className="card p-4 overflow-hidden min-w-0 cursor-pointer active:scale-[0.99] transition-transform"+ onClick={() => navigate(`/workouts/${lastWorkout.id}`)}><div className="flex items-start justify-between gap-2 mb-3"><div className="min-w-0"><p className="text-sm font-semibold text-tx-primary truncate">{lastWorkout.name}</p>@@ -480,9 +482,10 @@ export default function Dashboard() {</div><div className="divide-y divide-surface-border/60">- {lastWorkout.exercises.slice(0, 4).map((ex) => {- const best = ex.sets.length > 0- ? ex.sets.reduce((b, s) => s.weight > b.weight ? s : b, ex.sets[0])+ {exs.slice(0, 4).map((ex) => {+ const sets = ex.sets ?? []+ const best = sets.length > 0+ ? sets.reduce((b, s) => s.weight > b.weight ? s : b, sets[0]): nullreturn (<div key={ex.id} className="flex items-center gap-2.5 py-2.5">@@ -507,7 +510,7 @@ export default function Dashboard() {</div>{best && (<span className="text-xs text-tx-muted tabular-nums flex-shrink-0">- {ex.sets.length}×{best.weight > 0 ? ` ${best.weight}lb` : ' BW'}+ {sets.length}×{best.weight > 0 ? ` ${best.weight}lb` : ' BW'}</span>)}</div>@@ -515,9 +518,9 @@ export default function Dashboard() {})}</div>- {lastWorkout.exercises.length > 4 && (+ {exs.length > 4 && (<p className="text-xs text-tx-muted text-center pt-2">- +{lastWorkout.exercises.length - 4} more exercises+ +{exs.length - 4} more exercises</p>)}</div>diff --git a/web/src/pages/ProgramDetail.tsx b/web/src/pages/ProgramDetail.tsxnew file mode 100644index 0000000..886e532--- /dev/null+++ b/web/src/pages/ProgramDetail.tsx@@ -0,0 +1,241 @@+import { useState, useEffect } from 'react'+import { useParams, useNavigate, Link } from 'react-router-dom'+import { format } from 'date-fns'+import {+ ArrowLeft, BookOpen, Dumbbell, Edit2, Trash2, Play, AlertCircle, Loader, ChevronRight,+} from 'lucide-react'+import { programAPI } from '../services/api'+import { useWorkoutSession } from '../stores/workoutSession'+import * as types from '../types'+import { muscleColor } from '../utils/exerciseUtils'++export default function ProgramDetail() {+ const { id } = useParams<{ id: string }>()+ const navigate = useNavigate()+ const { session, startSession } = useWorkoutSession()+ const [program, setProgram] = useState<types.Program | null>(null)+ const [loading, setLoading] = useState(true)+ const [error, setError] = useState<string | null>(null)+ const [confirming, setConfirming] = useState(false)+ const [deleting, setDeleting] = useState(false)++ useEffect(() => {+ const load = async () => {+ try {+ const data = await programAPI.get(Number(id))+ setProgram(data)+ } catch (err: any) {+ setError(err.message || 'Failed to load program')+ } finally {+ setLoading(false)+ }+ }+ load()+ }, [id])++ const handleStart = () => {+ if (!program) return+ if (session) { navigate('/workout/start'); return }+ const exercises: types.ActiveSessionExercise[] = (program.exercises || []).map(ex => ({+ exercise_id: ex.exercise_id,+ exercise: ex.exercise,+ notes: ex.notes || '',+ sets: (ex.sets || []).map(s => ({+ set_number: s.set_number,+ target_reps: s.target_reps,+ target_weight: s.target_weight,+ actual_reps: s.target_reps,+ actual_weight: s.target_weight,+ completed: false,+ })),+ }))+ startSession(program.name, exercises, program.id)+ navigate('/workout/active')+ }++ const handleDelete = async () => {+ if (!program) return+ setDeleting(true)+ try {+ await programAPI.delete(program.id)+ navigate('/programs', { replace: true })+ } catch {+ setDeleting(false)+ setConfirming(false)+ }+ }++ if (loading) {+ return (+ <div className="flex items-center justify-center min-h-96">+ <Loader className="w-6 h-6 animate-spin text-brand-500" />+ </div>+ )+ }++ if (error || !program) {+ return (+ <div className="space-y-4">+ <Link to="/programs" className="flex items-center gap-2 text-sm text-tx-muted hover:text-tx-primary transition-colors">+ <ArrowLeft className="w-4 h-4" /> Back+ </Link>+ <div className="alert-error">+ <AlertCircle className="w-5 h-5 flex-shrink-0" />+ <span>{error || 'Program not found'}</span>+ </div>+ </div>+ )+ }++ const exs = program.exercises ?? []+ const totalSets = exs.reduce((s, ex) => s + (ex.sets ?? []).length, 0)++ return (+ <div className="space-y-5 animate-slide-up max-w-2xl">+ {/* Back nav */}+ <div className="flex items-center justify-between">+ <Link to="/programs" className="flex items-center gap-1.5 text-sm text-tx-muted hover:text-tx-primary transition-colors">+ <ArrowLeft className="w-4 h-4" /> Programs+ </Link>+ <div className="flex items-center gap-1">+ <button+ onClick={handleStart}+ className="flex items-center gap-1.5 px-3 py-2 bg-brand-500 hover:bg-brand-600 text-white text-xs font-semibold rounded-xl transition-colors"+ >+ <Play className="w-3.5 h-3.5" /> Start Workout+ </button>+ <button+ onClick={() => navigate(`/programs/${program.id}/edit`)}+ className="p-2 hover:bg-surface-muted rounded-lg transition-colors"+ >+ <Edit2 className="w-4 h-4 text-brand-500" />+ </button>+ <button+ onClick={() => setConfirming(true)}+ className="p-2 hover:bg-error-500/10 rounded-lg transition-colors"+ >+ <Trash2 className="w-4 h-4 text-error-400" />+ </button>+ </div>+ </div>++ {/* Delete confirm */}+ {confirming && (+ <div className="card p-4 border-error-500/30 bg-error-500/5">+ <p className="text-sm font-semibold text-tx-primary mb-1">Delete "{program.name}"?</p>+ <p className="text-xs text-tx-muted mb-3">This cannot be undone.</p>+ <div className="flex gap-2">+ <button onClick={handleDelete} disabled={deleting} className="btn-danger btn-sm flex-1">+ {deleting ? <><Loader className="w-3.5 h-3.5 animate-spin" /> Deleting…</> : 'Yes, delete'}+ </button>+ <button onClick={() => setConfirming(false)} className="btn-secondary btn-sm flex-1">Cancel</button>+ </div>+ </div>+ )}++ {/* Header */}+ <div className="card p-4">+ <div className="flex items-start gap-3">+ {exs[0]?.exercise?.image_url ? (+ <img+ src={exs[0].exercise.image_url}+ alt=""+ className="w-14 h-14 rounded-xl object-cover flex-shrink-0 bg-surface-muted"+ onError={e => { (e.target as HTMLImageElement).style.display = 'none' }}+ />+ ) : (+ <div className="w-14 h-14 rounded-xl bg-brand-500/10 border border-brand-500/20 flex items-center justify-center flex-shrink-0">+ <BookOpen className="w-6 h-6 text-brand-500" strokeWidth={2} />+ </div>+ )}+ <div className="min-w-0 flex-1">+ <h1 className="font-display font-bold text-xl text-tx-primary leading-tight">{program.name}</h1>+ <p className="text-sm text-tx-muted mt-0.5">+ Created {format(new Date(program.created_at), 'MMMM d, yyyy')}+ </p>+ </div>+ </div>++ <div className="grid grid-cols-2 gap-3 mt-4 pt-4 border-t border-surface-border">+ <div className="text-center">+ <div className="flex items-center justify-center gap-1 mb-0.5">+ <Dumbbell className="w-3.5 h-3.5 text-tx-muted" />+ <p className="text-xs text-tx-muted">Exercises</p>+ </div>+ <p className="text-lg font-bold text-tx-primary tabular-nums">{exs.length}</p>+ </div>+ <div className="text-center border-l border-surface-border">+ <div className="flex items-center justify-center gap-1 mb-0.5">+ <BookOpen className="w-3.5 h-3.5 text-tx-muted" />+ <p className="text-xs text-tx-muted">Total Sets</p>+ </div>+ <p className="text-lg font-bold text-tx-primary tabular-nums">{totalSets}</p>+ </div>+ </div>++ {program.notes && (+ <p className="text-sm text-tx-muted mt-3 pt-3 border-t border-surface-border">{program.notes}</p>+ )}+ </div>++ {/* Exercises */}+ <div className="space-y-2">+ {exs.map((ex) => {+ const sets = ex.sets ?? []+ const maxTarget = sets.length > 0 ? Math.max(...sets.map(s => s.target_weight || 0)) : 0++ return (+ <button+ key={ex.id}+ onClick={() => navigate(`/exercises/${ex.exercise_id}`)}+ className="card w-full overflow-hidden text-left active:scale-[0.99] transition-transform"+ >+ <div className="flex items-center gap-3 p-4">+ {ex.exercise?.image_url ? (+ <img+ src={ex.exercise.image_url}+ alt=""+ className="w-11 h-11 rounded-xl object-cover flex-shrink-0 bg-surface-muted"+ onError={e => { (e.target as HTMLImageElement).style.display = 'none' }}+ />+ ) : (+ <div className="w-11 h-11 rounded-xl bg-brand-500/10 border border-brand-500/20 flex items-center justify-center flex-shrink-0">+ <Dumbbell className="w-5 h-5 text-brand-500" strokeWidth={2} />+ </div>+ )}+ <div className="flex-1 min-w-0">+ <p className="text-sm font-semibold text-tx-primary truncate">{ex.exercise?.name}</p>+ <div className="flex items-center gap-2 mt-0.5 flex-wrap">+ {ex.exercise?.muscle_group && (+ <span className={`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${muscleColor(ex.exercise.muscle_group)}`}>+ {ex.exercise.muscle_group}+ </span>+ )}+ <span className="text-xs text-tx-muted">{sets.length} sets</span>+ {maxTarget > 0 && <span className="text-xs text-tx-muted">target {maxTarget} lb</span>}+ </div>+ </div>+ <ChevronRight className="w-4 h-4 text-tx-muted flex-shrink-0" />+ </div>++ {sets.length > 0 && (+ <div className="flex flex-wrap gap-1.5 px-4 pb-4 border-t border-surface-border/50 pt-3">+ {sets.map((set, i) => {+ const isBest = set.target_weight === maxTarget && maxTarget > 0+ return (+ <div key={i} className={`px-2.5 py-1.5 rounded-lg text-xs font-semibold tabular-nums leading-none ${+ isBest ? 'bg-brand-500/15 text-brand-300 ring-1 ring-brand-500/25' : 'bg-surface-raised text-tx-secondary'+ }`}>+ {set.target_reps > 0 ? set.target_reps : '—'} × {set.target_weight > 0 ? `${set.target_weight} lb` : 'BW'}+ </div>+ )+ })}+ </div>+ )}+ </button>+ )+ })}+ </div>+ </div>+ )+}diff --git a/web/src/pages/Programs.tsx b/web/src/pages/Programs.tsxindex cbe6ec8..5e549b0 100644--- a/web/src/pages/Programs.tsx+++ b/web/src/pages/Programs.tsx@@ -1,6 +1,6 @@import { useState, useEffect } from 'react'import { format } from 'date-fns'-import { BookOpen, Plus, ChevronDown, Dumbbell, Edit2, Trash2, AlertCircle, Search, Play } from 'lucide-react'+import { BookOpen, Plus, Dumbbell, Edit2, Trash2, AlertCircle, Search, Play, ChevronRight } from 'lucide-react'import { useNavigate } from 'react-router-dom'import Loading from '../components/Loading'import { programAPI } from '../services/api'@@ -20,7 +20,6 @@ function ProgramCard({}) {const navigate = useNavigate()const { session, startSession } = useWorkoutSession()- const [open, setOpen] = useState(false)const handleStart = (e: React.MouseEvent) => {e.stopPropagation()@@ -92,9 +91,12 @@ function ProgramCard({const totalSets = program.exercises?.reduce((s, e) => s + (e.sets?.length || 0), 0) || 0return (- <div className="card overflow-hidden">- <div className="flex items-center justify-between p-4 hover:bg-surface-muted transition-colors group">- <button className="flex-1 flex items-center gap-3 min-w-0" onClick={() => setOpen(o => !o)}>+ <div className="card overflow-hidden group active:scale-[0.99] transition-transform">+ <div className="flex items-center p-4 gap-3">+ <button+ className="flex-1 flex items-center gap-3 min-w-0 text-left"+ onClick={() => navigate(`/programs/${program.id}`)}+ >{program.exercises?.[0]?.exercise?.image_url ? (<imgsrc={program.exercises[0].exercise.image_url}@@ -107,7 +109,7 @@ function ProgramCard({<BookOpen className="w-5 h-5 text-brand-500" strokeWidth={2} /></div>)}- <div className="text-left min-w-0">+ <div className="min-w-0 flex-1"><p className="text-sm font-semibold text-tx-primary truncate">{program.name}</p><div className="flex items-center flex-wrap gap-x-2 gap-y-0.5 mt-0.5"><span className="text-xs text-tx-muted">{format(new Date(program.created_at), 'MMM d, yyyy')}</span>@@ -117,99 +119,24 @@ function ProgramCard({<span className="text-xs text-tx-muted">{totalSets} sets</span></div></div>+ <ChevronRight className="w-4 h-4 text-tx-muted flex-shrink-0" /></button>- <div className="flex items-center gap-1">- <button- onClick={handleStart}- className="w-11 h-11 flex items-center justify-center bg-brand-500/10 hover:bg-brand-500/20 rounded-xl transition-colors border border-brand-500/20 flex-shrink-0"- title="Start workout from this program"- >++ <div className="flex items-center gap-0.5 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity">+ <button onClick={handleStart}+ className="p-2 hover:bg-brand-500/10 rounded-lg transition-colors" title="Start workout"><Play className="w-4 h-4 text-brand-500" /></button>- <button- onClick={e => { e.stopPropagation(); onEdit(program.id) }}- className="p-2 hover:bg-surface-muted rounded-lg transition-colors sm:opacity-0 sm:group-hover:opacity-100"- >+ <button onClick={e => { e.stopPropagation(); onEdit(program.id) }}+ className="p-2 hover:bg-surface-muted rounded-lg transition-colors"><Edit2 className="w-4 h-4 text-brand-500" /></button>- <button- onClick={e => { e.stopPropagation(); setConfirming(true) }}- className="p-2 hover:bg-error-500/10 rounded-lg transition-colors sm:opacity-0 sm:group-hover:opacity-100"- >+ <button onClick={e => { e.stopPropagation(); setConfirming(true) }}+ className="p-2 hover:bg-error-500/10 rounded-lg transition-colors"><Trash2 className="w-4 h-4 text-error-400" /></button>- <ChevronDown className={`w-4 h-4 text-tx-muted transition-transform duration-200 flex-shrink-0 ${open ? 'rotate-180' : ''}`} /></div></div>-- {open && (- <div className="border-t border-surface-border animate-slide-up">- {program.notes && (- <p className="px-4 py-2.5 text-xs text-tx-muted border-b border-surface-border">{program.notes}</p>- )}-- <div className="p-3 space-y-2">- {program.exercises?.map((ex) => {- const maxTarget = ex.sets?.length > 0 ? Math.max(...ex.sets.map(s => s.target_weight || 0)) : 0- return (- <div key={ex.id} className="bg-surface-muted/30 border border-surface-border rounded-xl overflow-hidden">- {/* Exercise header */}- <div className="flex items-center gap-3 px-3 pt-3 pb-2">- {ex.exercise.image_url ? (- <img- src={ex.exercise.image_url}- alt=""- className="w-9 h-9 rounded-lg object-cover flex-shrink-0 bg-surface-muted"- onError={e => { (e.target as HTMLImageElement).style.display = 'none' }}- />- ) : (- <div className="w-9 h-9 rounded-lg bg-brand-500/10 border border-brand-500/20 flex items-center justify-center flex-shrink-0">- <Dumbbell className="w-4 h-4 text-brand-500" />- </div>- )}- <div className="flex-1 min-w-0">- <p className="text-sm font-semibold text-tx-primary leading-tight truncate">{ex.exercise.name}</p>- <div className="flex items-center gap-2 mt-0.5">- <span className={`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${muscleColor(ex.exercise.muscle_group)}`}>- {ex.exercise.muscle_group}- </span>- <span className="text-xs text-tx-muted">{ex.sets?.length || 0} sets</span>- </div>- </div>- {maxTarget > 0 && (- <div className="text-right flex-shrink-0">- <p className="text-xs text-tx-muted leading-tight">target</p>- <p className="text-sm font-bold text-brand-400 tabular-nums">{maxTarget} lb</p>- </div>- )}- </div>-- {/* Set chips — target reps × weight, heaviest highlighted */}- {ex.sets?.length > 0 && (- <div className="flex flex-wrap gap-1.5 px-3 pb-3 pt-2 border-t border-surface-border/50 mt-2">- {ex.sets.map((set, i) => {- const isBest = set.target_weight === maxTarget && maxTarget > 0- return (- <div- key={i}- className={`px-2.5 py-1.5 rounded-lg text-xs font-semibold tabular-nums leading-none ${- isBest- ? 'bg-brand-500/15 text-brand-300 ring-1 ring-brand-500/25'- : 'bg-surface-raised text-tx-secondary'- }`}- >- {set.target_reps > 0 ? set.target_reps : '—'} × {set.target_weight > 0 ? `${set.target_weight} lb` : 'BW'}- </div>- )- })}- </div>- )}- </div>- )- })}- </div>- </div>- )}</div>)}diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsxindex 54d2c43..00800e6 100644--- a/web/src/pages/Settings.tsx+++ b/web/src/pages/Settings.tsx@@ -1,11 +1,12 @@-import { useState, useEffect } from 'react'+import { useState, useEffect, useCallback } from 'react'import { useAuthStore } from '../stores/auth'import { useTheme } from '../hooks/useTheme'-import { userAPI } from '../services/api'+import { userAPI, exerciseAPI } from '../services/api'import * as types from '../types'import { HelpTip } from '../components/Tooltip'import {User, Shield, Target, Moon, Sun, Server, LogOut, Trash2, ChevronRight, Check, AlertCircle, Loader,+ Dumbbell, RefreshCw,} from 'lucide-react'function SettingRow({ label, description, children }: { label: string; description?: string; children: React.ReactNode }) {@@ -42,6 +43,10 @@ export default function Settings() {const [error, setError] = useState<string | null>(null)const [success, setSuccess] = useState(false)+ const [seedStatus, setSeedStatus] = useState<{ count: number; in_progress: boolean } | null>(null)+ const [seedAction, setSeedAction] = useState<'sync' | null>(null)+ const [seedMsg, setSeedMsg] = useState<string | null>(null)+const [formData, setFormData] = useState({weight_unit: 'lbs' as 'lbs' | 'kg',calorie_target: 2000,@@ -50,6 +55,14 @@ export default function Settings() {fat_target: 65,})+ const loadSeedStatus = useCallback(async () => {+ try {+ const s = await exerciseAPI.seedStatus()+ setSeedStatus(s)+ return s+ } catch {}+ }, [])+useEffect(() => {const load = async () => {try {@@ -69,7 +82,33 @@ export default function Settings() {}}load()- }, [])+ loadSeedStatus()+ }, [loadSeedStatus])++ // Poll while seeding in progress+ useEffect(() => {+ if (!seedStatus?.in_progress) return+ const id = setInterval(async () => {+ const s = await loadSeedStatus()+ if (s && !s.in_progress) clearInterval(id)+ }, 2000)+ return () => clearInterval(id)+ }, [seedStatus?.in_progress, loadSeedStatus])++ const handleSync = async () => {+ setSeedAction('sync')+ setSeedMsg(null)+ try {+ const res = await exerciseAPI.sync()+ setSeedMsg(`Synced ${res.total.toLocaleString()} exercises`)+ loadSeedStatus()+ } catch (err: any) {+ setSeedMsg(err.message || 'Sync failed')+ } finally {+ setSeedAction(null)+ }+ }+const handleSave = async () => {setSaving(true)@@ -237,6 +276,45 @@ export default function Settings() {</SettingRow></Section>+ {/* Exercise Library */}+ <Section title="Exercise Library">+ <SettingRow+ label="Exercise database"+ description="800+ exercises seeded automatically on first run"+ >+ <div className="flex items-center gap-2">+ {seedStatus?.in_progress ? (+ <span className="flex items-center gap-1.5 text-xs text-brand-400">+ <Loader className="w-3.5 h-3.5 animate-spin" /> Seeding...+ </span>+ ) : (+ <span className="text-sm font-mono text-tx-muted">+ {seedStatus ? seedStatus.count.toLocaleString() : '—'} exercises+ </span>+ )}+ </div>+ </SettingRow>++ {seedMsg && (+ <div className="py-2 px-1">+ <p className="text-xs text-tx-muted">{seedMsg}</p>+ </div>+ )}++ <div className="py-3">+ <button+ onClick={handleSync}+ disabled={!!seedAction || seedStatus?.in_progress}+ className="btn-secondary btn-sm"+ >+ {seedAction === 'sync'+ ? <><Loader className="w-3.5 h-3.5 animate-spin" /> Syncing...</>+ : <><RefreshCw className="w-3.5 h-3.5" /> Re-sync</>+ }+ </button>+ </div>+ </Section>+{/* Danger Zone */}<Section title="Danger Zone"><SettingRow label="Sign out" description="Log out of this device">diff --git a/web/src/pages/WorkoutDetail.tsx b/web/src/pages/WorkoutDetail.tsxnew file mode 100644index 0000000..51dc684--- /dev/null+++ b/web/src/pages/WorkoutDetail.tsx@@ -0,0 +1,244 @@+import { useState, useEffect } from 'react'+import { useParams, useNavigate, Link } from 'react-router-dom'+import { format } from 'date-fns'+import {+ ArrowLeft, Clock, Dumbbell, TrendingUp, Edit2, Trash2, ChevronRight, AlertCircle, Loader,+} from 'lucide-react'+import { workoutAPI } from '../services/api'+import * as types from '../types'+import { muscleColor } from '../utils/exerciseUtils'++function SetChip({ set, isBest }: { set: types.Set; isBest: boolean }) {+ return (+ <div className={`px-2.5 py-1.5 rounded-lg text-xs font-semibold tabular-nums leading-none ${+ isBest+ ? 'bg-brand-500/15 text-brand-300 ring-1 ring-brand-500/25'+ : 'bg-surface-raised text-tx-secondary'+ }`}>+ {set.reps > 0 ? set.reps : '—'} × {set.weight > 0 ? `${set.weight} lb` : 'BW'}+ </div>+ )+}++export default function WorkoutDetail() {+ const { id } = useParams<{ id: string }>()+ const navigate = useNavigate()+ const [workout, setWorkout] = useState<types.Workout | null>(null)+ const [loading, setLoading] = useState(true)+ const [error, setError] = useState<string | null>(null)+ const [confirming, setConfirming] = useState(false)+ const [deleting, setDeleting] = useState(false)++ useEffect(() => {+ const load = async () => {+ try {+ const data = await workoutAPI.get(Number(id))+ setWorkout(data)+ } catch (err: any) {+ setError(err.message || 'Failed to load workout')+ } finally {+ setLoading(false)+ }+ }+ load()+ }, [id])++ const handleDelete = async () => {+ if (!workout) return+ setDeleting(true)+ try {+ await workoutAPI.delete(workout.id)+ navigate('/workouts', { replace: true })+ } catch {+ setDeleting(false)+ setConfirming(false)+ }+ }++ if (loading) {+ return (+ <div className="flex items-center justify-center min-h-96">+ <Loader className="w-6 h-6 animate-spin text-brand-500" />+ </div>+ )+ }++ if (error || !workout) {+ return (+ <div className="space-y-4">+ <Link to="/workouts" className="flex items-center gap-2 text-sm text-tx-muted hover:text-tx-primary transition-colors">+ <ArrowLeft className="w-4 h-4" /> Back+ </Link>+ <div className="alert-error">+ <AlertCircle className="w-5 h-5 flex-shrink-0" />+ <span>{error || 'Workout not found'}</span>+ </div>+ </div>+ )+ }++ const exs = workout.exercises ?? []+ const totalVolume = Math.round(+ exs.reduce((s, ex) => s + (ex.sets ?? []).reduce((ss, set) => ss + set.reps * set.weight, 0), 0)+ )+ const totalSets = exs.reduce((s, ex) => s + (ex.sets ?? []).length, 0)+ const durationMin = Math.round(workout.duration / 60)++ return (+ <div className="space-y-5 animate-slide-up max-w-2xl">+ {/* Back nav */}+ <div className="flex items-center justify-between">+ <Link to="/workouts" className="flex items-center gap-1.5 text-sm text-tx-muted hover:text-tx-primary transition-colors">+ <ArrowLeft className="w-4 h-4" /> Workouts+ </Link>+ <div className="flex items-center gap-1">+ <button+ onClick={() => navigate(`/workouts/${workout.id}/edit`)}+ className="p-2 hover:bg-surface-muted rounded-lg transition-colors"+ >+ <Edit2 className="w-4 h-4 text-brand-500" />+ </button>+ <button+ onClick={() => setConfirming(true)}+ className="p-2 hover:bg-error-500/10 rounded-lg transition-colors"+ >+ <Trash2 className="w-4 h-4 text-error-400" />+ </button>+ </div>+ </div>++ {/* Delete confirm */}+ {confirming && (+ <div className="card p-4 border-error-500/30 bg-error-500/5">+ <p className="text-sm font-semibold text-tx-primary mb-1">Delete "{workout.name}"?</p>+ <p className="text-xs text-tx-muted mb-3">This cannot be undone.</p>+ <div className="flex gap-2">+ <button onClick={handleDelete} disabled={deleting}+ className="btn-danger btn-sm flex-1">+ {deleting ? <><Loader className="w-3.5 h-3.5 animate-spin" /> Deleting…</> : 'Yes, delete'}+ </button>+ <button onClick={() => setConfirming(false)} className="btn-secondary btn-sm flex-1">+ Cancel+ </button>+ </div>+ </div>+ )}++ {/* Header */}+ <div className="card p-4">+ <div className="flex items-start gap-3">+ {exs[0]?.exercise?.image_url ? (+ <img+ src={exs[0].exercise.image_url}+ alt=""+ className="w-14 h-14 rounded-xl object-cover flex-shrink-0 bg-surface-muted"+ onError={e => { (e.target as HTMLImageElement).style.display = 'none' }}+ />+ ) : (+ <div className="w-14 h-14 rounded-xl bg-brand-500/10 border border-brand-500/20 flex items-center justify-center flex-shrink-0">+ <Dumbbell className="w-6 h-6 text-brand-500" strokeWidth={2} />+ </div>+ )}+ <div className="min-w-0 flex-1">+ <h1 className="font-display font-bold text-xl text-tx-primary leading-tight">{workout.name}</h1>+ <p className="text-sm text-tx-muted mt-0.5">+ {format(new Date(workout.started_at), 'EEEE, MMMM d, yyyy')}+ </p>+ </div>+ </div>++ {/* Stats strip */}+ <div className="grid grid-cols-3 gap-3 mt-4 pt-4 border-t border-surface-border">+ <div className="text-center">+ <div className="flex items-center justify-center gap-1 mb-0.5">+ <Clock className="w-3.5 h-3.5 text-tx-muted" />+ <p className="text-xs text-tx-muted">Duration</p>+ </div>+ <p className="text-lg font-bold text-tx-primary tabular-nums">{durationMin}<span className="text-xs font-normal text-tx-muted ml-0.5">min</span></p>+ </div>+ <div className="text-center border-x border-surface-border">+ <div className="flex items-center justify-center gap-1 mb-0.5">+ <Dumbbell className="w-3.5 h-3.5 text-tx-muted" />+ <p className="text-xs text-tx-muted">Sets</p>+ </div>+ <p className="text-lg font-bold text-tx-primary tabular-nums">{totalSets}</p>+ </div>+ <div className="text-center">+ <div className="flex items-center justify-center gap-1 mb-0.5">+ <TrendingUp className="w-3.5 h-3.5 text-tx-muted" />+ <p className="text-xs text-tx-muted">Volume</p>+ </div>+ <p className="text-lg font-bold text-tx-primary tabular-nums">+ {totalVolume > 0 ? `${totalVolume.toLocaleString()}` : '—'}+ {totalVolume > 0 && <span className="text-xs font-normal text-tx-muted ml-0.5">lb</span>}+ </p>+ </div>+ </div>++ {workout.notes && (+ <p className="text-sm text-tx-muted mt-3 pt-3 border-t border-surface-border">{workout.notes}</p>+ )}+ </div>++ {/* Exercises */}+ <div className="space-y-3">+ {exs.map((ex, idx) => {+ const sets = ex.sets ?? []+ const maxWeight = sets.length > 0 ? Math.max(...sets.map(s => s.weight || 0)) : 0+ const exVol = sets.reduce((s, set) => s + (set.reps || 0) * (set.weight || 0), 0)++ return (+ <button+ key={ex.id}+ onClick={() => navigate(`/exercises/${ex.exercise_id}`)}+ className="card w-full overflow-hidden text-left active:scale-[0.99] transition-transform"+ >+ <div className="flex items-center gap-3 p-4">+ {ex.exercise?.image_url ? (+ <img+ src={ex.exercise.image_url}+ alt=""+ className="w-11 h-11 rounded-xl object-cover flex-shrink-0 bg-surface-muted"+ onError={e => { (e.target as HTMLImageElement).style.display = 'none' }}+ />+ ) : (+ <div className="w-11 h-11 rounded-xl bg-brand-500/10 border border-brand-500/20 flex items-center justify-center flex-shrink-0">+ <Dumbbell className="w-5 h-5 text-brand-500" strokeWidth={2} />+ </div>+ )}+ <div className="flex-1 min-w-0">+ <p className="text-sm font-semibold text-tx-primary truncate">{ex.exercise?.name}</p>+ <div className="flex items-center gap-2 mt-0.5 flex-wrap">+ {ex.exercise?.muscle_group && (+ <span className={`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${muscleColor(ex.exercise.muscle_group)}`}>+ {ex.exercise.muscle_group}+ </span>+ )}+ <span className="text-xs text-tx-muted">{sets.length} sets</span>+ {exVol > 0 && <span className="text-xs text-tx-muted">{exVol.toLocaleString()} lb</span>}+ </div>+ </div>+ {maxWeight > 0 && (+ <div className="text-right flex-shrink-0 mr-1">+ <p className="text-[10px] text-tx-muted uppercase tracking-wide">best</p>+ <p className="text-sm font-bold text-brand-400 tabular-nums">{maxWeight} lb</p>+ </div>+ )}+ <ChevronRight className="w-4 h-4 text-tx-muted flex-shrink-0" />+ </div>++ {sets.length > 0 && (+ <div className="flex flex-wrap gap-1.5 px-4 pb-4 pt-0 border-t border-surface-border/50">+ <div className="w-full pt-3" />+ {sets.map((set, i) => (+ <SetChip key={i} set={set} isBest={set.weight === maxWeight && maxWeight > 0} />+ ))}+ </div>+ )}+ </button>+ )+ })}+ </div>+ </div>+ )+}diff --git a/web/src/pages/Workouts.tsx b/web/src/pages/Workouts.tsxindex 6efca6e..9912b36 100644--- a/web/src/pages/Workouts.tsx+++ b/web/src/pages/Workouts.tsx@@ -1,6 +1,6 @@import { useState, useEffect } from 'react'import { format } from 'date-fns'-import { Dumbbell, Plus, ChevronDown, Clock, Search, AlertCircle, Edit2, Trash2, TrendingUp } from 'lucide-react'+import { Dumbbell, Plus, Clock, Search, AlertCircle, Edit2, Trash2, TrendingUp, ChevronRight } from 'lucide-react'import { useNavigate } from 'react-router-dom'import Loading from '../components/Loading'import { workoutAPI } from '../services/api'@@ -8,7 +8,7 @@ import * as types from '../types'import { muscleColor } from '../utils/exerciseUtils'function WorkoutCard({ workout, onEdit, onDelete }: { workout: types.Workout; onEdit: (id: number) => void; onDelete: (id: number) => void }) {- const [open, setOpen] = useState(false)+ const navigate = useNavigate()const [confirming, setConfirming] = useState(false)const [deleting, setDeleting] = useState(false)const durationMin = Math.round(workout.duration / 60)@@ -42,17 +42,12 @@ function WorkoutCard({ workout, onEdit, onDelete }: { workout: types.Workout; on</div></div><div className="flex items-center gap-2">- <button- onClick={() => setConfirming(false)}- className="px-3 py-1.5 text-xs bg-surface-muted hover:bg-surface-muted/80 text-tx-secondary rounded-lg transition-colors font-medium"- >+ <button onClick={() => setConfirming(false)}+ className="px-3 py-1.5 text-xs bg-surface-muted hover:bg-surface-muted/80 text-tx-secondary rounded-lg transition-colors font-medium">Cancel</button>- <button- onClick={handleDelete}- disabled={deleting}- className="px-3 py-1.5 text-xs bg-error-500 hover:bg-error-600 disabled:opacity-50 text-white rounded-lg transition-colors font-medium flex items-center gap-1"- >+ <button onClick={handleDelete} disabled={deleting}+ className="px-3 py-1.5 text-xs bg-error-500 hover:bg-error-600 disabled:opacity-50 text-white rounded-lg transition-colors font-medium flex items-center gap-1"><Trash2 className="w-3 h-3" />{deleting ? 'Deleting…' : 'Delete'}</button>@@ -63,11 +58,12 @@ function WorkoutCard({ workout, onEdit, onDelete }: { workout: types.Workout; on}return (- <div className="card overflow-hidden">- <div className="flex items-center justify-between p-4 hover:bg-surface-muted transition-colors group">+ <div className="card overflow-hidden group active:scale-[0.99] transition-transform">+ <div className="flex items-center p-4 gap-3">+ {/* Thumbnail — tappable, navigates to detail */}<button- className="flex-1 flex items-center gap-3 min-w-0"- onClick={() => setOpen(o => !o)}+ onClick={() => navigate(`/workouts/${workout.id}`)}+ className="flex-1 flex items-center gap-3 min-w-0 text-left">{workout.exercises?.[0]?.exercise?.image_url ? (<img@@ -81,14 +77,18 @@ function WorkoutCard({ workout, onEdit, onDelete }: { workout: types.Workout; on<Dumbbell className="w-5 h-5 text-brand-500" strokeWidth={2} /></div>)}- <div className="text-left min-w-0">+ <div className="min-w-0 flex-1"><p className="text-sm font-semibold text-tx-primary truncate">{workout.name}</p><div className="flex items-center flex-wrap gap-x-2 gap-y-0.5 mt-0.5"><span className="text-xs text-tx-muted">{format(new Date(workout.started_at), 'MMM d, yyyy')}</span>- <span className="text-tx-muted/40 text-xs">·</span>- <span className="flex items-center gap-1 text-xs text-tx-muted">- <Clock className="w-3 h-3" />{durationMin} min- </span>+ {durationMin > 0 && (+ <>+ <span className="text-tx-muted/40 text-xs">·</span>+ <span className="flex items-center gap-1 text-xs text-tx-muted">+ <Clock className="w-3 h-3" />{durationMin} min+ </span>+ </>+ )}<span className="text-tx-muted/40 text-xs">·</span><span className="text-xs text-tx-muted">{workout.exercises?.length || 0} exercises</span>{totalVolume > 0 && (@@ -101,95 +101,25 @@ function WorkoutCard({ workout, onEdit, onDelete }: { workout: types.Workout; on)}</div></div>+ <ChevronRight className="w-4 h-4 text-tx-muted flex-shrink-0" /></button>- <div className="flex items-center gap-1">++ {/* Action buttons — always visible on mobile, hover on desktop */}+ <div className="flex items-center gap-0.5 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity"><buttononClick={e => { e.stopPropagation(); onEdit(workout.id) }}- className="p-2 hover:bg-surface-muted rounded-lg transition-colors sm:opacity-0 sm:group-hover:opacity-100"- title="Edit workout"+ className="p-2 hover:bg-surface-muted rounded-lg transition-colors"><Edit2 className="w-4 h-4 text-brand-500" /></button><buttononClick={e => { e.stopPropagation(); setConfirming(true) }}- className="p-2 hover:bg-error-500/10 rounded-lg transition-colors sm:opacity-0 sm:group-hover:opacity-100"- title="Delete workout"+ className="p-2 hover:bg-error-500/10 rounded-lg transition-colors"><Trash2 className="w-4 h-4 text-error-400" /></button>- <ChevronDown className={`w-4 h-4 text-tx-muted transition-transform duration-200 ${open ? 'rotate-180' : ''}`} /></div></div>-- {open && (- <div className="border-t border-surface-border animate-slide-up">- <div className="p-3 space-y-2">- {workout.exercises?.map((ex) => {- const maxWeight = ex.sets?.length > 0- ? Math.max(...ex.sets.map(s => s.weight || 0))- : 0- const exVol = ex.sets?.reduce((s, set) => s + (set.reps || 0) * (set.weight || 0), 0) || 0-- return (- <div key={ex.id} className="bg-surface-muted/30 border border-surface-border rounded-xl overflow-hidden">- {/* Exercise header */}- <div className="flex items-center gap-3 px-3 pt-3 pb-2">- {ex.exercise.image_url ? (- <img- src={ex.exercise.image_url}- alt=""- className="w-9 h-9 rounded-lg object-cover flex-shrink-0 bg-surface-muted"- onError={e => { (e.target as HTMLImageElement).style.display = 'none' }}- />- ) : (- <div className="w-9 h-9 rounded-lg bg-brand-500/10 border border-brand-500/20 flex items-center justify-center flex-shrink-0">- <Dumbbell className="w-4 h-4 text-brand-500" />- </div>- )}- <div className="flex-1 min-w-0">- <p className="text-sm font-semibold text-tx-primary leading-tight truncate">{ex.exercise.name}</p>- <div className="flex items-center gap-2 mt-0.5">- <span className={`inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium ${muscleColor(ex.exercise.muscle_group)}`}>- {ex.exercise.muscle_group}- </span>- <span className="text-xs text-tx-muted">{ex.sets?.length || 0} sets</span>- {exVol > 0 && <span className="text-xs text-tx-muted">{exVol.toLocaleString()} lbs</span>}- </div>- </div>- {maxWeight > 0 && (- <div className="text-right flex-shrink-0">- <p className="text-xs text-tx-muted leading-tight">best</p>- <p className="text-sm font-bold text-brand-400 tabular-nums">{maxWeight} lb</p>- </div>- )}- </div>-- {/* Sets — inline chips, best highlighted */}- {ex.sets?.length > 0 && (- <div className="flex flex-wrap gap-1.5 px-3 pb-3 pt-2 border-t border-surface-border/50 mt-2">- {ex.sets.map((set, i) => {- const isBest = set.weight === maxWeight && maxWeight > 0- return (- <div- key={i}- className={`px-2.5 py-1.5 rounded-lg text-xs font-semibold tabular-nums leading-none ${- isBest- ? 'bg-brand-500/15 text-brand-300 ring-1 ring-brand-500/25'- : 'bg-surface-raised text-tx-secondary'- }`}- >- {set.reps > 0 ? set.reps : '—'} × {set.weight > 0 ? `${set.weight} lb` : 'BW'}- </div>- )- })}- </div>- )}- </div>- )- })}- </div>- </div>- )}</div>)}@@ -197,6 +127,7 @@ function WorkoutCard({ workout, onEdit, onDelete }: { workout: types.Workout; onexport default function Workouts() {const navigate = useNavigate()const [workouts, setWorkouts] = useState<types.Workout[]>([])+const [search, setSearch] = useState('')const [loading, setLoading] = useState(true)const [error, setError] = useState<string | null>(null)diff --git a/web/src/services/api.ts b/web/src/services/api.tsindex c71a5bd..febc64f 100644--- a/web/src/services/api.ts+++ b/web/src/services/api.ts@@ -89,6 +89,8 @@ export const exerciseAPI = {},get: (id: number) => api.get<{ data: types.Exercise }>(`/exercises/${id}`).then(res => unwrap(res)),clearCache: () => { _exerciseCache = null; _exerciseCachePromise = null },+ seedStatus: () => api.get<{ data: { count: number; in_progress: boolean } }>('/admin/seed-status').then(res => unwrap(res)),+ sync: () => api.post<{ data: { synced: boolean; total: number } }>('/admin/sync-exercises').then(res => unwrap(res)),}export const activeSessionAPI = {