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.

Hide exercise animations during a workout: gifSize gains 'off' — Settings segment Full/Small/Hidden, workout media collapses entirely when hidden, strings in all 14 languages; pt-BR guard re-fingerprinted

Duarte Santos887a036832e2
diff --git a/frontend/src/components/Media.jsx b/frontend/src/components/Media.jsx
index db813f4d2..61b4602e6 100644
--- a/frontend/src/components/Media.jsx
+++ b/frontend/src/components/Media.jsx
@@ -8,12 +8,15 @@ import Icon from './Icon.jsx'
// Custom exercises have no media — the animation stays blank by design (issue #11).
// `minimizable` (workout view) adds a persistent minimize/expand control so the animation stops
// eating the screen; the chosen size is saved to settings and carries across exercises and
-// future workouts (issue #12).
+// future workouts (issue #12). Settings can also turn workout media off entirely
+// (gifSize 'off') — then nothing renders here and the exercise card closes up, exactly like
+// a custom exercise without media. Any other/legacy value behaves as 'full'.
export default function Media({ ex, id, compact, minimizable }) {
const [playing, setPlaying] = useState(true)
const gifSize = useStore(s => s.S.gifSize)
const update = useStore(s => s.update)
if (!ex.gif) return null
+ if (minimizable && gifSize === 'off') return null
const mini = minimizable && gifSize === 'mini'
const toggleSize = e => { e.stopPropagation(); update(s => { s.gifSize = mini ? 'full' : 'mini' }) }
return (
diff --git a/frontend/src/components/Media.test.jsx b/frontend/src/components/Media.test.jsx
new file mode 100644
index 000000000..40e5b4099
--- /dev/null
+++ b/frontend/src/components/Media.test.jsx
@@ -0,0 +1,74 @@
+// @vitest-environment happy-dom
+import React, { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import Media from './Media.jsx'
+
+globalThis.IS_REACT_ACT_ENVIRONMENT = true
+
+const mocks = vi.hoisted(() => {
+ const state = { S: { gifSize: 'full' } }
+ state.snapshot = () => ({
+ S: state.S,
+ update: mut => {
+ const next = structuredClone(state.S)
+ mut(next)
+ state.S = next
+ },
+ })
+ return state
+})
+vi.mock('../store/useStore.js', () => {
+ const useStore = selector => selector(mocks.snapshot())
+ useStore.getState = mocks.snapshot
+ return { useStore }
+})
+
+const EX = { id: 'bench', n: 'bench press', gif: 'bench.gif', img: 'bench.jpg' }
+
+let host, root
+beforeEach(() => {
+ mocks.S = { gifSize: 'full' }
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+})
+afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+})
+
+const mount = props => act(() => root.render(<Media ex={EX} {...props} />))
+
+describe('Media gifSize', () => {
+ it('renders the full animation by default and toggles to mini in the workout', () => {
+ mount({ minimizable: true })
+ expect(host.querySelector('.exmedia img')).toBeTruthy()
+ expect(host.querySelector('.exmedia.mini')).toBeFalsy()
+ act(() => { host.querySelector('.giftoggle').click() })
+ expect(mocks.S.gifSize).toBe('mini')
+ mount({ minimizable: true })
+ expect(host.querySelector('.exmedia.mini')).toBeTruthy()
+ })
+
+ it("renders nothing at all in the workout when gifSize is 'off'", () => {
+ mocks.S = { gifSize: 'off' }
+ mount({ minimizable: true })
+ expect(host.querySelector('.exmedia')).toBeFalsy()
+ expect(host.querySelector('img')).toBeFalsy()
+ expect(host.innerHTML).toBe('')
+ })
+
+ it("'off' only applies to the workout — the detail sheet (not minimizable) still shows media", () => {
+ mocks.S = { gifSize: 'off' }
+ mount({})
+ expect(host.querySelector('.exmedia img')).toBeTruthy()
+ })
+
+ it('treats a legacy/unknown value as full', () => {
+ mocks.S = { gifSize: 'huge' }
+ mount({ minimizable: true })
+ expect(host.querySelector('.exmedia img')).toBeTruthy()
+ expect(host.querySelector('.exmedia.mini')).toBeFalsy()
+ })
+})
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 3d8a0513c..2212b37f9 100644
--- a/frontend/src/lib/pt-br-locale.test.js
+++ b/frontend/src/lib/pt-br-locale.test.js
@@ -28,10 +28,10 @@ describe('Brazilian Portuguese locale', () => {
const fingerprint = createHash('sha256').update(JSON.stringify(inherited)).digest('hex')
expect(Object.keys(PT_BR_OVERRIDES)).toHaveLength(338)
- expect(inherited).toHaveLength(454)
+ expect(inherited).toHaveLength(458)
// If this fails, review the changed keys and wording before accepting a new hash. From
// frontend/: node scripts/pt-br-inheritance-fingerprint.mjs --list
- expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('549332a72036a9fda6e3c3b129ea57ae9863a6e87099135bc3ae638d2bd31a58')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('67edc754880ed2a392eee8839549a36bd8bf55b16f889b655b40fc6c493fc6dd')
})
test('does not leak European Portuguese UI terms', () => {
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index f575f9175..461da9fa4 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -413,6 +413,10 @@ export default {
'Remove from routine': 'Aus Routine entfernen',
'Minimize': 'Verkleinern',
'Expand': 'Vergrössern',
+ 'Exercise animations': 'Übungs-Animationen',
+ 'Full': 'Gross',
+ 'Small': 'Klein',
+ 'Hidden': 'Versteckt',
'Invite code': 'Einladungscode',
'This app is invite-only — enter the code you were given.': 'Diese App ist nur mit Einladung — gib den Code ein, den du erhalten hast.',
'An invite code is required': 'Ein Einladungscode ist erforderlich',
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index e764ffe39..a8f5e82d7 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': 'Quitar de la rutina',
'Minimize': 'Minimizar',
'Expand': 'Ampliar',
+ 'Exercise animations': 'Animaciones de los ejercicios',
+ 'Full': 'Completa',
+ 'Small': 'Pequeña',
+ 'Hidden': 'Oculta',
'Invite code': 'Código de invitación',
'This app is invite-only — enter the code you were given.': 'Esta app es solo por invitación: introduce el código que te dieron.',
'An invite code is required': 'Se requiere un código de invitación',
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index ac038aeaf..ac9e96eef 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': 'Retirer de la routine',
'Minimize': 'Réduire',
'Expand': 'Agrandir',
+ 'Exercise animations': 'Animations des exercices',
+ 'Full': 'Grande',
+ 'Small': 'Petite',
+ 'Hidden': 'Masquée',
'Invite code': 'Code d’invitation',
'This app is invite-only — enter the code you were given.': 'Cette appli est sur invitation — saisissez le code qu’on vous a donné.',
'An invite code is required': 'Un code d’invitation est requis',
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 0d927d9e6..8908a3258 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': 'रूटीन से हटाएं',
'Minimize': 'छोटा करें',
'Expand': 'बड़ा करें',
+ 'Exercise animations': 'व्यायाम एनिमेशन',
+ 'Full': 'पूर्ण',
+ 'Small': 'छोटा',
+ 'Hidden': 'छिपा',
'Invite code': 'इनवाइट कोड',
'This app is invite-only — enter the code you were given.': 'यह ऐप केवल इनवाइट से है — आपको दिया गया कोड डालें।',
'An invite code is required': 'एक इनवाइट कोड आवश्यक है',
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index b490a9d09..bda6db8bb 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -401,6 +401,10 @@ export default {
'Remove from routine': 'Eltávolítás a rutinból',
'Minimize': 'Kicsinyítés',
'Expand': 'Kibontás',
+ 'Exercise animations': 'Gyakorlat-animációk',
+ 'Full': 'Teljes',
+ 'Small': 'Kicsi',
+ 'Hidden': 'Rejtett',
'Invite code': 'Meghívókód',
'This app is invite-only — enter the code you were given.': 'Ez az app csak meghívóval elérhető — add meg a kapott kódot.',
'An invite code is required': 'Meghívókód szükséges',
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 7fd703c97..23ae58f6c 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': 'Rimuovi dalla routine',
'Minimize': 'Riduci',
'Expand': 'Ingrandisci',
+ 'Exercise animations': 'Animazioni degli esercizi',
+ 'Full': 'Grande',
+ 'Small': 'Piccola',
+ 'Hidden': 'Nascosta',
'Invite code': 'Codice di invito',
'This app is invite-only — enter the code you were given.': 'Questa app è solo su invito: inserisci il codice che hai ricevuto.',
'An invite code is required': 'È richiesto un codice di invito',
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 14c4d3a81..3efbca09c 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': '루틴에서 제거',
'Minimize': '축소',
'Expand': '확대',
+ 'Exercise animations': '운동 애니메이션',
+ 'Full': '전체',
+ 'Small': '작게',
+ 'Hidden': '숨김',
'Invite code': '초대 코드',
'This app is invite-only — enter the code you were given.': '이 앱은 초대 전용입니다 — 받은 코드를 입력하세요.',
'An invite code is required': '초대 코드가 필요합니다',
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 04836420a..ec6d21f13 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': 'Usuń z planu',
'Minimize': 'Zmniejsz',
'Expand': 'Powiększ',
+ 'Exercise animations': 'Animacje ćwiczeń',
+ 'Full': 'Pełna',
+ 'Small': 'Mała',
+ 'Hidden': 'Ukryta',
'Invite code': 'Kod zaproszenia',
'This app is invite-only — enter the code you were given.': 'Ta aplikacja jest tylko na zaproszenie — wpisz otrzymany kod.',
'An invite code is required': 'Wymagany jest kod zaproszenia',
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 0acaa74ec..8c9dccc6d 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': 'Remover da rotina',
'Minimize': 'Minimizar',
'Expand': 'Ampliar',
+ 'Exercise animations': 'Animações dos exercícios',
+ 'Full': 'Grande',
+ 'Small': 'Pequena',
+ 'Hidden': 'Oculta',
'Invite code': 'Código de convite',
'This app is invite-only — enter the code you were given.': 'Esta app é só por convite — introduz o código que recebeste.',
'An invite code is required': 'É necessário um código de convite',
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index 5596ee89c..27a6056ca 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': 'Убрать из программы',
'Minimize': 'Свернуть',
'Expand': 'Развернуть',
+ 'Exercise animations': 'Анимации упражнений',
+ 'Full': 'Полная',
+ 'Small': 'Малая',
+ 'Hidden': 'Скрыта',
'Invite code': 'Код приглашения',
'This app is invite-only — enter the code you were given.': 'Приложение только по приглашению — введите выданный вам код.',
'An invite code is required': 'Требуется код приглашения',
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 4f39ef893..f0baac53a 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -401,6 +401,10 @@ export default {
'Remove from routine': 'ลบออกจากรูทีน',
'Minimize': 'ย่อ',
'Expand': 'ขยาย',
+ 'Exercise animations': 'ภาพเคลื่อนไหวท่าออกกำลังกาย',
+ 'Full': 'เต็ม',
+ 'Small': 'เล็ก',
+ 'Hidden': 'ซ่อน',
'Invite code': 'รหัสเชิญ',
'This app is invite-only — enter the code you were given.': 'แอปนี้ต้องมีรหัสเชิญ — กรอกรหัสที่ได้รับมา',
'An invite code is required': 'ต้องมีรหัสเชิญ',
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index b16b48a19..9ed931174 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': 'Rutinden çıkar',
'Minimize': 'Küçült',
'Expand': 'Büyüt',
+ 'Exercise animations': 'Egzersiz animasyonları',
+ 'Full': 'Tam',
+ 'Small': 'Küçük',
+ 'Hidden': 'Gizli',
'Invite code': 'Davet kodu',
'This app is invite-only — enter the code you were given.': 'Bu uygulama yalnızca davetle — sana verilen kodu gir.',
'An invite code is required': 'Bir davet kodu gerekli',
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 65847d62d..4cf4465a8 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -395,6 +395,10 @@ export default {
'Remove from routine': '从计划中移除',
'Minimize': '缩小',
'Expand': '放大',
+ 'Exercise animations': '动作动画',
+ 'Full': '完整',
+ 'Small': '小',
+ 'Hidden': '隐藏',
'Invite code': '邀请码',
'This app is invite-only — enter the code you were given.': '此应用仅限邀请——请输入你收到的邀请码。',
'An invite code is required': '需要邀请码',
diff --git a/frontend/src/views/Settings.gifsize.test.jsx b/frontend/src/views/Settings.gifsize.test.jsx
new file mode 100644
index 000000000..a544911aa
--- /dev/null
+++ b/frontend/src/views/Settings.gifsize.test.jsx
@@ -0,0 +1,90 @@
+// @vitest-environment happy-dom
+import React, { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import Settings from './Settings.jsx'
+
+globalThis.IS_REACT_ACT_ENVIRONMENT = true
+
+const mocks = vi.hoisted(() => {
+ const state = { S: null }
+ state.snapshot = () => ({
+ S: state.S,
+ user: null,
+ update: mut => {
+ const next = structuredClone(state.S)
+ mut(next)
+ state.S = next
+ },
+ replaceState: vi.fn(), setUser: vi.fn(), pullState: vi.fn(), pushState: vi.fn(),
+ signOut: vi.fn(), signOutAll: vi.fn(), resetDemo: vi.fn(), disconnectServer: vi.fn(),
+ })
+ return state
+})
+vi.mock('../store/useStore.js', () => {
+ const useStore = selector => selector ? selector(mocks.snapshot()) : mocks.snapshot()
+ useStore.getState = mocks.snapshot
+ return { useStore, DEF: { reminder: { time: '17:30' } }, hasData: () => false }
+})
+vi.mock('../store/useUI.js', () => {
+ const snap = () => ({ toast: vi.fn(), openSheet: vi.fn() })
+ const useUI = selector => selector ? selector(snap()) : snap()
+ useUI.getState = snap
+ return { useUI }
+})
+vi.mock('react-router-dom', () => ({ useNavigate: () => () => {} }))
+vi.mock('../lib/api.js', () => ({
+ api: vi.fn(), webauthnOK: () => false, passkeyLogin: vi.fn(), passkeyRegister: vi.fn(), IS_ANDROID: false,
+}))
+vi.mock('../lib/push.js', () => ({ pushSupported: () => false, enablePush: vi.fn(), disablePush: vi.fn(), sendTestPush: vi.fn() }))
+vi.mock('../lib/wakelock.js', () => ({ wakeLockSupported: () => false }))
+vi.mock('../lib/mobile.js', () => ({ MOBILE: false, shareExport: vi.fn(), syncReminder: vi.fn() }))
+vi.mock('./MobileOnboarding.jsx', () => ({ ConnectSheet: () => null }))
+vi.mock('../sheets.jsx', () => ({
+ loadStarterPlan: vi.fn(), confirmSheet: vi.fn(), importFromApp: vi.fn(),
+ importFromHevy: vi.fn(), equipmentProfileSheet: vi.fn(),
+}))
+
+// The Settings view reads the build-time version constant at render time.
+globalThis.__APP_VERSION__ ??= 'test'
+
+let host, root
+beforeEach(() => {
+ mocks.S = {
+ unit: 'kg', restSec: 90, restPauseSec: 15, sound: false, effort: 'none',
+ gifSize: 'full', workouts: [], routines: [], exWeights: {},
+ }
+ host = document.createElement('div')
+ document.body.appendChild(host)
+ root = createRoot(host)
+})
+afterEach(() => {
+ act(() => root.unmount())
+ host.remove()
+})
+
+const mount = () => act(() => root.render(<Settings />))
+const segButton = label => [...host.querySelectorAll('.seg button')].find(b => b.textContent === label)
+
+describe('Settings — exercise animations', () => {
+ it('offers Full / Small / Hidden and writes gifSize to the store', () => {
+ mount()
+ expect(segButton('Full')).toBeTruthy()
+ expect(segButton('Small')).toBeTruthy()
+ expect(segButton('Hidden')).toBeTruthy()
+ expect(segButton('Full').getAttribute('aria-pressed')).toBe('true')
+ act(() => { segButton('Hidden').click() })
+ expect(mocks.S.gifSize).toBe('off')
+ mount()
+ expect(segButton('Hidden').getAttribute('aria-pressed')).toBe('true')
+ act(() => { segButton('Small').click() })
+ expect(mocks.S.gifSize).toBe('mini')
+ })
+
+ it('shows a legacy/absent value as Full', () => {
+ delete mocks.S.gifSize
+ mount()
+ expect(segButton('Full').getAttribute('aria-pressed')).toBe('true')
+ expect(segButton('Hidden').getAttribute('aria-pressed')).toBe('false')
+ })
+})
diff --git a/frontend/src/views/Settings.jsx b/frontend/src/views/Settings.jsx
index e3179b0a6..c2882524c 100644
--- a/frontend/src/views/Settings.jsx
+++ b/frontend/src/views/Settings.jsx
@@ -145,6 +145,15 @@ export default function Settings() {
onChange={v => update(s => { s.keepAwake = v })} />
</Row>
)}
+ {/* 'full'/'mini' is also what the tap-toggle on the workout animation writes; 'off' hides
+ workout media entirely (library, detail sheet and picker thumbs are unaffected).
+ Legacy/unknown values read as 'full'. */}
+ <Row icon="figureRun" iconTint="var(--green)" title={t('Exercise animations')}>
+ <Segmented className="seg-inline"
+ options={[{ value: 'full', label: t('Full') }, { value: 'mini', label: t('Small') }, { value: 'off', label: t('Hidden') }]}
+ value={S.gifSize === 'mini' || S.gifSize === 'off' ? S.gifSize : 'full'}
+ onChange={v => update(s => { s.gifSize = v })} />
+ </Row>
<Row icon="bell" iconTint="var(--pink)" title={t('Sounds')}>
<Switch checked={!!S.sound} onChange={v => update(s => { s.sound = v })} />
</Row>