diff --git a/frontend/src/lib/exercises.js b/frontend/src/lib/exercises.js
index 4dba478..f4926d4 100644
--- a/frontend/src/lib/exercises.js
+++ b/frontend/src/lib/exercises.js
@@ -7,3 +7,6 @@ export const BODYPARTS = [...new Set(EXDB.map(e => e.bp))].sort()
export const imgSrc = ex => 'img/' + ex.img
export const gifSrc = ex => 'gif/' + ex.gif
+
+// Cardio exercises log time + speed instead of weight Γ reps.
+export const isCardio = idOrEx => (typeof idOrEx === 'string' ? EXIDX[idOrEx] : idOrEx)?.bp === 'cardio'
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index 8404b47..da16c26 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -1,5 +1,16 @@
// Pure helpers over the state object S (ported 1:1 from the vanilla app).
-import { todayISO, isoOf, weekKey } from './format.js'
+import { todayISO, isoOf, weekKey, fmtNum } from './format.js'
+import { isCardio } from './exercises.js'
+
+// One-line summary of a logged set β cardio shows time/speed, strength shows weightΓreps.
+export function setLabel(id, s) {
+ if (isCardio(id)) return `${s.min || 0} min @ ${fmtNum(s.speed || 0)} km/h`
+ return `${fmtNum(s.w || 0)}Γ${s.r || 0}`
+}
+// Default config for a freshly added exercise.
+export function defaultConfig(id) {
+ return isCardio(id) ? { sets: 1, min: 20, speed: 8 } : { sets: 3, reps: 10, weight: 0 }
+}
export function lastEntryFor(S, exId) {
for (let i = S.workouts.length - 1; i >= 0; i--) {
@@ -31,9 +42,17 @@ export function effectiveRoutine(S, iso) {
}
export function buildSets(S, cfg) {
const last = lastEntryFor(S, cfg.id)
- const conf = S.exWeights[cfg.id]
+ const n = Math.max(1, cfg.sets || 1)
const sets = []
- for (let i = 0; i < cfg.sets; i++) {
+ if (isCardio(cfg.id)) {
+ for (let i = 0; i < n; i++) {
+ const prev = last ? (last.sets[i] || last.sets[last.sets.length - 1]) : null
+ sets.push({ min: prev ? prev.min : (cfg.min || 20), speed: prev ? prev.speed : (cfg.speed || 8), done: false })
+ }
+ return sets
+ }
+ const conf = S.exWeights[cfg.id]
+ for (let i = 0; i < n; i++) {
const prev = last ? (last.sets[i] || last.sets[last.sets.length - 1]) : null
const w = conf && conf.w > 0 ? conf.w : (prev ? prev.w : cfg.weight)
sets.push({ w, r: prev ? prev.r : cfg.reps, done: false })
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index a5867eb..df3ad1d 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -1,9 +1,9 @@
import { useEffect, useRef, useState } from 'react'
import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
-import { EXDB, EXIDX, BODYPARTS } from './lib/exercises.js'
+import { EXDB, EXIDX, BODYPARTS, isCardio } from './lib/exercises.js'
import { fmtDate, fmtNum, fmtVol, fmtDur, todayISO, uid, DAYN, MONTHS_LONG, ACCENTS } from './lib/format.js'
-import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf } from './lib/history.js'
+import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig } from './lib/history.js'
import { beep, vibrate } from './lib/sound.js'
import { nav } from './lib/nav.js'
import Media, { Thumb } from './components/Media.jsx'
@@ -104,7 +104,7 @@ function ExerciseDetail({ ex }) {
π {ex.eq}
{(ex.sm || []).slice(0, 3).map((s, i) => {s})}
- {best > 0 &&
π Best: {fmtNum(best)} {st.unit}{last ? ` Β· last ${fmtDate(last.d)}: ${last.sets.map(s => fmtNum(s.w) + 'Γ' + s.r).join(', ')}` : ''}
}
+ {best > 0 && π Best: {fmtNum(best)} {st.unit}{last ? ` Β· last ${fmtDate(last.d)}: ${last.sets.map(s => setLabel(ex.id, s)).join(', ')}` : ''}
}
{ex.st && ex.st.length > 0 && <>How to
{ex.st.map((s, i) => - {s}
)}
>}
>
@@ -188,19 +188,32 @@ export const exercisePicker = onPick => ui().openSheet(close => s.S)
- const [c, setC] = useState(existing || { sets: 3, reps: 10, weight: 0 })
+ const cardio = isCardio(ex.id)
+ const [c, setC] = useState(existing || defaultConfig(ex.id))
+ const save = () => {
+ close()
+ if (cardio) onSave({ sets: Math.max(1, Math.round(c.sets) || 1), min: Math.max(1, Math.round(c.min) || 20), speed: Math.max(0, c.speed || 8) })
+ else onSave({ sets: Math.max(1, Math.round(c.sets) || 3), reps: Math.max(1, Math.round(c.reps) || 10), weight: Math.max(0, c.weight || 0) })
+ }
return <>
{ex.n}
+ {cardio && π Cardio}
{ex.tg || ex.bp}{ex.eq}
- setC(x => ({ ...x, sets: v }))} />
- setC(x => ({ ...x, reps: v }))} />
- setC(x => ({ ...x, weight: v }))} />
+ {cardio ? <>
+ setC(x => ({ ...x, sets: v }))} />
+ setC(x => ({ ...x, min: v }))} />
+ setC(x => ({ ...x, speed: v }))} />
+ > : <>
+ setC(x => ({ ...x, sets: v }))} />
+ setC(x => ({ ...x, reps: v }))} />
+ setC(x => ({ ...x, weight: v }))} />
+ >}
-
+
{onDelete && <>>}
>
}
@@ -267,7 +280,7 @@ function WorkoutDetail({ w, close }) {
return
{ex &&
}
{ex ? ex.n : e.id} {w.prs && w.prs.includes(e.id) && π PR}
-
{e.sets.filter(s => s.done).map(s => fmtNum(s.w) + 'Γ' + s.r).join(' Β· ') || 'no sets'}
+
{e.sets.filter(s => s.done).map(s => setLabel(e.id, s)).join(' Β· ') || 'no sets'}
})}
diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsx
index a7d9a55..9b805ad 100644
--- a/frontend/src/views/Home.jsx
+++ b/frontend/src/views/Home.jsx
@@ -2,10 +2,10 @@ import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
import { effectiveRoutine, effectiveRoutineId, streakWeeks, lastBW, setsDoneActive } from '../lib/history.js'
-import { fmtNum, fmtVol, fmtDate, todayISO, isoOf, weekKey, DAYS, DAYN } from '../lib/format.js'
-import { bwSheet, goalSheet, dayOverrideSheet, calendarSheet, startFlow, WorkoutRow, loadStarterPlan, bwDeltaColor, workoutDetailSheet } from '../sheets.jsx'
-import LineChart from '../components/LineChart.jsx'
+import { fmtNum, fmtDate, todayISO, isoOf, weekKey, DAYS, DAYN } from '../lib/format.js'
+import { bwSheet, goalSheet, dayOverrideSheet, calendarSheet, startFlow, loadStarterPlan, bwDeltaColor } from '../sheets.jsx'
+// Home = what to do now + a quick glance. Deep charts & history live in Stats.
export default function Home() {
const nav = useNavigate()
const S = useStore(s => s.S)
@@ -35,10 +35,8 @@ export default function Home() {
const wThisWeek = S.workouts.filter(w => weekKey(w.d) === weekKey(todayISO())).length
const plannedPerWeek = Object.keys(S.week).filter(k => S.week[k]).length
- const lastW = S.workouts[S.workouts.length - 1]
- const bwPoints = S.bodyweight.slice(-30).map(b => ({ t: b.t || new Date(b.d).getTime(), y: b.w, d: b.d }))
- return <>
+ return
{user ? 'Hi ' + user.name + ' πͺ' : 'openGym ποΈ'}
{today.toLocaleDateString('en-GB', { weekday: 'long', day: 'numeric', month: 'long' })}
@@ -54,71 +52,63 @@ export default function Home() {
Tap a day to plan or move a session
-
- {S.active ? (
-
-
Workout in progress
-
-
{S.active.name}
{setsDoneActive(S.active)} sets logged
-
-
+ {S.active ? (
+
+
Workout in progress
+
+
{S.active.name}
{setsDoneActive(S.active)} sets logged
+
- ) : (
-
-
Today
- {routine ? <>
-
-
{routine.name}
{routine.ex.length} exercises Β· ~{routine.ex.length * 8} min{todayOvr && Β· rescheduled}
-
{routine.emoji || 'πͺ'}
-
-
- > : S.routines.length ? <>
-
Rest day π
-
Nothing planned for {DAYN[today.getDay()]} β recovery counts too. Feeling strong anyway?
-
- > : <>
-
Welcome! π
-
Set up your weekly routine to get going β or load a ready-made Push / Pull / Legs plan.
-
-
- >}
-
- )}
-
+
+ ) : (
-
-
Body weight
-
-
-
+
Today
+ {routine ? <>
+
+
{routine.name}
{routine.ex.length} exercises Β· ~{routine.ex.length * 8} min{todayOvr && Β· rescheduled}
+
{routine.emoji || 'πͺ'}
-
- {bw ? <>
-
-
{fmtNum(bw.w)} {S.unit}
- {delta !== null &&
{delta > 0 ? 'β²' : delta < 0 ? 'βΌ' : 'β’'} {fmtNum(Math.abs(delta))}}
-
{fmtDate(bw.d, true)}
-
- {S.targetW &&
π― Goal {fmtNum(S.targetW)} {S.unit} Β· {Math.abs(S.targetW - bw.w) < 0.05 ? 'reached! π' : fmtNum(Math.abs(S.targetW - bw.w)) + ' ' + S.unit + ' to ' + (S.targetW > bw.w ? 'gain' : 'lose')}
}
-
- > :
No entries yet β log your weight to start the curve. It's also asked automatically before every workout.
}
+
+ > : S.routines.length ? <>
+
Rest day π
+
Nothing planned for {DAYN[today.getDay()]} β recovery counts too. Feeling strong anyway?
+
+ > : <>
+
Welcome! π
+
Set up your weekly routine to get going β or load a ready-made Push / Pull / Legs plan.
+
+
+ >}
-
+ )}
-
-
calendarSheet()}>
This week π
{wThisWeek}{plannedPerWeek ? ' / ' + plannedPerWeek : ''}
-
calendarSheet()}>
Week streak π
{streakWeeks(S)} π₯
-
calendarSheet()}>
Total workouts
{S.workouts.length}
-
Last volume
{lastW ? fmtVol(lastW.vol, S.unit) : 'β'}
-
-
- {S.workouts.length > 0 && <>
-
-
Recent workouts
-
+
+
+
Body weight
+
+
+
-
{[...S.workouts].reverse().slice(0, 3).map(w => workoutDetailSheet(w)} />)}
- >}
-
- >
+
+ {bw ? <>
+
+
{fmtNum(bw.w)} {S.unit}
+ {delta !== null &&
{delta > 0 ? 'β²' : delta < 0 ? 'βΌ' : 'β’'} {fmtNum(Math.abs(delta))}}
+
{fmtDate(bw.d, true)}
+
+ {S.targetW &&
π― Goal {fmtNum(S.targetW)} {S.unit} Β· {Math.abs(S.targetW - bw.w) < 0.05 ? 'reached! π' : fmtNum(Math.abs(S.targetW - bw.w)) + ' ' + S.unit + ' to ' + (S.targetW > bw.w ? 'gain' : 'lose')}
}
+
+ > :
No entries yet β log your weight to start tracking. It's also asked before every workout.
}
+
+
+
calendarSheet()}>
+
+
+
π₯ {streakWeeks(S)} week streak
+
{wThisWeek}{plannedPerWeek ? ' / ' + plannedPerWeek : ''} this week Β· {S.workouts.length} workout{S.workouts.length === 1 ? '' : 's'} total
+
+
π
+
+
+
}
diff --git a/frontend/src/views/RoutineEdit.jsx b/frontend/src/views/RoutineEdit.jsx
index 5900ed1..a8b2112 100644
--- a/frontend/src/views/RoutineEdit.jsx
+++ b/frontend/src/views/RoutineEdit.jsx
@@ -1,7 +1,7 @@
import { useNavigate, useParams } from 'react-router-dom'
import { useEffect } from 'react'
import { useStore } from '../store/useStore.js'
-import { EXIDX } from '../lib/exercises.js'
+import { EXIDX, isCardio } from '../lib/exercises.js'
import { fmtNum, uid } from '../lib/format.js'
import { supersetUnits } from '../lib/history.js'
import { Thumb } from '../components/Media.jsx'
@@ -56,7 +56,7 @@ export default function RoutineEdit() {
exConfigSheet(ex, e, cfg => edit(x => { Object.assign(x[i], cfg) }), () => edit(x => { x.splice(i, 1); cleanupSg(x) }))
}}>
-
{ex.n}
{e.sets} Γ {e.reps}{e.weight ? ' Β· ' + fmtNum(e.weight) + ' ' + S.unit : ''}
+
{ex.n}
{isCardio(e.id) ? `${e.sets} Γ ${e.min || 20} min @ ${fmtNum(e.speed || 8)} km/h` : `${e.sets} Γ ${e.reps}${e.weight ? ' Β· ' + fmtNum(e.weight) + ' ' + S.unit : ''}`}
{i > 0 &&
}
diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsx
index c00c5ae..d19fe09 100644
--- a/frontend/src/views/Stats.jsx
+++ b/frontend/src/views/Stats.jsx
@@ -1,13 +1,14 @@
import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
-import { EXIDX } from '../lib/exercises.js'
-import { bestWeightFor, lastBW, streakWeeks } from '../lib/history.js'
-import { fmtNum, fmtDate, todayISO } from '../lib/format.js'
+import { EXIDX, isCardio } from '../lib/exercises.js'
+import { bestWeightFor, lastBW, streakWeeks, setLabel } from '../lib/history.js'
+import { fmtNum, fmtDate, fmtVol, todayISO } from '../lib/format.js'
import { bwSheet, goalSheet, calendarSheet, workoutDetailSheet, WorkoutRow, bwDeltaColor } from '../sheets.jsx'
import LineChart from '../components/LineChart.jsx'
import Heatmap from '../components/Heatmap.jsx'
+// Stats = the analytics hub: all charts, progress and history live here.
export default function Stats() {
const nav = useNavigate()
const S = useStore(s => s.S)
@@ -23,11 +24,14 @@ export default function Stats() {
const exHist = [...new Set(S.workouts.flatMap(w => w.entries.map(e => e.id)))].filter(id => EXIDX[id]).sort((a, b) => EXIDX[a].n < EXIDX[b].n ? -1 : 1)
const curEx = exId && exHist.includes(exId) ? exId : exHist[0] || null
- let exPts = [], exList = []
+ const curCardio = curEx && isCardio(curEx)
+ const metric = s => curCardio ? (s.speed || 0) : (s.w || 0)
+ const exUnit = curCardio ? 'km/h' : S.unit
+ let exPts = [], exList = [], exBest = 0
if (curEx) {
S.workouts.forEach(w => {
const en = w.entries.find(e => e.id === curEx)
- if (en) { const mx = Math.max(0, ...en.sets.filter(s => s.done).map(s => s.w), en.topW || 0); if (mx > 0) exPts.push({ t: w.start, y: mx, d: w.d, sets: en.sets.filter(s => s.done) }) }
+ if (en) { const mx = Math.max(0, ...en.sets.filter(s => s.done).map(metric), curCardio ? 0 : (en.topW || 0)); if (mx > 0) { exPts.push({ t: w.start, y: mx, d: w.d, sets: en.sets.filter(s => s.done) }); if (mx > exBest) exBest = mx } }
})
exList = exPts.slice(-5).reverse()
}
@@ -67,22 +71,22 @@ export default function Stats() {
Exercise progress
{exHist.length ? <>
-
({ t: p.t, y: p.y, d: p.d }))} h={150} unit={S.unit} color="var(--blue)" />
+
({ t: p.t, y: p.y, d: p.d }))} h={150} unit={exUnit} color="var(--blue)" />
{exList.map((p, i) =>
- {fmtDate(p.d, true)}{p.sets.map(s => fmtNum(s.w) + 'Γ' + s.r).join(' ')}
)}
-
Best set weight per workout Β· Best ever: {fmtNum(bestWeightFor(S, curEx))} {S.unit}
- > :
Finish your first workout to see strength curves here. π
}
+
{fmtDate(p.d, true)}{p.sets.map(s => setLabel(curEx, s)).join(' ')})}
+
{curCardio ? 'Top speed per workout' : 'Best set weight per workout'} Β· Best: {fmtNum(exBest)} {exUnit}
+ > :
Finish your first workout to see progress curves here. π
}
{S.workouts.length > 0 && <>
-
History
+ Recent workouts
-
{[...S.workouts].reverse().slice(0, 5).map(w => workoutDetailSheet(w)} />)}
+
{[...S.workouts].reverse().slice(0, 6).map(w => workoutDetailSheet(w)} />)}
>}
>
}
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 6ff30a9..80623e2 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -2,8 +2,8 @@ import { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useStore } from '../store/useStore.js'
import { useUI } from '../store/useUI.js'
-import { EXIDX } from '../lib/exercises.js'
-import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf } from '../lib/history.js'
+import { EXIDX, isCardio } from '../lib/exercises.js'
+import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActive, supersetUnits, unitOf, setLabel } from '../lib/history.js'
import { fmtNum, fmtDate, todayISO, DAYN } from '../lib/format.js'
import { beep, vibrate } from '../lib/sound.js'
import Media from '../components/Media.jsx'
@@ -37,15 +37,36 @@ function StartChooser() {
}
-/* ---------- one exercise block (used standalone or inside a superset card) ---------- */
-function ExerciseBlock({ entryIdx, compact, onToggle, onWeight, onReps, onAddSet }) {
+/* ---------- elapsed clock (isolated so the workout tree doesn't re-render every second) ---------- */
+function Elapsed({ start }) {
+ const [t, setT] = useState('0:00')
+ useEffect(() => {
+ const tick = () => { const s = Math.floor((Date.now() - start) / 1000); setT(Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0')) }
+ tick(); const iv = setInterval(tick, 1000); return () => clearInterval(iv)
+ }, [start])
+ return {t}
+}
+
+/* ---------- one exercise block (strength: weightΓreps Β· cardio: duration+speed) ---------- */
+function ExerciseBlock({ entryIdx, compact, onToggle, onField, onBumpAll, onAddSet }) {
const S = useStore(s => s.S)
const entry = S.active.entries[entryIdx]
const ex = EXIDX[entry.id]
+ const cardio = isCardio(ex)
const last = lastEntryFor(S, entry.id)
- const best = bestWeightFor(S, entry.id)
- const hint = last && last.sets.length >= (entry.target.sets || 1) && last.sets.every(s => s.r >= entry.target.reps) && last.sets[0].w > 0
+ const best = cardio ? 0 : bestWeightFor(S, entry.id)
+ const hint = !cardio && last && last.sets.length >= (entry.target.sets || 1) && last.sets.every(s => s.r >= entry.target.reps) && last.sets[0].w > 0
? Math.max(...last.sets.map(s => s.w)) + 2.5 : null
+ const col1 = cardio ? { f: 'min', step: 1, dec: false, hd: 'Duration (min)' } : { f: 'w', step: 2.5, dec: true, hd: `Weight (${S.unit})` }
+ const col2 = cardio ? { f: 'speed', step: 0.5, dec: true, hd: 'Speed (km/h)' } : { f: 'r', step: 1, dec: false, hd: 'Reps' }
+ const cell = (s, i, col, cls) => (
+
+
+ e.target.select()}
+ onChange={e => onField(i, col.f, e.target.value === '' ? 0 : Math.max(0, (col.dec ? parseFloat(e.target.value) : Math.round(parseFloat(e.target.value))) || 0))} />
+
+
+ )
return <>
@@ -53,25 +74,18 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onWeight, onReps, onAddSet
+ {cardio && π Cardio}
{ex.tg || ex.bp}{ex.eq}
{best > 0 && Best: {fmtNum(best)} {S.unit}}
- {last && Last time ({fmtDate(last.d)}): {last.sets.map(s => fmtNum(s.w) + 'Γ' + s.r).join(', ')}
}
- {hint && }
+ {last && Last time ({fmtDate(last.d)}): {last.sets.map(s => setLabel(entry.id, s)).join(', ')}
}
+ {hint && }
-
Weight ({S.unit})Reps
+
{col1.hd}{col2.hd}
{entry.sets.map((s, i) =>
{i + 1}
-
-
- e.target.select()} onChange={e => onWeight(i, e.target.value === '' ? 0 : Math.max(0, parseFloat(e.target.value) || 0))} />
-
-
-
-
- e.target.select()} onChange={e => onReps(i, e.target.value === '' ? 0 : Math.max(0, Math.round(parseFloat(e.target.value) || 0)))} />
-
-
+ {cell(s, i, col1, 'w')}
+ {cell(s, i, col2, 'r')}
)}
@@ -87,13 +101,6 @@ function ActiveWorkout() {
const update = useStore(s => s.update)
const { startRest, stopRest } = useUI()
const A = S.active
- const [elapsed, setElapsed] = useState('0:00')
-
- useEffect(() => {
- const tick = () => { const sec = Math.floor((Date.now() - A.start) / 1000); setElapsed(Math.floor(sec / 60) + ':' + String(sec % 60).padStart(2, '0')) }
- tick(); const iv = setInterval(tick, 1000); return () => clearInterval(iv)
- }, [A.start])
-
const units = supersetUnits(A.entries)
const cur = Math.min(A.cur, Math.max(0, A.entries.length - 1))
const unit = A.entries.length ? unitOf(units, cur) : []
@@ -104,12 +111,17 @@ function ActiveWorkout() {
const done = setsDoneActive(A)
const mutEntry = (idx, fn) => update(s => { fn(s.active.entries[idx]) }, true)
- const setWeight = (idx, i, v) => { if (i === -1) mutEntry(idx, e => e.sets.forEach(s => { if (!s.done) s.w = v })); else mutEntry(idx, e => { e.sets[i].w = v }) }
- const setReps = (idx, i, v) => mutEntry(idx, e => { e.sets[i].r = v })
- const addSet = idx => mutEntry(idx, e => { const l = e.sets[e.sets.length - 1]; e.sets.push({ w: l ? l.w : 0, r: l ? l.r : e.target.reps, done: false }) })
+ const setField = (idx, i, field, v) => mutEntry(idx, e => { e.sets[i][field] = v })
+ const bumpAll = (idx, field, v) => mutEntry(idx, e => e.sets.forEach(s => { if (!s.done) s[field] = v }))
+ const addSet = idx => mutEntry(idx, e => {
+ const l = e.sets[e.sets.length - 1]
+ if (isCardio(e.id)) e.sets.push({ min: l ? l.min : (e.target.min || 20), speed: l ? l.speed : (e.target.speed || 8), done: false })
+ else e.sets.push({ w: l ? l.w : 0, r: l ? l.r : e.target.reps, done: false })
+ })
const toggle = (idx, i) => {
- let askTop = false
+ const cardioEntry = isCardio(A.entries[idx].id)
+ let askTop = false, exJustDone = false
mutEntry(idx, e => {
e.sets[i].done = !e.sets[i].done
if (e.sets[i].done) {
@@ -118,16 +130,17 @@ function ActiveWorkout() {
const unitDone = unit.every(ui => (ui === idx ? e : A.entries[ui]).sets.every(x => x.done))
if (isLastExInUnit && !unitDone) startRest(S.restSec)
else if (unitDone) stopRest()
- if (e.sets.every(x => x.done) && !e.asked) { e.asked = true; askTop = true }
+ if (e.sets.every(x => x.done)) { exJustDone = true; if (!cardioEntry && !e.asked) { e.asked = true; askTop = true } }
}
})
if (askTop) topWeightSheet(idx)
+ else if (exJustDone && cardioEntry) useUI.getState().toast('Cardio logged π')
}
return
-
{A.name}
{elapsed} Β· {done}/{total} sets
+
{A.name}
Β· {done}/{total} sets
@@ -140,11 +153,11 @@ function ActiveWorkout() {
{unit.map((idx, k) =>
{k > 0 &&
+
}
toggle(idx, i)} onWeight={(i, v) => setWeight(idx, i, v)} onReps={(i, v) => setReps(idx, i, v)} onAddSet={() => addSet(idx)} />
+ onToggle={i => toggle(idx, i)} onField={(i, f, v) => setField(idx, i, f, v)} onBumpAll={(f, v) => bumpAll(idx, f, v)} onAddSet={() => addSet(idx)} />
)}
) : (
-
toggle(cur, i)} onWeight={(i, v) => setWeight(cur, i, v)} onReps={(i, v) => setReps(cur, i, v)} onAddSet={() => addSet(cur)} />
+ toggle(cur, i)} onField={(i, f, v) => setField(cur, i, f, v)} onBumpAll={(f, v) => bumpAll(cur, f, v)} onAddSet={() => addSet(cur)} />
)}
> : π―
Freestyle workout β add your first exercise.
}