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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Arabic: the new search count, best-set line, not-counted marker and superset bar in a past workout mirror in right-to-left, and ← goes to the next exercise there, as a swipe does (#133)
Duarte Santosd28b440d4d74
diff --git a/frontend/src/index.css b/frontend/src/index.cssindex c8de109f5..143f0048e 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -589,9 +589,9 @@ body.chips-dragging *{cursor:inherit}/* The live result count (Library and the exercise picker, from GitLab !31): a pill at the endof the field while a search or filter narrows the list. The field makes room for it only whileit is there, so a long placeholder is not cut short for nothing. */-.search.has-count .input{padding-right:62px}+.search.has-count .input{padding-inline-end:62px}.search .search-count{- position:absolute;right:9px;top:50%;transform:translateY(-50%);+ position:absolute;inset-inline-end:9px;top:50%;transform:translateY(-50%);font-size:12px;font-weight:600;line-height:1.4;color:var(--label-2);background:var(--surface-3);padding:2px 8px;border-radius:99px;font-variant-numeric:tabular-nums;pointer-events:none;user-select:none;@@ -1056,12 +1056,12 @@ body.chips-dragging *{cursor:inherit}.progline svg{flex:none;margin-top:2px}/* "Last time" / "Best set" under the plan line (#173): a button that switches between the two,looking like the plain line it replaced, with a small icon to say it can be tapped. */-.refline{width:100%;display:flex;align-items:flex-start;gap:6px;margin-bottom:4px;padding:0;text-align:left}+.refline{width:100%;display:flex;align-items:flex-start;gap:6px;margin-bottom:4px;padding:0;text-align:start}.refline svg{flex:none;margin-top:2px;font-size:12px}/* an exercise kept out of progression for this session, with its undo */.noprog{display:flex;align-items:center;gap:7px;margin:0 0 6px;font-size:13px;line-height:1.38;color:var(--orange)}.noprog svg{flex:none}-.noprog .chip{margin-left:auto;padding:3px 11px;font-size:13px;color:var(--orange);background:color-mix(in srgb,var(--orange) 14%,transparent)}+.noprog .chip{margin-inline-start:auto;padding:3px 11px;font-size:13px;color:var(--orange);background:color-mix(in srgb,var(--orange) 14%,transparent)}/* start a timed set (issue #16) — sits where you'd otherwise reach for the checkbox */.setrow .setgo{@@ -1390,7 +1390,7 @@ body.chips-dragging *{cursor:inherit}.wd-ex{margin-bottom:12px;cursor:pointer;border-radius:10px}.wd-ex>.grow{flex:1;min-width:0}.wd-ex:active{background:var(--surface-2)}-.wd-ss{box-shadow:inset 3px 0 0 var(--acc);padding-left:11px;margin-bottom:12px}+.wd-ss{box-shadow:inset 3px 0 0 var(--acc);padding-inline-start:11px;margin-bottom:12px}.wd-ss .ss-label{margin:0 0 8px}.wd-ss .wd-ex:last-child{margin-bottom:0}.ss-card{@@ -1582,7 +1582,7 @@ body.chips-dragging *{cursor:inherit}/* Numbers and dates inside Arabic text still read left-to-right. */[dir="rtl"] .num,[dir="rtl"] input[type="number"]{direction:ltr}/* Superset edge stripe points at the inline start (the right, in RTL). */-[dir="rtl"] .item.in-ss{box-shadow:inset -3px 0 0 var(--acc)}+[dir="rtl"] .item.in-ss,[dir="rtl"] .wd-ss{box-shadow:inset -3px 0 0 var(--acc)}/* Slider: the thumb is offset from inline-start, which is the right edge in RTL, so thehalf-width centering shift points the other way. */[dir="rtl"] .sld-knob{transform:translateX(50%)}diff --git a/frontend/src/lib/workout-keys.js b/frontend/src/lib/workout-keys.jsindex 4c452ea5a..253a89ec8 100644--- a/frontend/src/lib/workout-keys.js+++ b/frontend/src/lib/workout-keys.js@@ -21,8 +21,11 @@ const CONTROL = 'button,a[href],summary,[role="button"],[role="checkbox"],[role=* pressed (Chrome, Firefox), and a USB button that sends Space must not press "Next" again just* because the mouse was the last thing to use it — so without Tab, Space and Enter tick.* Modifier combinations are left alone: they are the browser's and the system's shortcuts.+ *+ * `rtl` mirrors the arrows: in a right-to-left language the exercises run from right to left like+ * the text, and the next card comes in from the left (components/SwipeCards.jsx), so ← is next.*/-export function workoutKeyAction(event, { tabbed = false } = {}) {+export function workoutKeyAction(event, { tabbed = false, rtl = false } = {}) {if (!event || event.defaultPrevented || event.repeat || event.isComposing) return nullif (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return nullconst target = event.target@@ -33,8 +36,8 @@ export function workoutKeyAction(event, { tabbed = false } = {}) {case 'Spacebar':case 'Enter':return tabbed && within(CONTROL) ? null : 'tick'- case 'ArrowLeft': return 'prev'- case 'ArrowRight': return 'next'+ case 'ArrowLeft': return rtl ? 'next' : 'prev'+ case 'ArrowRight': return rtl ? 'prev' : 'next'default: return null}}diff --git a/frontend/src/lib/workout-keys.test.js b/frontend/src/lib/workout-keys.test.jsindex 8efea9bae..9cefaefc9 100644--- a/frontend/src/lib/workout-keys.test.js+++ b/frontend/src/lib/workout-keys.test.js@@ -18,6 +18,9 @@ describe('workoutKeyAction (issue #133)', () => {expect(workoutKeyAction(key('Enter'))).toBe('tick')expect(workoutKeyAction(key('ArrowLeft'))).toBe('prev')expect(workoutKeyAction(key('ArrowRight'))).toBe('next')+ // Right to left (Arabic), the next exercise lies to the left, as a swipe brings it in.+ expect(workoutKeyAction(key('ArrowLeft'), { rtl: true })).toBe('next')+ expect(workoutKeyAction(key('ArrowRight'), { rtl: true })).toBe('prev')})it('leaves every other key alone, the vertical arrows included (they scroll a list)', () => {diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsxindex eea8e2ba1..fed45ed9c 100644--- a/frontend/src/views/Workout.jsx+++ b/frontend/src/views/Workout.jsx@@ -1110,7 +1110,7 @@ function ActiveWorkout() {onKey.current = event => {// A sheet on top owns the keyboard (Escape closes it, Enter confirms in it).if (useUI.getState().sheets.length) return false- const action = workoutKeyAction(event, { tabbed: tabbed.current })+ const action = workoutKeyAction(event, { tabbed: tabbed.current, rtl: document.documentElement.dir === 'rtl' })if (!action) return falseevent.preventDefault()if (action !== 'tick') { navigateUnit(action === 'next' ? 1 : -1); showCurrent(); return true }