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: allow hiding home weight card
Claytone7f0f811fe6d
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex 05eaeab8c..13da600c2 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(645)+ expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(646)expect(inherited).toHaveLength(660)// 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 dc0a877ca..09c5657ab 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -1206,6 +1206,7 @@ export default {'Could not start the scanner': 'Scanner konnte nicht gestartet werden','Gym check-in': 'Gym-Check-in','Show a card on Home with your membership QR codes.': 'Zeigt auf Start eine Karte mit deinen Mitglieds-QR-Codes.',+ 'Show the body weight card on Home.': 'Zeigt die Körpergewichtskarte auf Start.','Point the camera at the QR code': 'Richte die Kamera auf den QR-Code','Camera is not available here — import a photo or type the code instead.': 'Die Kamera ist hier nicht verfügbar — importiere ein Foto oder tippe den Code ein.','Camera access was denied — allow it in your browser and try again.': 'Kamerazugriff wurde verweigert — erlaube ihn im Browser und versuche es erneut.',diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 2393a0c16..709288b4e 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': 'No se pudo iniciar el escáner','Gym check-in': 'Check-in del gimnasio','Show a card on Home with your membership QR codes.': 'Muestra en Inicio una tarjeta con tus códigos QR de socio.',+ 'Show the body weight card on Home.': 'Muestra la tarjeta de peso corporal en Inicio.','Point the camera at the QR code': 'Apunta la cámara al código QR','Camera is not available here — import a photo or type the code instead.': 'La cámara no está disponible aquí — importa una foto o escribe el código.','Camera access was denied — allow it in your browser and try again.': 'Se denegó el acceso a la cámara — permítelo en el navegador e inténtalo de nuevo.',diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex 15e014795..b4f16bf11 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': 'Impossible de démarrer le scanner','Gym check-in': 'Enregistrement à la salle','Show a card on Home with your membership QR codes.': 'Affiche sur l’Accueil une carte avec vos codes QR d’abonné.',+ 'Show the body weight card on Home.': 'Affiche la carte de poids sur l’Accueil.','Point the camera at the QR code': 'Pointez la caméra vers le code QR','Camera is not available here — import a photo or type the code instead.': 'La caméra n’est pas disponible ici — importez une photo ou saisissez le code.','Camera access was denied — allow it in your browser and try again.': 'L’accès à la caméra a été refusé — autorisez-le dans le navigateur et réessayez.',diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex 95c35c135..840ee6116 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': 'स्कैनर शुरू नहीं हो सका','Gym check-in': 'जिम चेक-इन','Show a card on Home with your membership QR codes.': 'होम पर आपके सदस्यता QR कोड वाला कार्ड दिखाता है।',+ 'Show the body weight card on Home.': 'होम पर शरीर के वजन का कार्ड दिखाता है।','Point the camera at the QR code': 'कैमरे को QR कोड पर रखें','Camera is not available here — import a photo or type the code instead.': 'कैमरा यहाँ उपलब्ध नहीं है — फ़ोटो इंपोर्ट करें या कोड टाइप करें।','Camera access was denied — allow it in your browser and try again.': 'कैमरे की अनुमति नहीं मिली — ब्राउज़र में अनुमति दें और फिर कोशिश करें।',diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex a1cf236c0..68aac00e9 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -1189,6 +1189,7 @@ export default {'Message the Coach…': 'Üzenet az Edzőnek…','Gym check-in': 'Bejelentkezés a teremben','Show a card on Home with your membership QR codes.': 'A Kezdőlapon egy kártyát mutat a tagsági QR-kódjaiddal.',+ 'Show the body weight card on Home.': 'Megjeleníti a testsúlykártyát a Kezdőlapon.','Point the camera at the QR code': 'Irányítsd a kamerát a QR-kódra','Camera is not available here — import a photo or type the code instead.': 'A kamera itt nem elérhető — importálj egy fotót vagy írd be a kódot.','Camera access was denied — allow it in your browser and try again.': 'A kamera-hozzáférés elutasítva — engedélyezd a böngészőben, és próbáld újra.',diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex 89d904785..b2563b728 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': 'Impossibile avviare lo scanner','Gym check-in': 'Check-in in palestra','Show a card on Home with your membership QR codes.': 'Mostra nella Home una scheda con i tuoi codici QR di iscrizione.',+ 'Show the body weight card on Home.': 'Mostra la scheda del peso corporeo nella Home.','Point the camera at the QR code': 'Inquadra il codice QR con la fotocamera','Camera is not available here — import a photo or type the code instead.': 'La fotocamera non è disponibile qui — importa una foto o digita il codice.','Camera access was denied — allow it in your browser and try again.': 'Accesso alla fotocamera negato — consentilo nel browser e riprova.',diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex f36bbe008..eb6efc662 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': '스캐너를 시작할 수 없습니다','Gym check-in': '헬스장 체크인','Show a card on Home with your membership QR codes.': '홈 화면에 회원 QR 코드 카드를 표시합니다.',+ 'Show the body weight card on Home.': '홈 화면에 체중 카드를 표시합니다.','Point the camera at the QR code': '카메라를 QR 코드에 맞추세요','Camera is not available here — import a photo or type the code instead.': '여기서는 카메라를 사용할 수 없습니다 — 사진을 가져오거나 코드를 입력하세요.','Camera access was denied — allow it in your browser and try again.': '카메라 접근이 거부되었습니다 — 브라우저에서 허용한 뒤 다시 시도하세요.',diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex 529d5ab92..86dea32ee 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': 'Nie udało się uruchomić skanera','Gym check-in': 'Zameldowanie na siłowni','Show a card on Home with your membership QR codes.': 'Pokazuje na Starcie kartę z Twoimi kodami QR członkowskimi.',+ 'Show the body weight card on Home.': 'Pokazuje kartę masy ciała na Starcie.','Point the camera at the QR code': 'Skieruj aparat na kod QR','Camera is not available here — import a photo or type the code instead.': 'Aparat nie jest tu dostępny — zaimportuj zdjęcie lub wpisz kod.','Camera access was denied — allow it in your browser and try again.': 'Odmówiono dostępu do aparatu — zezwól w przeglądarce i spróbuj ponownie.',diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.jsindex 087c69641..c48c79db6 100644--- a/frontend/src/locales/pt-BR.js+++ b/frontend/src/locales/pt-BR.js@@ -646,6 +646,7 @@ export const PT_BR_OVERRIDES = {'Could not start the scanner': 'Não foi possível iniciar o scanner','Gym check-in': 'Check-in na academia','Show a card on Home with your membership QR codes.': 'Mostra no Início um cartão com seus códigos QR de sócio.',+ 'Show the body weight card on Home.': 'Mostra o cartão de peso corporal no Início.','Point the camera at the QR code': 'Aponte a câmera para o código QR','Camera is not available here — import a photo or type the code instead.': 'A câmera não está disponível aqui — importe uma foto ou digite o código.','Camera access was denied — allow it in your browser and try again.': 'O acesso à câmera foi negado — permita-o no navegador e tente de novo.',diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex d07541e8d..418878c14 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': 'Não foi possível iniciar o scanner','Gym check-in': 'Check-in no ginásio','Show a card on Home with your membership QR codes.': 'Mostra no Início um cartão com os teus códigos QR de sócio.',+ 'Show the body weight card on Home.': 'Mostra o cartão de peso corporal no Início.','Point the camera at the QR code': 'Aponta a câmara para o código QR','Camera is not available here — import a photo or type the code instead.': 'A câmara não está disponível aqui — importa uma foto ou escreve o código.','Camera access was denied — allow it in your browser and try again.': 'O acesso à câmara foi recusado — permite-o no navegador e tenta de novo.',diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex accc919de..e2b33f394 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': 'Не удалось запустить сканер','Gym check-in': 'Отметка в зале','Show a card on Home with your membership QR codes.': 'Показывает на Главной карточку с вашими QR-кодами абонемента.',+ 'Show the body weight card on Home.': 'Показывает карточку веса тела на Главной.','Point the camera at the QR code': 'Наведите камеру на QR-код','Camera is not available here — import a photo or type the code instead.': 'Камера здесь недоступна — импортируйте фото или введите код.','Camera access was denied — allow it in your browser and try again.': 'Доступ к камере запрещён — разрешите его в браузере и попробуйте снова.',diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex e8fdc2ff5..27d276d85 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -1197,6 +1197,7 @@ export default {'Message the Coach…': 'ส่งข้อความถึงโค้ช…','Gym check-in': 'เช็คอินที่ยิม','Show a card on Home with your membership QR codes.': 'แสดงการ์ดพร้อม QR โค้ดสมาชิกของคุณบนหน้าหลัก',+ 'Show the body weight card on Home.': 'แสดงการ์ดน้ำหนักตัวบนหน้าหลัก','Point the camera at the QR code': 'เล็งกล้องไปที่ QR โค้ด','Camera is not available here — import a photo or type the code instead.': 'ใช้กล้องที่นี่ไม่ได้ — นำเข้ารูปภาพหรือพิมพ์รหัสแทน','Camera access was denied — allow it in your browser and try again.': 'การเข้าถึงกล้องถูกปฏิเสธ — อนุญาตในเบราว์เซอร์แล้วลองอีกครั้ง',diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex 82f934fed..4c8f3ed51 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': 'Tarayıcı başlatılamadı','Gym check-in': 'Salon girişi','Show a card on Home with your membership QR codes.': 'Ana sayfada üyelik QR kodlarınızı içeren bir kart gösterir.',+ 'Show the body weight card on Home.': 'Ana sayfada vücut ağırlığı kartını gösterir.','Point the camera at the QR code': 'Kamerayı QR koda tutun','Camera is not available here — import a photo or type the code instead.': 'Kamera burada kullanılamıyor — bir fotoğraf içe aktarın veya kodu yazın.','Camera access was denied — allow it in your browser and try again.': 'Kamera erişimi reddedildi — tarayıcıda izin verip tekrar deneyin.',diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 7f4492b44..cf1593c55 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -1186,6 +1186,7 @@ export default {'Could not start the scanner': '无法启动扫描器','Gym check-in': '健身房签到','Show a card on Home with your membership QR codes.': '在首页显示一张包含会员二维码的卡片。',+ 'Show the body weight card on Home.': '在首页显示体重卡片。','Point the camera at the QR code': '将摄像头对准二维码','Camera is not available here — import a photo or type the code instead.': '此处无法使用摄像头 — 请导入照片或手动输入代码。','Camera access was denied — allow it in your browser and try again.': '摄像头访问被拒绝 — 请在浏览器中允许后重试。',diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.jsindex 00fc90d83..8c8f590f8 100644--- a/frontend/src/store/useStore.js+++ b/frontend/src/store/useStore.js@@ -78,6 +78,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 the body-weight summary card is shown on Home. Off only hides that card: existing+ // entries, Stats, imports and the separate pre-workout weigh-in flow keep working.+ // Defaults on; an older profile without the key reads as on (`!== false`).+ showWeightCard: 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`).diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsxindex 49baab18c..32b0d82d2 100644--- a/frontend/src/views/Home.jsx+++ b/frontend/src/views/Home.jsx@@ -139,7 +139,7 @@ export default function Home() {</div>)}- <div className="card">+ {S.showWeightCard !== false && <div className="card"><div className="row between bw-head" style={{ marginBottom: 6 }}><h2 style={{ margin: 0 }}>{t('Body weight')}</h2><div className="row" style={{ gap: 8 }}>@@ -169,7 +169,7 @@ export default function Home() {</> : <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>}<div className="card tappable" style={{ cursor: 'pointer' }} {...tappable(() => calendarSheet())}><div className="row between">diff --git a/frontend/src/views/Home.weight-card.test.jsx b/frontend/src/views/Home.weight-card.test.jsxnew file mode 100644index 000000000..d5b1cb6e8--- /dev/null+++ b/frontend/src/views/Home.weight-card.test.jsx@@ -0,0 +1,47 @@+// @vitest-environment happy-dom+import React, { act } from 'react'+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'+import { createRoot } from 'react-dom/client'+import { useStore } from '../store/useStore.js'+import Home from './Home.jsx'++vi.mock('react-router-dom', () => ({ useNavigate: () => vi.fn() }))+vi.mock('../sheets.jsx', () => ({+ starterPlanSheet: vi.fn(), bwSheet: vi.fn(), goalSheet: vi.fn(), dayOverrideSheet: vi.fn(),+ calendarSheet: vi.fn(), startFlow: vi.fn(), bwDeltaColor: () => '',+}))++let host, root+beforeEach(() => {+ globalThis.IS_REACT_ACT_ENVIRONMENT = true+ host = document.createElement('div')+ document.body.appendChild(host)+ root = createRoot(host)+})+afterEach(() => { act(() => root.unmount()); host.remove() })++const mountWith = showWeightCard => {+ useStore.setState(s => ({+ S: { ...s.S, routines: [], workouts: [], bodyweight: [], dayPlan: {}, week: {}, active: null, showWeightCard },+ user: null,+ }))+ act(() => root.render(<Home />))+}+const weightHeading = () => [...host.querySelectorAll('h2')].find(el => el.textContent === 'Body weight')++describe('Home body-weight card preference', () => {+ it('shows the card for legacy profiles without the preference', () => {+ mountWith(undefined)+ expect(weightHeading()).toBeTruthy()+ })++ it('shows the card when enabled', () => {+ mountWith(true)+ expect(weightHeading()).toBeTruthy()+ })++ it('hides only the Home card when disabled', () => {+ mountWith(false)+ expect(weightHeading()).toBeFalsy()+ })+})\ No newline at end of filediff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsxindex 993c0373d..2e37a187f 100644--- a/frontend/src/views/Settings.jsx+++ b/frontend/src/views/Settings.jsx@@ -265,6 +265,11 @@ export default function Settings() {subtitle={t('Show a card on Home with your membership QR codes.')}><Switch checked={S.checkIn !== false} onChange={v => update(s => { s.checkIn = v })} /></Row>+ {/* The Home summary is optional; hiding it leaves weight logging, history and Stats intact. */}+ <Row icon="scale" iconTint="var(--green)" title={t('Body weight')}+ subtitle={t('Show the body weight card on Home.')}>+ <Switch checked={S.showWeightCard !== false} onChange={v => update(s => { s.showWeightCard = v })} />+ </Row></Section>{/* ---------- during a workout ---------- */}