From dabffdebc016c0c83dadc78f0311f3678728e4a1 Mon Sep 17 00:00:00 2001 From: Duarte Santos Date: Wed, 22 Jul 2026 01:00:50 +0200 Subject: [PATCH] Minimize the exercise animation during a workout (#12) Adds a persistent minimize/expand toggle to the workout animation so the set rows are reachable without scrolling past a full-height GIF. A new S.gifSize setting ('full' | 'mini') is flipped by the button, saved and synced like other prefs, and applied across exercises and future workouts. Tapping the animation still pauses/plays it. Closes #12 --- CHANGELOG.md | 8 ++++++++ frontend/package.json | 2 +- frontend/src/components/Media.jsx | 15 ++++++++++++--- frontend/src/index.css | 4 ++++ frontend/src/locales/de.js | 4 +++- frontend/src/locales/es.js | 4 +++- frontend/src/locales/fr.js | 4 +++- frontend/src/locales/hi.js | 4 +++- frontend/src/locales/it.js | 4 +++- frontend/src/locales/ko.js | 4 +++- frontend/src/locales/pl.js | 4 +++- frontend/src/locales/pt.js | 4 +++- frontend/src/locales/ru.js | 4 +++- frontend/src/locales/tr.js | 4 +++- frontend/src/locales/zh.js | 4 +++- frontend/src/store/useStore.js | 2 +- frontend/src/views/Workout.jsx | 2 +- 17 files changed, 60 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54ad0d4..3650502 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## v1.1.3 — 2026-07-22 + +- 🔎 **Minimize the exercise animation during a workout** (#12). A ⤡ Minimize / ⤢ Expand button + on the animation shrinks it to a thin strip so the set rows sit right under your thumb — no more + scrolling past a big GIF to tick off a set. Your choice is remembered and applied to every + exercise and future workout until you change it, so you set it once. Tapping the animation still + pauses/plays it as before. + ## v1.1.2 — 2026-07-22 Custom exercises, full localization, and input fixes. diff --git a/frontend/package.json b/frontend/package.json index a8842c4..2517c82 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "opengym-frontend", "private": true, - "version": "1.1.2", + "version": "1.1.3", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/src/components/Media.jsx b/frontend/src/components/Media.jsx index 7611948..26456d8 100644 --- a/frontend/src/components/Media.jsx +++ b/frontend/src/components/Media.jsx @@ -1,16 +1,25 @@ import { useState } from 'react' import { imgSrc, gifSrc } from '../lib/exercises.js' +import { useStore } from '../store/useStore.js' import { t } from '../lib/i18n.js' // Big autoplaying animation; tap toggles to the still frame. `compact` shrinks it (superset cards). // Custom exercises have no media — the animation stays blank by design (issue #11). -export default function Media({ ex, id, compact }) { +// `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). +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 + const mini = minimizable && gifSize === 'mini' + const toggleSize = e => { e.stopPropagation(); update(s => { s.gifSize = mini ? 'full' : 'mini' }) } return ( -
setPlaying(p => !p)}> +
setPlaying(p => !p)}> {ex.n} - {playing ? '⏸ ' + t('tap to pause') : '▶ ' + t('tap to play')} + {minimizable && } + {!mini && {playing ? '⏸ ' + t('tap to pause') : '▶ ' + t('tap to play')}}
) } diff --git a/frontend/src/index.css b/frontend/src/index.css index 74c06d1..4d5e5c2 100644 --- a/frontend/src/index.css +++ b/frontend/src/index.css @@ -162,6 +162,8 @@ textarea.input{min-height:88px;resize:vertical;line-height:1.45} .exmedia img{width:100%;height:340px;object-fit:contain;display:block} .exmedia .gifhint{position:absolute;right:10px;bottom:10px;background:rgba(0,0,0,.62);color:#fff; border-radius:99px;padding:4px 11px;font-size:.72rem;font-weight:600} +.exmedia .giftoggle{position:absolute;left:10px;bottom:10px;background:rgba(0,0,0,.62);color:#fff; + border:none;border-radius:99px;padding:5px 12px;font-size:.72rem;font-weight:600;cursor:pointer} .sethead{display:flex;align-items:center;gap:9px;padding-bottom:2px; font-size:.66rem;color:var(--dim);font-weight:700;text-transform:uppercase;letter-spacing:.05em} .sethead .n-sp{width:26px;flex:none} @@ -333,6 +335,8 @@ h4.sec{font-size:.8rem;text-transform:uppercase;letter-spacing:.08em;color:var(- .ss-ex{position:relative} .ss-amp{text-align:center;font-size:1.3rem;font-weight:800;color:var(--acc);margin:14px 0 8px} .exmedia.compact img{height:190px} +/* minimized workout animation — small enough to keep the set rows in view (issue #12) */ +.exmedia.mini img{height:88px} /* ---------- home: today's session row under the week strip ---------- */ .today-row{display:flex;align-items:center;justify-content:space-between;gap:10px; diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js index fa9f9c4..1924b7f 100644 --- a/frontend/src/locales/de.js +++ b/frontend/src/locales/de.js @@ -350,5 +350,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'Beschreibung (optional) — Aufbau, Hinweise, was du dir merken willst', 'Delete exercise': 'Übung löschen', 'Edit or delete this exercise': 'Übung bearbeiten oder löschen', - 'Remove from routine': 'Aus Routine entfernen' + 'Remove from routine': 'Aus Routine entfernen', + 'Minimize': 'Verkleinern', + 'Expand': 'Vergrössern' } diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js index b827592..e85d781 100644 --- a/frontend/src/locales/es.js +++ b/frontend/src/locales/es.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'Descripción (opcional) — preparación, consejos, lo que quieras recordar', 'Delete exercise': 'Eliminar ejercicio', 'Edit or delete this exercise': 'Editar o eliminar este ejercicio', - 'Remove from routine': 'Quitar de la rutina' + 'Remove from routine': 'Quitar de la rutina', + 'Minimize': 'Minimizar', + 'Expand': 'Ampliar' } diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js index cfe6a03..2849240 100644 --- a/frontend/src/locales/fr.js +++ b/frontend/src/locales/fr.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'Description (facultatif) — installation, conseils, ce que vous voulez retenir', 'Delete exercise': 'Supprimer l’exercice', 'Edit or delete this exercise': 'Modifier ou supprimer cet exercice', - 'Remove from routine': 'Retirer de la routine' + 'Remove from routine': 'Retirer de la routine', + 'Minimize': 'Réduire', + 'Expand': 'Agrandir' } diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js index e09b48c..55e0738 100644 --- a/frontend/src/locales/hi.js +++ b/frontend/src/locales/hi.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'विवरण (वैकल्पिक) — सेटअप, संकेत, जो कुछ भी याद रखना चाहें', 'Delete exercise': 'एक्सरसाइज़ हटाएं', 'Edit or delete this exercise': 'इस एक्सरसाइज़ को संपादित या हटाएं', - 'Remove from routine': 'रूटीन से हटाएं' + 'Remove from routine': 'रूटीन से हटाएं', + 'Minimize': 'छोटा करें', + 'Expand': 'बड़ा करें' } diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js index d75935d..0537158 100644 --- a/frontend/src/locales/it.js +++ b/frontend/src/locales/it.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'Descrizione (facoltativa) — setup, spunti, quello che vuoi ricordare', 'Delete exercise': 'Elimina esercizio', 'Edit or delete this exercise': 'Modifica o elimina questo esercizio', - 'Remove from routine': 'Rimuovi dalla routine' + 'Remove from routine': 'Rimuovi dalla routine', + 'Minimize': 'Riduci', + 'Expand': 'Ingrandisci' } diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js index efa78cd..98ef273 100644 --- a/frontend/src/locales/ko.js +++ b/frontend/src/locales/ko.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': '설명 (선택) — 세팅, 큐, 기억하고 싶은 모든 것', 'Delete exercise': '운동 삭제', 'Edit or delete this exercise': '이 운동 편집 또는 삭제', - 'Remove from routine': '루틴에서 제거' + 'Remove from routine': '루틴에서 제거', + 'Minimize': '축소', + 'Expand': '확대' } diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js index 9bc5dda..3c14456 100644 --- a/frontend/src/locales/pl.js +++ b/frontend/src/locales/pl.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'Opis (opcjonalnie) — ustawienie, wskazówki, co chcesz zapamiętać', 'Delete exercise': 'Usuń ćwiczenie', 'Edit or delete this exercise': 'Edytuj lub usuń to ćwiczenie', - 'Remove from routine': 'Usuń z planu' + 'Remove from routine': 'Usuń z planu', + 'Minimize': 'Zmniejsz', + 'Expand': 'Powiększ' } diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js index 355de22..6b8cc5c 100644 --- a/frontend/src/locales/pt.js +++ b/frontend/src/locales/pt.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'Descrição (opcional) — preparação, dicas, o que quiseres lembrar', 'Delete exercise': 'Eliminar exercício', 'Edit or delete this exercise': 'Editar ou eliminar este exercício', - 'Remove from routine': 'Remover da rotina' + 'Remove from routine': 'Remover da rotina', + 'Minimize': 'Minimizar', + 'Expand': 'Ampliar' } diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js index 2ec50ab..bddcac2 100644 --- a/frontend/src/locales/ru.js +++ b/frontend/src/locales/ru.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'Описание (необязательно) — настройка, подсказки, всё, что хотите запомнить', 'Delete exercise': 'Удалить упражнение', 'Edit or delete this exercise': 'Изменить или удалить это упражнение', - 'Remove from routine': 'Убрать из программы' + 'Remove from routine': 'Убрать из программы', + 'Minimize': 'Свернуть', + 'Expand': 'Развернуть' } diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js index 95f7aca..b2fc5de 100644 --- a/frontend/src/locales/tr.js +++ b/frontend/src/locales/tr.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': 'Açıklama (isteğe bağlı) — kurulum, ipuçları, hatırlamak istediklerin', 'Delete exercise': 'Egzersizi sil', 'Edit or delete this exercise': 'Bu egzersizi düzenle veya sil', - 'Remove from routine': 'Rutinden çıkar' + 'Remove from routine': 'Rutinden çıkar', + 'Minimize': 'Küçült', + 'Expand': 'Büyüt' } diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js index 34168a4..94c0913 100644 --- a/frontend/src/locales/zh.js +++ b/frontend/src/locales/zh.js @@ -332,5 +332,7 @@ export default { 'Description (optional) — setup, cues, anything you want to remember': '描述(可选)——设置、要点,任何你想记住的内容', 'Delete exercise': '删除动作', 'Edit or delete this exercise': '编辑或删除此动作', - 'Remove from routine': '从计划中移除' + 'Remove from routine': '从计划中移除', + 'Minimize': '缩小', + 'Expand': '放大' } diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js index 8a954fc..aa0cfe7 100644 --- a/frontend/src/store/useStore.js +++ b/frontend/src/store/useStore.js @@ -8,7 +8,7 @@ export const DEF = { unit: 'kg', restSec: 90, sound: true, lang: 'en', theme: 'dark', accent: 'lime', targetW: null, bodyweight: [], routines: [], week: {}, dayPlan: {}, - exWeights: {}, workouts: [], active: null, customEx: [], + exWeights: {}, workouts: [], active: null, customEx: [], gifSize: 'full', reminder: { on: false, time: '08:00', tz: null } } const clone = o => JSON.parse(JSON.stringify(o)) diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx index de2b422..a9654fd 100644 --- a/frontend/src/views/Workout.jsx +++ b/frontend/src/views/Workout.jsx @@ -69,7 +69,7 @@ function ExerciseBlock({ entryIdx, compact, onToggle, onField, onBumpAll, onAddS
) return <> - +
{ex.n}