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
feat(settings): a switch to skip the weigh-in when a workout starts (#137)
Boris Kurktchievebe00a112292
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex 962f69f68..c6a69cdfe 100644--- a/frontend/src/lib/pt-br-locale.test.js+++ b/frontend/src/lib/pt-br-locale.test.js@@ -27,7 +27,7 @@ describe('Brazilian Portuguese locale', () => {.sort(byCodeUnit)const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')- expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(635)+ expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(638)expect(inherited).toHaveLength(639)// If this fails, review the changed keys and wording before accepting a new hash. From// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --listdiff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex ee9764736..dcbe561fe 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -336,6 +336,9 @@ export default {'Rest timer': 'Pausen-Timer','Sounds': 'Töne','Flash screen when timer ends': 'Bildschirm bei Timer-Ende blinken lassen',+ 'Weigh in before workouts': 'Vor dem Training wiegen',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Fragt beim Start eines Trainings nach deinem Körpergewicht. Aus startet die Einheit direkt.',+ 'No entries yet — log your weight to start the curve.': 'Noch keine Einträge — trag dein Gewicht ein, um die Kurve zu starten.','Data': 'Daten','Export backup (JSON)': 'Backup exportieren (JSON)','Import backup': 'Backup importieren',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 475108c6a..72a6d3a87 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -321,6 +321,9 @@ export default {'Rest timer': 'Temporizador de descanso','Sounds': 'Sonidos','Flash screen when timer ends': 'Hacer parpadear la pantalla al finalizar el temporizador',+ 'Weigh in before workouts': 'Pesarse antes de entrenar',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Pide tu peso corporal al empezar un entrenamiento. Desactivado, la sesión empieza directamente.',+ 'No entries yet — log your weight to start the curve.': 'Sin registros aún — apunta tu peso para empezar la curva.','Data': 'Datos','Export backup (JSON)': 'Exportar copia (JSON)','Import backup': 'Importar copia',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 33d7e70dd..d85870705 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -321,6 +321,9 @@ export default {'Rest timer': 'Minuteur de repos','Sounds': 'Sons','Flash screen when timer ends': 'Faire clignoter l’écran à la fin du minuteur',+ 'Weigh in before workouts': 'Se peser avant la séance',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Demande ton poids au début d’une séance. Désactivé, la séance démarre directement.',+ 'No entries yet — log your weight to start the curve.': 'Aucune entrée — note ton poids pour démarrer la courbe.','Data': 'Données','Export backup (JSON)': 'Exporter une sauvegarde (JSON)','Import backup': 'Importer une sauvegarde',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 2ae66c12a..6d515cb14 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -321,6 +321,9 @@ export default {'Rest timer': 'आराम टाइमर','Sounds': 'ध्वनियाँ','Flash screen when timer ends': 'टाइमर खत्म होने पर स्क्रीन फ्लैश करें',+ 'Weigh in before workouts': 'वर्कआउट से पहले वज़न दर्ज करना',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'वर्कआउट शुरू होते समय आपका वज़न पूछता है। बंद होने पर सेशन सीधे शुरू होता है।',+ 'No entries yet — log your weight to start the curve.': 'अभी कोई एंट्री नहीं — ग्राफ़ शुरू करने के लिए वज़न दर्ज करें।','Data': 'डेटा','Export backup (JSON)': 'बैकअप निर्यात करें (JSON)','Import backup': 'बैकअप आयात करें',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex 20879efe6..3cb7e0cc3 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -745,6 +745,9 @@ export default {'Logged sets stay with the original exercise. The replacement will be inserted afterward.': 'A naplózott sorozatok az eredeti gyakorlatnál maradnak. A csere utána kerül beszúrásra.','Rest after each set of this exercise. Leave at 0 to use your default rest timer.': 'Pihenő a gyakorlat minden sorozata után. Hagyd 0-n az alapértelmezett pihenőidőzítőhöz.','Flash screen when timer ends': 'Képernyő villogása, ha lejár az időzítő',+ 'Weigh in before workouts': 'Súlymérés edzés előtt',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Edzés indításakor rákérdez a testsúlyodra. Kikapcsolva az edzés azonnal indul.',+ 'No entries yet — log your weight to start the curve.': 'Még nincs bejegyzés — rögzítsd a súlyodat a görbe elindításához.','Import from Hevy': 'Importálás a Hevyből','Pull your history with a Hevy Pro API key': 'Előzmények letöltése Hevy Pro API-kulccsal','Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'Előzmények letöltése Hevy Pro API-kulccsal. A kulcs csak ehhez az importhoz kell, nem mentjük el.',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 4441618de..c573ae0c4 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -321,6 +321,9 @@ export default {'Rest timer': 'Timer di riposo','Sounds': 'Suoni','Flash screen when timer ends': 'Fai lampeggiare lo schermo alla fine del timer',+ 'Weigh in before workouts': 'Pesarsi prima dell’allenamento',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Chiede il tuo peso all’avvio di un allenamento. Disattivato, la sessione parte subito.',+ 'No entries yet — log your weight to start the curve.': 'Nessun dato — registra il tuo peso per iniziare la curva.','Data': 'Dati','Export backup (JSON)': 'Esporta backup (JSON)','Import backup': 'Importa backup',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex eaa7a8687..49966192e 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -321,6 +321,9 @@ export default {'Rest timer': '휴식 타이머','Sounds': '소리','Flash screen when timer ends': '타이머 종료 시 화면 깜박임',+ 'Weigh in before workouts': '운동 전 체중 기록',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': '운동을 시작할 때 체중을 물어봅니다. 끄면 세션이 바로 시작됩니다.',+ 'No entries yet — log your weight to start the curve.': '아직 기록이 없어요 — 체중을 기록해 그래프를 시작하세요.','Data': '데이터','Export backup (JSON)': '백업 내보내기 (JSON)','Import backup': '백업 가져오기',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 13001d405..5dcde65ca 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -321,6 +321,9 @@ export default {'Rest timer': 'Minutnik przerwy','Sounds': 'Dźwięki','Flash screen when timer ends': 'Migaj ekranem po zakończeniu minutnika',+ 'Weigh in before workouts': 'Ważenie przed treningiem',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Pyta o Twoją masę ciała przy rozpoczęciu treningu. Wyłączone — sesja zaczyna się od razu.',+ 'No entries yet — log your weight to start the curve.': 'Brak wpisów — zapisz wagę, aby zacząć krzywą.','Data': 'Dane','Export backup (JSON)': 'Eksportuj kopię (JSON)','Import backup': 'Importuj kopię',diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex 1e3de0837..765fab7df 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -111,6 +111,9 @@ export const PT_BR_OVERRIDES = {'synced with your profile': 'sincronizado com seu perfil','The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.': 'A tela permanece ligada durante o treino, para você não precisar desbloquear o celular entre as séries.','Flash screen when timer ends': 'Piscar a tela quando o temporizador terminar',+ 'Weigh in before workouts': 'Pesar antes do treino',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Pede seu peso ao iniciar um treino. Desligado, a sessão começa na hora.',+ 'No entries yet — log your weight to start the curve.': 'Ainda não há registros — informe seu peso para começar a curva.','Export backup (JSON)': 'Exportar backup (JSON)','Import backup': 'Importar backup','Reset everything?': 'Redefinir tudo?',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex f01583a7f..b32ce8280 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -321,6 +321,9 @@ export default {'Rest timer': 'Temporizador de descanso','Sounds': 'Sons','Flash screen when timer ends': 'Piscar o ecrã quando o temporizador terminar',+ 'Weigh in before workouts': 'Pesar antes do treino',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Pede o teu peso ao iniciar um treino. Desligado, a sessão começa de imediato.',+ 'No entries yet — log your weight to start the curve.': 'Ainda sem registos — regista o teu peso para começar a curva.','Data': 'Dados','Export backup (JSON)': 'Exportar cópia (JSON)','Import backup': 'Importar cópia',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex 3285a9658..be10fc9cb 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -321,6 +321,9 @@ export default {'Rest timer': 'Таймер отдыха','Sounds': 'Звуки','Flash screen when timer ends': 'Мигать экраном по окончании таймера',+ 'Weigh in before workouts': 'Взвешивание перед тренировкой',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Спрашивает ваш вес при начале тренировки. Выключено — сессия начинается сразу.',+ 'No entries yet — log your weight to start the curve.': 'Записей пока нет — внеси вес, чтобы начать кривую.','Data': 'Данные','Export backup (JSON)': 'Экспорт резервной копии (JSON)','Import backup': 'Импорт резервной копии',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex c46ad18a2..fe29eee23 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -753,6 +753,9 @@ export default {'Logged sets stay with the original exercise. The replacement will be inserted afterward.': 'เซ็ตที่บันทึกแล้วจะอยู่กับท่าเดิม ท่าใหม่จะถูกแทรกไว้ถัดไป','Rest after each set of this exercise. Leave at 0 to use your default rest timer.': 'พักหลังแต่ละเซ็ตของท่านี้ ปล่อยไว้ที่ 0 เพื่อใช้ตัวจับเวลาพักค่าเริ่มต้น','Flash screen when timer ends': 'กะพริบหน้าจอเมื่อหมดเวลา',+ 'Weigh in before workouts': 'ชั่งน้ำหนักก่อนออกกำลังกาย',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'ถามน้ำหนักตัวเมื่อเริ่มออกกำลังกาย ถ้าปิด เซสชันจะเริ่มทันที',+ 'No entries yet — log your weight to start the curve.': 'ยังไม่มีข้อมูล — บันทึกน้ำหนักเพื่อเริ่มกราฟ','Import from Hevy': 'นำเข้าจาก Hevy','Pull your history with a Hevy Pro API key': 'ดึงประวัติด้วยคีย์ API ของ Hevy Pro','Pull your history with a Hevy Pro API key. The key is only used for this import and is not saved.': 'ดึงประวัติด้วยคีย์ API ของ Hevy Pro คีย์ใช้สำหรับการนำเข้าครั้งนี้เท่านั้นและจะไม่ถูกบันทึก',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 9f21eebc4..81ee6e6d2 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -321,6 +321,9 @@ export default {'Rest timer': 'Dinlenme sayacı','Sounds': 'Sesler','Flash screen when timer ends': 'Zamanlayıcı bitince ekranı yanıp söndür',+ 'Weigh in before workouts': 'Antrenman öncesi tartılma',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': 'Antrenman başlarken kilonu sorar. Kapalıyken seans hemen başlar.',+ 'No entries yet — log your weight to start the curve.': 'Henüz kayıt yok — eğriyi başlatmak için kilonu gir.','Data': 'Veriler','Export backup (JSON)': 'Yedeği dışa aktar (JSON)','Import backup': 'Yedeği içe aktar',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex a0502fa58..e5d7920cf 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -321,6 +321,9 @@ export default {'Rest timer': '休息计时','Sounds': '声音','Flash screen when timer ends': '计时结束时闪烁屏幕',+ 'Weigh in before workouts': '训练前称重',+ 'Asks for your body weight when a workout starts. Off starts the session straight away.': '开始训练时询问体重。关闭后直接进入训练。',+ 'No entries yet — log your weight to start the curve.': '还没有记录——记录体重以开始曲线。','Data': '数据','Export backup (JSON)': '导出备份(JSON)','Import backup': '导入备份',diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex c76ef5f9e..af1e9af5c 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -1730,6 +1730,9 @@ export function WorkoutRow({ w, onClick }) {// `routineIds` accepts `string | string[] | null` — `[r.id]` for one routine,// `effectiveRoutineIds(...)` for today's planned session, `[]` / null for explicit freestyle.export function startFlow(routineIds) {+ // The weigh-in is a setting (Settings → During a workout, issue #137): off goes straight+ // into the session with no body weight on it, same as "Start without weighing in".+ if (S().weighIn === false) { beginWorkout(routineIds, null); return }bwSheet({ required: true, onDone: bw => beginWorkout(routineIds, bw) })}export function beginWorkout(routineIds, bw) {diff --git a/frontend/src/sheets.weighin.test.jsx b/frontend/src/sheets.weighin.test.jsxnew file mode 100644index 000000000..bc35ff98d--- /dev/null+++ b/frontend/src/sheets.weighin.test.jsx@@ -0,0 +1,42 @@+// @vitest-environment happy-dom+import { act } from 'react'+import { beforeEach, describe, expect, it } from 'vitest'+import { useStore } from './store/useStore.js'+import { useUI } from './store/useUI.js'+import { startFlow } from './sheets.jsx'++// Start opens the quick weigh-in unless Settings → During a workout → "Weigh in before+// workouts" is off (issue #137) — then the session begins at once, with no body weight on it.++describe('the weigh-in before a workout is a setting', () => {+ beforeEach(() => {+ globalThis.IS_REACT_ACT_ENVIRONMENT = true+ useUI.setState({ sheets: [], toasts: [] })+ useStore.setState(s => ({ S: { ...s.S, active: null, routines: [], workouts: [], bodyweight: [], weighIn: true } }))+ })++ it('on (the default): Start opens the weigh-in and the session waits for it', () => {+ act(() => startFlow([]))+ expect(useUI.getState().sheets).toHaveLength(1)+ expect(useUI.getState().sheets[0].locked).toBe(true) // the required weigh-in, not a plain sheet+ expect(useStore.getState().S.active).toBeNull()+ })++ it('a profile written before the setting existed still asks', () => {+ useStore.setState(s => { const S = { ...s.S }; delete S.weighIn; return { S } })+ act(() => startFlow([]))+ expect(useUI.getState().sheets).toHaveLength(1)+ expect(useUI.getState().sheets[0].locked).toBe(true)+ expect(useStore.getState().S.active).toBeNull()+ })++ it('off: Start begins the session at once, with no sheet and no body weight', () => {+ useStore.setState(s => ({ S: { ...s.S, weighIn: false } }))+ act(() => startFlow([]))+ expect(useUI.getState().sheets).toHaveLength(0)+ const { active } = useStore.getState().S+ expect(active).not.toBeNull()+ expect(active.bw).toBeNull()+ expect(active.routineIds).toEqual([])+ })+})diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.jsindex c8a3cd85b..661811594 100644--- a/frontend/src/store/useStore.js+++ b/frontend/src/store/useStore.js@@ -74,6 +74,10 @@ export const DEF = {// card and the /checkin route; the saved gymCards stay so turning it back on restores them.// Defaults on; an older profile without the key reads as on (`!== false`).checkIn: true,+ // Whether Start opens the quick weigh-in first (sheets.jsx startFlow, issue #137). Off starts+ // the session straight away; weight can still be logged from Home/Stats. Defaults on; an+ // older profile without the key reads as on (`!== false`).+ weighIn: true,}const clone = o => JSON.parse(JSON.stringify(o))diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsxindex 19a091ad0..8355c3efb 100644--- a/frontend/src/views/Home.jsx+++ b/frontend/src/views/Home.jsx@@ -155,7 +155,9 @@ export default function Home() {</div>)}<div className="chart" style={{ marginTop: 8 }}><LineChart points={bwPoints} h={130} unit={S.unit} goal={S.targetW} /></div>- </> : <div className="muted small">{t("No entries yet — log your weight to start the curve. It's also asked before every workout.")}</div>}+ </> : <div className="muted small">{S.weighIn === false+ ? t('No entries yet — log your weight to start the curve.')+ : t("No entries yet — log your weight to start the curve. It's also asked before every workout.")}</div>}</div><div className="card tappable" style={{ cursor: 'pointer' }} {...tappable(() => calendarSheet())}>diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex 83d3d7e22..82766d949 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -260,6 +260,12 @@ export default function Settings() {{/* ---------- during a workout ---------- */}<Section title={t('During a workout')} footer={wakeOK ? t('The screen stays on while a workout is running, so you don’t have to unlock your phone between sets.') : null}>+ {/* The quick weigh-in that opens on Start (sheets.jsx startFlow, issue #137); off skips straight+ to the session. Home and Stats still log weight by hand. */}+ <Row icon="scale" iconTint="var(--green)" title={t('Weigh in before workouts')}+ subtitle={t('Asks for your body weight when a workout starts. Off starts the session straight away.')}>+ <Switch checked={S.weighIn !== false} onChange={v => update(s => { s.weighIn = v })} />+ </Row>{/* One exercise at a time (cards with Prev/Next), the whole session stacked as ascrollable list, or that list stripped to just names and set rows (compact).Legacy/unknown values read as cards. The running session can override this from