Skip to content

Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.

Merge PR #563 by Space-Hermes: a persistent Complete / Next button in workouts

Duarte Santosa2b69d8f9177
diff --cc frontend/src/App.jsx
index b97e709bd,11c710ea3..e4b73dd3a
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@@ -207,17 -176,17 +208,17 @@@ function Shell()
}, [loc.pathname, navType])
// bound to the workout, not to the route — checking Stats mid-session keeps the screen on
useWakeLock(!!S.active && !S.active.editingWorkoutId && S.keepAwake !== false)
- // A running workout has the whole screen (v1.3.11): no tab bar, and the rest bar docks to the
- // bottom edge in its place. Its header's ⌄ goes back to the app, where the tab bar's Resume
- // brings it back.
+ // Workouts keep navigation hidden, with only their primary action below the rest timer.
const inWorkout = loc.pathname === '/workout' && !!S.active
+ const hasWorkoutAction = inWorkout && !S.active.editingWorkoutId && !S.active.backfill
+ && workoutAction?.sessionId === S.active.id
useEffect(() => {
- document.body.classList.toggle('no-tabbar', inWorkout)
+ document.body.classList.toggle('no-tabbar', inWorkout && !hasWorkoutAction)
return () => document.body.classList.remove('no-tabbar')
- }, [inWorkout])
+ }, [inWorkout, hasWorkoutAction])
// The chat owns the bottom of the screen as well: its composer sits where the tabs would be.
// The first-launch card has no tabs either: they changed the route behind it.
- const noTabs = inWorkout || loc.pathname === '/coach' || needsMobileOnboarding || permSteps
- const noTabs = (inWorkout && !hasWorkoutAction) || loc.pathname === '/coach' || needsMobileOnboarding
++ const noTabs = (inWorkout && !hasWorkoutAction) || loc.pathname === '/coach' || needsMobileOnboarding || permSteps
const authed = user || isGuest
if (!ready && !authed) return (
@@@ -228,47 -197,42 +229,47 @@@
</div>
)
+ const view = l => (!authed ? <Login /> : needsMobileOnboarding ? <MobileOnboarding /> : permSteps ? <PermissionSteps /> : (
+ <Routes location={l}>
+ <Route path="/home" element={<Home />} />
+ {/* Gym check-in — switched off in Settings, the route falls through to the
+ catch-all redirect below. */}
+ {S.checkIn !== false && <Route path="/checkin" element={<CheckIn />} />}
+ <Route path="/plan" element={<Plan />} />
+ <Route path="/plan/r/:id" element={<RoutineEdit />} />
- <Route path="/workout" element={<Workout />} />
++ <Route path="/workout" element={<Workout onActionChange={setWorkoutAction} />} />
+ <Route path="/stats" element={<Stats />} />
+ <Route path="/history" element={<History />} />
+ <Route path="/library" element={<Library />} />
+ <Route path="/muscles" element={<Muscles />} />
+ <Route path="/structural-balance" element={<StructuralBalance />} />
+ <Route path="/progress-photos" element={<ProgressPhotos />} />
+ <Route path="/measurements" element={<Measurements />} />
+ <Route path="/settings" element={<SettingsRoute />} />
+ <Route path="/settings/:page" element={<SettingsRoute />} />
+ {/* The Coach screens gate themselves on the instance config; the routes exist
+ unconditionally so a deep link from a notification lands somewhere sane
+ rather than on the catch-all. */}
+ <Route path="/coach" element={<CoachChat />} />
+ <Route path="/coach/intake" element={<CoachIntake />} />
+ <Route path="/coach/proposal" element={<Navigate to="/coach" replace />} />
+ <Route path="/coach/setup" element={<CoachSetup />} />
+ <Route path="/admin" element={user?.admin ? <Admin /> : <Navigate to="/home" replace />} />
+ <Route path="*" element={<Navigate to="/home" replace />} />
+ </Routes>
+ ))
+ const showPreview = !!preview && preview !== loc.pathname && authed && !needsMobileOnboarding && !permSteps
+
return (
<>
- {/* keyed on the route: a view that throws is contained, and switching tabs
- re-mounts the boundary, so the tab bar is always a way out */}
- <div id="app" className="vfade" key={loc.pathname}>
- <ErrorBoundary>
- {!authed ? <Login /> : needsMobileOnboarding ? <MobileOnboarding /> : (
- <Routes>
- <Route path="/home" element={<Home />} />
- {/* Gym check-in — switched off in Settings, the route falls through to the
- catch-all redirect below. */}
- {S.checkIn !== false && <Route path="/checkin" element={<CheckIn />} />}
- <Route path="/plan" element={<Plan />} />
- <Route path="/plan/r/:id" element={<RoutineEdit />} />
- <Route path="/workout" element={<Workout onActionChange={setWorkoutAction} />} />
- <Route path="/stats" element={<Stats />} />
- <Route path="/history" element={<History />} />
- <Route path="/library" element={<Library />} />
- <Route path="/muscles" element={<Muscles />} />
- <Route path="/structural-balance" element={<StructuralBalance />} />
- <Route path="/progress-photos" element={<ProgressPhotos />} />
- <Route path="/measurements" element={<Measurements />} />
- <Route path="/settings" element={<SettingsRoute />} />
- <Route path="/settings/:page" element={<SettingsRoute />} />
- {/* The Coach screens gate themselves on the instance config; the routes exist
- unconditionally so a deep link from a notification lands somewhere sane
- rather than on the catch-all. */}
- <Route path="/coach" element={<CoachChat />} />
- <Route path="/coach/intake" element={<CoachIntake />} />
- <Route path="/coach/proposal" element={<Navigate to="/coach" replace />} />
- <Route path="/coach/setup" element={<CoachSetup />} />
- <Route path="/admin" element={user?.admin ? <Admin /> : <Navigate to="/home" replace />} />
- <Route path="*" element={<Navigate to="/home" replace />} />
- </Routes>
- )}
- </ErrorBoundary>
+ {/* One page per route, keyed on it: a view that throws is contained, and switching tabs
+ re-mounts the boundary, so the tab bar is always a way out. While an edge swipe back
+ is under way the page it goes back to sits underneath (Page `under`), and as the swipe
+ lands it simply stays: same key, same parent, so React keeps it instead of mounting
+ the route again. */}
+ <div id="app">
+ <Page key={loc.pathname} loc={loc} render={view} />
+ {showPreview && <Page key={preview} loc={previewLoc(preview)} render={view} under scrollY={scrollPositions.get(preview) || 0} />}
</div>
{/* Outside #app: the view's fade-in animates a transform, and a fixed element inside it
would ride along with the page for the length of it. Decides for itself when to show —
diff --cc frontend/src/views/Workout.jsx
index c8696e20e,3782f3579..5c14bec4e
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@@ -2105,15 -2128,7 +2150,15 @@@ function ActiveWorkout({ onActionChang
</WorkoutScrollAnchor>
}
+// The swipe hint's quiet moment (see the hint in the screen below): the last touch anywhere.
+export const HINT_DELAY_MS = 600
+export const HINT_QUIET_MS = 2500
+let lastTouchAt = 0
+if (typeof document !== 'undefined') document.addEventListener('pointerdown', () => { lastTouchAt = Date.now() }, true)
+// Test seam: a fresh launch, nobody has touched anything yet.
+export function _resetHintQuiet() { lastTouchAt = 0 }
+
- export default function Workout() {
+ export default function Workout({ onActionChange }) {
const active = useStore(s => s.S.active)
- return active ? <ActiveWorkout /> : <StartChooser />
+ return active ? <ActiveWorkout onActionChange={onActionChange} /> : <StartChooser />
}