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.

Custom exercises: create your own with name + body part

Duarte Santos0cefcb3636e6
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 52be5ffd8..68f64d46a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,22 @@
# Changelog
+## v1.3.0 — 2026-07-22
+
+Custom exercises — add movements that aren't in the catalogue. (#11)
+
+- ✨ **Create your own exercise** from the exercise picker or the Exercises tab: a name and a
+ body part is all it takes. Your search text is pre-filled as the name, so "no match" flows
+ straight into "create it".
+- 🏋️ Custom exercises behave like built-in ones everywhere — routines, supersets, workout
+ logging, weight suggestions, PRs, stats and history. The animation stays blank by design.
+- 🏃 Pick the *cardio* body part and it logs time + speed instead of weight × reps, like the
+ built-in cardio exercises.
+- ✏️ Edit (rename / change body part) or delete your custom exercises from their detail sheet.
+ Deleting removes them from your routines; already-logged workouts keep their sets and still
+ show the exercise name.
+- 🌍 Fully translated into all 12 UI languages, and synced to your profile like the rest of
+ your data.
+
## v1.1.3 — 2026-07-22
- ⌨️ Weight and other numeric fields now accept a comma as decimal separator ("33,5") — iOS
diff --git a/frontend/package.json b/frontend/package.json
index 2517c82f1..3d6164c57 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -1,7 +1,7 @@
{
"name": "opengym-frontend",
"private": true,
- "version": "1.1.3",
+ "version": "1.3.0",
"type": "module",
"scripts": {
"dev": "vite",
diff --git a/frontend/src/components/Media.jsx b/frontend/src/components/Media.jsx
index 11a963a25..76119485e 100644
--- a/frontend/src/components/Media.jsx
+++ b/frontend/src/components/Media.jsx
@@ -3,8 +3,10 @@ import { imgSrc, gifSrc } from '../lib/exercises.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 }) {
const [playing, setPlaying] = useState(true)
+ if (!ex.gif) return null
return (
<div className={'exmedia' + (compact ? ' compact' : '')} id={id} onClick={() => setPlaying(p => !p)}>
<img decoding="async" src={playing ? gifSrc(ex) : imgSrc(ex)} alt={ex.n} />
@@ -14,5 +16,6 @@ export default function Media({ ex, id, compact }) {
}
export function Thumb({ ex }) {
+ if (!ex.img) return <div className="thumb thumb-x">🏋️</div>
return <img className="thumb" loading="lazy" decoding="async" src={imgSrc(ex)} alt="" />
}
diff --git a/frontend/src/index.css b/frontend/src/index.css
index 9f7e2dea0..ff25dff5f 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -114,6 +114,7 @@ a{color:var(--acc)}
border-radius:14px;padding:12px;min-height:60px}
.item:active{background:var(--card2)}
.thumb{width:52px;height:52px;border-radius:10px;object-fit:cover;background:#fff;flex:none}
+.thumb-x{display:flex;align-items:center;justify-content:center;font-size:1.4rem;background:var(--bg2)}
.item .tt{font-weight:600;font-size:.93rem;line-height:1.25;text-transform:capitalize}
.item .ss{color:var(--mut);font-size:.78rem;margin-top:2px;text-transform:capitalize}
.item .grow{flex:1;min-width:0}
diff --git a/frontend/src/lib/exercises.js b/frontend/src/lib/exercises.js
index f4926d404..a0b3d5a57 100644
--- a/frontend/src/lib/exercises.js
+++ b/frontend/src/lib/exercises.js
@@ -5,6 +5,17 @@ export const EXIDX = {}
EXDB.forEach(e => { EXIDX[e.id] = e })
export const BODYPARTS = [...new Set(EXDB.map(e => e.bp))].sort()
+// Custom (user-created) exercises live in synced state S.customEx (issue #11) and are
+// merged into the id index here so every EXIDX[id] lookup keeps working unchanged.
+let customIds = []
+export function registerCustom(list) {
+ customIds.forEach(id => delete EXIDX[id])
+ customIds = (list || []).map(e => e.id)
+ ;(list || []).forEach(e => { EXIDX[e.id] = e })
+}
+// Full searchable catalogue — customs first so your own exercises are easy to find.
+export const allExercises = st => [...(st.customEx || []), ...EXDB]
+
export const imgSrc = ex => 'img/' + ex.img
export const gifSrc = ex => 'gif/' + ex.gif
diff --git a/frontend/src/lib/history.js b/frontend/src/lib/history.js
index da16c265e..6e6b4b097 100644
--- a/frontend/src/lib/history.js
+++ b/frontend/src/lib/history.js
@@ -11,6 +11,12 @@ export function setLabel(id, s) {
export function defaultConfig(id) {
return isCardio(id) ? { sets: 1, min: 20, speed: 8 } : { sets: 3, reps: 10, weight: 0 }
}
+// Drop superset ids that no longer have an adjacent partner (after unlink/reorder/remove).
+export function cleanupSg(ex) {
+ ex.forEach((e, i) => {
+ if (e.sg && !(ex[i - 1]?.sg === e.sg || ex[i + 1]?.sg === e.sg)) delete e.sg
+ })
+}
export function lastEntryFor(S, exId) {
for (let i = S.workouts.length - 1; i >= 0; i--) {
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 05c2e71e7..08716a746 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -326,5 +326,25 @@ export default {
'rear deltoids': 'hintere Schulter', 'rhomboids': 'Rhomboiden', 'rotator cuff': 'Rotatorenmanschette',
'shins': 'Schienbeine', 'soleus': 'Schollenmuskel', 'sternocleidomastoid': 'Kopfwender',
'trapezius': 'Trapezmuskel', 'upper chest': 'obere Brust', 'wrist extensors': 'Handstrecker',
- 'wrist flexors': 'Handbeuger', 'wrists': 'Handgelenke'
+ 'wrist flexors': 'Handbeuger', 'wrists': 'Handgelenke',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'Eigene Übung erstellen',
+ 'Edit custom exercise': 'Eigene Übung bearbeiten',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'Name und Körperpartie festlegen — die Übung verhält sich wie jede andere, nur ohne Animation.',
+ 'Exercise name': 'Übungsname',
+ 'name + body part, no animation': 'Name + Körperpartie, ohne Animation',
+ 'Create exercise': 'Übung erstellen',
+ 'Give it a name': 'Gib ihr einen Namen',
+ 'Pick a body part': 'Wähle eine Körperpartie',
+ '“{0}” already exists': '„{0}“ existiert bereits',
+ '“{0}” created ✓': '„{0}“ erstellt ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'Cardio-Übungen erfassen Zeit + Tempo statt Gewicht × Wdh.',
+ 'custom': 'eigene',
+ 'Edit': 'Bearbeiten',
+ 'Saved ✓': 'Gespeichert ✓',
+ 'Delete “{0}”?': '„{0}“ löschen?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'Sie wird aus deinen Routinen entfernt. Bereits geloggte Workouts behalten ihre Sätze.',
+ 'Exercise deleted': 'Übung gelöscht',
+ 'Finish your current workout first': 'Beende zuerst dein laufendes Workout'
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index a72e53d99..6d79425f3 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': 'deltoides posterior', 'rhomboids': 'romboides', 'rotator cuff': 'manguito rotador',
'shins': 'espinillas', 'soleus': 'sóleo', 'sternocleidomastoid': 'esternocleidomastoideo',
'trapezius': 'trapecio', 'upper chest': 'pecho superior', 'wrist extensors': 'extensores de muñeca',
- 'wrist flexors': 'flexores de muñeca', 'wrists': 'muñecas'
+ 'wrist flexors': 'flexores de muñeca', 'wrists': 'muñecas',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'Crea tu propio ejercicio',
+ 'Edit custom exercise': 'Editar ejercicio propio',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'Ponle nombre y elige una parte del cuerpo — funciona como cualquier otro ejercicio, solo que sin animación.',
+ 'Exercise name': 'Nombre del ejercicio',
+ 'name + body part, no animation': 'nombre + parte del cuerpo, sin animación',
+ 'Create exercise': 'Crear ejercicio',
+ 'Give it a name': 'Ponle un nombre',
+ 'Pick a body part': 'Elige una parte del cuerpo',
+ '“{0}” already exists': '«{0}» ya existe',
+ '“{0}” created ✓': '«{0}» creado ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'Los ejercicios de cardio registran tiempo + velocidad en vez de peso × reps.',
+ 'custom': 'propio',
+ 'Edit': 'Editar',
+ 'Saved ✓': 'Guardado ✓',
+ 'Delete “{0}”?': '¿Eliminar «{0}»?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'Se quitará de tus rutinas. Los entrenamientos ya registrados conservan sus series.',
+ 'Exercise deleted': 'Ejercicio eliminado',
+ 'Finish your current workout first': 'Termina primero tu entrenamiento actual'
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index e24115faf..da18e034d 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': 'deltoïdes postérieurs', 'rhomboids': 'rhomboïdes', 'rotator cuff': 'coiffe des rotateurs',
'shins': 'tibias', 'soleus': 'soléaire', 'sternocleidomastoid': 'sterno-cléido-mastoïdien',
'trapezius': 'trapèze', 'upper chest': 'haut des pectoraux', 'wrist extensors': 'extenseurs du poignet',
- 'wrist flexors': 'fléchisseurs du poignet', 'wrists': 'poignets'
+ 'wrist flexors': 'fléchisseurs du poignet', 'wrists': 'poignets',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'Créer votre propre exercice',
+ 'Edit custom exercise': 'Modifier l’exercice personnalisé',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'Nommez-le et choisissez une partie du corps — il se comporte comme tout autre exercice, mais sans animation.',
+ 'Exercise name': 'Nom de l’exercice',
+ 'name + body part, no animation': 'nom + partie du corps, sans animation',
+ 'Create exercise': 'Créer l’exercice',
+ 'Give it a name': 'Donnez-lui un nom',
+ 'Pick a body part': 'Choisissez une partie du corps',
+ '“{0}” already exists': '« {0} » existe déjà',
+ '“{0}” created ✓': '« {0} » créé ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'Les exercices cardio enregistrent temps + vitesse au lieu de poids × reps.',
+ 'custom': 'perso',
+ 'Edit': 'Modifier',
+ 'Saved ✓': 'Enregistré ✓',
+ 'Delete “{0}”?': 'Supprimer « {0} » ?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'Il sera retiré de vos routines. Les séances déjà enregistrées gardent leurs séries.',
+ 'Exercise deleted': 'Exercice supprimé',
+ 'Finish your current workout first': 'Terminez d’abord votre séance en cours'
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 768ce20c2..ed7390fcc 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': 'पीछे के डेल्टॉइड', 'rhomboids': 'रॉम्बॉइड', 'rotator cuff': 'रोटेटर कफ',
'shins': 'पिंडली की हड्डी', 'soleus': 'सोलियस', 'sternocleidomastoid': 'स्टर्नोक्लाइडोमैस्टॉइड',
'trapezius': 'ट्रेपेज़ियस', 'upper chest': 'ऊपरी छाती', 'wrist extensors': 'कलाई विस्तारक',
- 'wrist flexors': 'कलाई मोड़क', 'wrists': 'कलाइयाँ'
+ 'wrist flexors': 'कलाई मोड़क', 'wrists': 'कलाइयाँ',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'अपनी एक्सरसाइज़ बनाएं',
+ 'Edit custom exercise': 'कस्टम एक्सरसाइज़ संपादित करें',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'नाम दें और बॉडी पार्ट चुनें — यह बाकी एक्सरसाइज़ की तरह ही काम करती है, बस एनिमेशन नहीं होता।',
+ 'Exercise name': 'एक्सरसाइज़ का नाम',
+ 'name + body part, no animation': 'नाम + बॉडी पार्ट, बिना एनिमेशन',
+ 'Create exercise': 'एक्सरसाइज़ बनाएं',
+ 'Give it a name': 'कोई नाम दें',
+ 'Pick a body part': 'एक बॉडी पार्ट चुनें',
+ '“{0}” already exists': '“{0}” पहले से मौजूद है',
+ '“{0}” created ✓': '“{0}” बन गई ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'कार्डियो एक्सरसाइज़ में वज़न × रेप्स की जगह समय + गति दर्ज होती है।',
+ 'custom': 'कस्टम',
+ 'Edit': 'संपादित करें',
+ 'Saved ✓': 'सहेजा गया ✓',
+ 'Delete “{0}”?': '“{0}” हटाएं?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'यह आपकी रूटीन से हट जाएगी। दर्ज की गई वर्कआउट में सेट बने रहेंगे।',
+ 'Exercise deleted': 'एक्सरसाइज़ हटाई गई',
+ 'Finish your current workout first': 'पहले चल रही वर्कआउट पूरी करें'
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index 9d0062f91..bb77bdcc9 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': 'deltoidi posteriori', 'rhomboids': 'romboidi', 'rotator cuff': 'cuffia dei rotatori',
'shins': 'stinchi', 'soleus': 'soleo', 'sternocleidomastoid': 'sternocleidomastoideo',
'trapezius': 'trapezio', 'upper chest': 'petto alto', 'wrist extensors': 'estensori del polso',
- 'wrist flexors': 'flessori del polso', 'wrists': 'polsi'
+ 'wrist flexors': 'flessori del polso', 'wrists': 'polsi',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'Crea il tuo esercizio',
+ 'Edit custom exercise': 'Modifica esercizio personalizzato',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'Dagli un nome e scegli una parte del corpo — funziona come qualsiasi altro esercizio, solo senza animazione.',
+ 'Exercise name': 'Nome esercizio',
+ 'name + body part, no animation': 'nome + parte del corpo, senza animazione',
+ 'Create exercise': 'Crea esercizio',
+ 'Give it a name': 'Dagli un nome',
+ 'Pick a body part': 'Scegli una parte del corpo',
+ '“{0}” already exists': '«{0}» esiste già',
+ '“{0}” created ✓': '«{0}» creato ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'Gli esercizi cardio registrano tempo + velocità invece di peso × rip.',
+ 'custom': 'personale',
+ 'Edit': 'Modifica',
+ 'Saved ✓': 'Salvato ✓',
+ 'Delete “{0}”?': 'Eliminare «{0}»?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'Verrà rimosso dalle tue routine. Gli allenamenti già registrati mantengono le loro serie.',
+ 'Exercise deleted': 'Esercizio eliminato',
+ 'Finish your current workout first': 'Prima concludi l’allenamento in corso'
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 916d2bd21..1a3b6f7a3 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': '후면 삼각근', 'rhomboids': '능형근', 'rotator cuff': '회전근개',
'shins': '정강이', 'soleus': '가자미근', 'sternocleidomastoid': '흉쇄유돌근',
'trapezius': '승모근', 'upper chest': '윗가슴', 'wrist extensors': '손목 신전근',
- 'wrist flexors': '손목 굴곡근', 'wrists': '손목'
+ 'wrist flexors': '손목 굴곡근', 'wrists': '손목',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': '나만의 운동 만들기',
+ 'Edit custom exercise': '커스텀 운동 편집',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': '이름을 정하고 부위를 선택하세요 — 애니메이션만 없을 뿐 다른 운동과 똑같이 사용됩니다.',
+ 'Exercise name': '운동 이름',
+ 'name + body part, no animation': '이름 + 부위, 애니메이션 없음',
+ 'Create exercise': '운동 만들기',
+ 'Give it a name': '이름을 입력하세요',
+ 'Pick a body part': '부위를 선택하세요',
+ '“{0}” already exists': '“{0}”은(는) 이미 있습니다',
+ '“{0}” created ✓': '“{0}” 생성됨 ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': '유산소 운동은 무게 × 횟수 대신 시간 + 속도를 기록합니다.',
+ 'custom': '커스텀',
+ 'Edit': '편집',
+ 'Saved ✓': '저장됨 ✓',
+ 'Delete “{0}”?': '“{0}” 삭제할까요?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': '루틴에서 제거됩니다. 이미 기록된 운동은 세트를 유지합니다.',
+ 'Exercise deleted': '운동 삭제됨',
+ 'Finish your current workout first': '진행 중인 운동을 먼저 마치세요'
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 79444a045..5f5cbfec4 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': 'tylne aktony barków', 'rhomboids': 'równoległoboczne', 'rotator cuff': 'stożek rotatorów',
'shins': 'piszczele', 'soleus': 'płaszczkowaty', 'sternocleidomastoid': 'mostkowo-obojczykowo-sutkowy',
'trapezius': 'czworoboczny', 'upper chest': 'górna klatka', 'wrist extensors': 'prostowniki nadgarstka',
- 'wrist flexors': 'zginacze nadgarstka', 'wrists': 'nadgarstki'
+ 'wrist flexors': 'zginacze nadgarstka', 'wrists': 'nadgarstki',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'Stwórz własne ćwiczenie',
+ 'Edit custom exercise': 'Edytuj własne ćwiczenie',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'Nadaj nazwę i wybierz partię ciała — działa jak każde inne ćwiczenie, tylko bez animacji.',
+ 'Exercise name': 'Nazwa ćwiczenia',
+ 'name + body part, no animation': 'nazwa + partia ciała, bez animacji',
+ 'Create exercise': 'Utwórz ćwiczenie',
+ 'Give it a name': 'Nadaj mu nazwę',
+ 'Pick a body part': 'Wybierz partię ciała',
+ '“{0}” already exists': '„{0}” już istnieje',
+ '“{0}” created ✓': '„{0}” utworzono ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'Ćwiczenia cardio zapisują czas + prędkość zamiast ciężaru × powt.',
+ 'custom': 'własne',
+ 'Edit': 'Edytuj',
+ 'Saved ✓': 'Zapisano ✓',
+ 'Delete “{0}”?': 'Usunąć „{0}”?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'Zostanie usunięte z twoich planów. Zapisane treningi zachowają swoje serie.',
+ 'Exercise deleted': 'Ćwiczenie usunięte',
+ 'Finish your current workout first': 'Najpierw zakończ bieżący trening'
}
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 13578ee30..d93fde1bd 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': 'deltoides posteriores', 'rhomboids': 'romboides', 'rotator cuff': 'coifa dos rotadores',
'shins': 'canelas', 'soleus': 'solear', 'sternocleidomastoid': 'esternocleidomastóideo',
'trapezius': 'trapézio', 'upper chest': 'peito superior', 'wrist extensors': 'extensores do punho',
- 'wrist flexors': 'flexores do punho', 'wrists': 'punhos'
+ 'wrist flexors': 'flexores do punho', 'wrists': 'punhos',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'Cria o teu próprio exercício',
+ 'Edit custom exercise': 'Editar exercício personalizado',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'Dá-lhe um nome e escolhe uma parte do corpo — funciona como qualquer outro exercício, só que sem animação.',
+ 'Exercise name': 'Nome do exercício',
+ 'name + body part, no animation': 'nome + parte do corpo, sem animação',
+ 'Create exercise': 'Criar exercício',
+ 'Give it a name': 'Dá-lhe um nome',
+ 'Pick a body part': 'Escolhe uma parte do corpo',
+ '“{0}” already exists': '«{0}» já existe',
+ '“{0}” created ✓': '«{0}» criado ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'Exercícios de cardio registam tempo + velocidade em vez de peso × reps.',
+ 'custom': 'próprio',
+ 'Edit': 'Editar',
+ 'Saved ✓': 'Guardado ✓',
+ 'Delete “{0}”?': 'Eliminar «{0}»?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'Será removido das tuas rotinas. Os treinos já registados mantêm as suas séries.',
+ 'Exercise deleted': 'Exercício eliminado',
+ 'Finish your current workout first': 'Termina primeiro o treino atual'
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index e0feb966b..2299ebbfa 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': 'задние дельты', 'rhomboids': 'ромбовидные', 'rotator cuff': 'ротаторная манжета',
'shins': 'голени', 'soleus': 'камбаловидная', 'sternocleidomastoid': 'грудино-ключично-сосцевидная',
'trapezius': 'трапециевидная', 'upper chest': 'верх груди', 'wrist extensors': 'разгибатели запястья',
- 'wrist flexors': 'сгибатели запястья', 'wrists': 'запястья'
+ 'wrist flexors': 'сгибатели запястья', 'wrists': 'запястья',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'Создать своё упражнение',
+ 'Edit custom exercise': 'Изменить своё упражнение',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'Задайте название и выберите часть тела — оно работает как любое другое упражнение, только без анимации.',
+ 'Exercise name': 'Название упражнения',
+ 'name + body part, no animation': 'название + часть тела, без анимации',
+ 'Create exercise': 'Создать упражнение',
+ 'Give it a name': 'Задайте название',
+ 'Pick a body part': 'Выберите часть тела',
+ '“{0}” already exists': '«{0}» уже существует',
+ '“{0}” created ✓': '«{0}» создано ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'Кардио-упражнения записывают время + скорость вместо веса × повторов.',
+ 'custom': 'своё',
+ 'Edit': 'Изменить',
+ 'Saved ✓': 'Сохранено ✓',
+ 'Delete “{0}”?': 'Удалить «{0}»?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'Оно будет убрано из ваших программ. Записанные тренировки сохранят свои подходы.',
+ 'Exercise deleted': 'Упражнение удалено',
+ 'Finish your current workout first': 'Сначала завершите текущую тренировку'
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 9656e8e6f..a343cc063 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': 'arka omuz', 'rhomboids': 'romboidler', 'rotator cuff': 'rotator manşet',
'shins': 'kaval kemikleri', 'soleus': 'soleus', 'sternocleidomastoid': 'boyun kası',
'trapezius': 'trapez', 'upper chest': 'üst göğüs', 'wrist extensors': 'bilek ekstansörleri',
- 'wrist flexors': 'bilek fleksörleri', 'wrists': 'bilekler'
+ 'wrist flexors': 'bilek fleksörleri', 'wrists': 'bilekler',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': 'Kendi egzersizini oluştur',
+ 'Edit custom exercise': 'Özel egzersizi düzenle',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': 'Bir ad ver ve bölge seç — animasyon dışında diğer egzersizler gibi çalışır.',
+ 'Exercise name': 'Egzersiz adı',
+ 'name + body part, no animation': 'ad + vücut bölgesi, animasyonsuz',
+ 'Create exercise': 'Egzersiz oluştur',
+ 'Give it a name': 'Bir ad ver',
+ 'Pick a body part': 'Bir vücut bölgesi seç',
+ '“{0}” already exists': '“{0}” zaten var',
+ '“{0}” created ✓': '“{0}” oluşturuldu ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': 'Kardiyo egzersizleri ağırlık × tekrar yerine süre + hız kaydeder.',
+ 'custom': 'özel',
+ 'Edit': 'Düzenle',
+ 'Saved ✓': 'Kaydedildi ✓',
+ 'Delete “{0}”?': '“{0}” silinsin mi?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': 'Rutinlerinden kaldırılacak. Kayıtlı antrenmanlar setlerini korur.',
+ 'Exercise deleted': 'Egzersiz silindi',
+ 'Finish your current workout first': 'Önce mevcut antrenmanını bitir'
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 7d4adc830..6b11865c2 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -308,5 +308,25 @@ export default {
'rear deltoids': '三角肌后束', 'rhomboids': '菱形肌', 'rotator cuff': '肩袖',
'shins': '胫部', 'soleus': '比目鱼肌', 'sternocleidomastoid': '胸锁乳突肌',
'trapezius': '斜方肌', 'upper chest': '上胸', 'wrist extensors': '腕伸肌',
- 'wrist flexors': '腕屈肌', 'wrists': '手腕'
+ 'wrist flexors': '腕屈肌', 'wrists': '手腕',
+
+ // --- custom exercises (#11) ---
+ 'Create your own exercise': '创建自己的动作',
+ 'Edit custom exercise': '编辑自定义动作',
+ 'Name it and pick a body part — it behaves like any other exercise, just without an animation.': '起个名字并选择身体部位——它和其他动作一样使用,只是没有动画。',
+ 'Exercise name': '动作名称',
+ 'name + body part, no animation': '名称 + 身体部位,无动画',
+ 'Create exercise': '创建动作',
+ 'Give it a name': '请输入名称',
+ 'Pick a body part': '请选择身体部位',
+ '“{0}” already exists': '「{0}」已存在',
+ '“{0}” created ✓': '「{0}」已创建 ✓',
+ 'Cardio exercises log time + speed instead of weight × reps.': '有氧动作记录时间 + 速度,而不是重量 × 次数。',
+ 'custom': '自定义',
+ 'Edit': '编辑',
+ 'Saved ✓': '已保存 ✓',
+ 'Delete “{0}”?': '删除「{0}」?',
+ 'It will be removed from your routines. Already-logged workouts keep their sets.': '将从你的计划中移除。已记录的训练会保留其组数。',
+ 'Exercise deleted': '动作已删除',
+ 'Finish your current workout first': '请先完成当前训练'
}
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index 0855cc220..f46e5f34f 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react'
import { useStore } from './store/useStore.js'
import { useUI } from './store/useUI.js'
-import { EXDB, EXIDX, BODYPARTS, isCardio } from './lib/exercises.js'
+import { EXDB, EXIDX, BODYPARTS, isCardio, allExercises } from './lib/exercises.js'
import { fmtDate, fmtNum, fmtVol, fmtDur, todayISO, uid, DAYN, MONTHS_LONG, ACCENTS } from './lib/format.js'
-import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig } from './lib/history.js'
+import { lastEntryFor, bestWeightFor, buildSets, effectiveRoutineId, workoutVolume, setsDone, setsDoneActive, lastBW, supersetUnits, unitOf, setLabel, defaultConfig, cleanupSg } from './lib/history.js'
import { beep, vibrate } from './lib/sound.js'
import { t, instrFor, getLang, INSTR_LANGS } from './lib/i18n.js'
import { nav } from './lib/nav.js'
@@ -148,7 +148,7 @@ function GoalSheet({ close }) {
export const goalSheet = () => ui().openSheet(close => <GoalSheet close={close} />)
/* ============================ exercise detail ============================ */
-function ExerciseDetail({ ex }) {
+function ExerciseDetail({ ex, close }) {
const st = useStore(s => s.S)
const last = lastEntryFor(st, ex.id)
const best = bestWeightFor(st, ex.id)
@@ -163,10 +163,14 @@ function ExerciseDetail({ ex }) {
</div>
{best > 0 && <div className="small" style={{ marginBottom: 6 }}>🏆 {t('Best:')} <b className="accent">{fmtNum(best)} {st.unit}</b>{last ? ` · ${t('last')} ${fmtDate(last.d)}: ${last.sets.map(s => setLabel(ex.id, s)).join(', ')}` : ''}</div>}
<button className="btn primary" style={{ margin: '10px 0 4px' }} onClick={() => addToRoutineSheet(ex)}>{t('+ Add to my plan')}</button>
+ {ex.custom && <div className="row" style={{ gap: 8, marginTop: 8 }}>
+ <button className="btn" style={{ flex: 1 }} onClick={() => { close(); customExSheet(ex) }}>✏️ {t('Edit')}</button>
+ <button className="btn danger" style={{ flex: 1 }} onClick={() => deleteCustomEx(ex, close)}>🗑 {t('Delete')}</button>
+ </div>}
{instrFor(ex).length > 0 && <><h4 className="sec">{t('How to')}{!INSTR_LANGS.includes(getLang()) && <span className="dim" style={{ textTransform: 'none', letterSpacing: 0 }}> · {t('instructions in English')}</span>}</h4><ol className="steps-list">{instrFor(ex).map((s, i) => <li key={i}>{s}</li>)}</ol></>}
</>
}
-export const exerciseDetailSheet = ex => ui().openSheet(() => <ExerciseDetail ex={ex} />)
+export const exerciseDetailSheet = ex => ui().openSheet(close => <ExerciseDetail ex={ex} close={close} />)
/* ============================ add to routine ============================ */
function AddToRoutine({ ex, close }) {
@@ -201,6 +205,61 @@ function AddToRoutine({ ex, close }) {
}
export const addToRoutineSheet = ex => ui().openSheet(close => <AddToRoutine ex={ex} close={close} />)
+/* ============================ custom exercises (issue #11) ============================ */
+// Name + body part is all it takes — the exercise then behaves like any built-in one
+// (planning, logging, PRs, stats), just without an animation.
+function CustomExForm({ existing, prefill, onDone, close }) {
+ const [n, setN] = useState(existing ? existing.n : (prefill || ''))
+ const [bp, setBp] = useState(existing ? existing.bp : '')
+ const save = () => {
+ const name = n.trim()
+ if (!name) { toast(t('Give it a name')); return }
+ if (!bp) { toast(t('Pick a body part')); return }
+ const dup = allExercises(S()).find(e => e.n.toLowerCase() === name.toLowerCase() && e.id !== (existing || {}).id)
+ if (dup) { toast(t('“{0}” already exists', dup.n)); return }
+ let id = existing && existing.id
+ if (existing) update(s => { const c = (s.customEx || []).find(x => x.id === id); if (c) { c.n = name; c.bp = bp } })
+ else {
+ id = 'c' + uid()
+ update(s => { (s.customEx = s.customEx || []).push({ id, n: name, bp, tg: '', eq: 'custom', custom: true }) })
+ }
+ close()
+ toast(existing ? t('Saved ✓') : t('“{0}” created ✓', name))
+ onDone && onDone(EXIDX[id])
+ }
+ return <>
+ <h3>{existing ? t('Edit custom exercise') : t('Create your own exercise')}</h3>
+ <div className="muted small" style={{ marginBottom: 12 }}>{t('Name it and pick a body part — it behaves like any other exercise, just without an animation.')}</div>
+ <input className="input" placeholder={t('Exercise name')} value={n} onChange={e => setN(e.target.value)} />
+ <div className="chips" style={{ margin: '12px 0' }}>
+ {BODYPARTS.map(b => <button key={b} className={'chip' + (bp === b ? ' on' : '')} onClick={() => setBp(b)}>{t(b)}</button>)}
+ </div>
+ {bp === 'cardio' && <div className="small dim" style={{ marginBottom: 10 }}>🏃 {t('Cardio exercises log time + speed instead of weight × reps.')}</div>}
+ <button className="btn primary" onClick={save}>{existing ? t('Save') : t('Create exercise')}</button>
+ </>
+}
+export const customExSheet = (existing, onDone, prefill) => ui().openSheet(close => <CustomExForm existing={existing} prefill={prefill} onDone={onDone} close={close} />)
+
+export function deleteCustomEx(ex, afterDelete) {
+ if (S().active?.entries.some(e => e.id === ex.id)) { toast(t('Finish your current workout first')); return }
+ confirmSheet({
+ title: t('Delete “{0}”?', ex.n),
+ message: t('It will be removed from your routines. Already-logged workouts keep their sets.'),
+ confirmText: t('Delete'), danger: true,
+ onConfirm: () => {
+ update(s => {
+ s.customEx = (s.customEx || []).filter(x => x.id !== ex.id)
+ s.routines.forEach(r => { r.ex = r.ex.filter(e => e.id !== ex.id); cleanupSg(r.ex) })
+ // stamp the name into history entries so past workouts stay readable
+ s.workouts.forEach(w => w.entries.forEach(e => { if (e.id === ex.id) e.n = ex.n }))
+ delete s.exWeights[ex.id]
+ })
+ toast(t('Exercise deleted'))
+ afterDelete && afterDelete()
+ }
+ })
+}
+
/* ============================ exercise picker ============================ */
// Exercises already used in your routines or past workouts (for the "Chosen" filter + a marker).
function usageMap(st) {
@@ -216,26 +275,31 @@ function ExercisePicker({ onPick, close }) {
const [bp, setBp] = useState('') // '' = all, '★' = chosen, else a body part
const [shown, setShown] = useState(50)
const ql = q.toLowerCase().trim()
- let f = EXDB.filter(e =>
+ const all = allExercises(st)
+ let f = all.filter(e =>
(bp === '★' ? usage[e.id] : (!bp || e.bp === bp)) &&
- (!ql || e.n.includes(ql) || e.tg.includes(ql) || e.eq.includes(ql)))
+ (!ql || e.n.toLowerCase().includes(ql) || e.tg.includes(ql) || e.eq.includes(ql)))
if (bp === '★') f = [...f].sort((a, b) => (usage[b.id] - usage[a.id]) || (a.n < b.n ? -1 : 1))
const chosenCount = Object.keys(usage).length
return <>
<h3>{t('Add exercise')}</h3>
<div className="search"><svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="7" /><path d="m21 21-4.3-4.3" /></svg>
- <input className="input" placeholder={t('Search {0} exercises…', EXDB.length)} value={q} onChange={e => { setQ(e.target.value); setShown(50) }} /></div>
+ <input className="input" placeholder={t('Search {0} exercises…', all.length)} value={q} onChange={e => { setQ(e.target.value); setShown(50) }} /></div>
<div className="chips" style={{ margin: '10px 0' }}>
{chosenCount > 0 && <button className={'chip' + (bp === '★' ? ' on' : '')} onClick={() => { setBp('★'); setShown(50) }}>⭐ {t('Chosen')} ({chosenCount})</button>}
<button className={'chip' + (!bp ? ' on' : '')} onClick={() => { setBp(''); setShown(50) }}>{t('All')}</button>
{BODYPARTS.map(b => <button key={b} className={'chip' + (bp === b ? ' on' : '')} onClick={() => { setBp(b); setShown(50) }}>{t(b)}</button>)}
</div>
<div className="list">
+ {bp !== '★' && <div className="item" onClick={() => customExSheet(null, ex => onPick(ex), q.trim())}>
+ <div className="thumb thumb-x">✨</div>
+ <div className="grow"><div className="tt">{t('Create your own exercise')}</div><div className="ss">{t('name + body part, no animation')}</div></div><span className="chev">+</span>
+ </div>}
{f.slice(0, shown).map(e => <div key={e.id} className="item" onClick={() => onPick(e)}>
<Thumb ex={e} /><div className="grow"><div className="tt">{e.n}</div><div className="ss">{t(e.tg || e.bp)} · {t(e.eq)}</div></div>
{usage[e.id] && <span className="tag acc">⭐</span>}<span className="chev">+</span>
</div>)}
- {f.length === 0 && <div className="empty">{bp === '★' ? t('Nothing chosen yet — add exercises and they’ll show up here.') : t('No match 🤷')}</div>}
+ {f.length === 0 && bp === '★' && <div className="empty">{t('Nothing chosen yet — add exercises and they’ll show up here.')}</div>}
</div>
{f.length > shown && <><div style={{ height: 8 }} /><button className="btn" onClick={() => setShown(s => s + 50)}>{t('Show more')}</button></>}
</>
@@ -336,7 +400,7 @@ function WorkoutDetail({ w, close }) {
const ex = EXIDX[e.id]
return <div key={i} className="row" style={{ marginBottom: 12, alignItems: 'flex-start' }}>
{ex && <Thumb ex={ex} />}
- <div className="grow"><div className="tt capitalize" style={{ fontWeight: 700 }}>{ex ? ex.n : e.id} {w.prs && w.prs.includes(e.id) && <span className="pr">🏆 PR</span>}</div>
+ <div className="grow"><div className="tt capitalize" style={{ fontWeight: 700 }}>{ex ? ex.n : (e.n || e.id)} {w.prs && w.prs.includes(e.id) && <span className="pr">🏆 PR</span>}</div>
<div className="ss">{e.sets.filter(s => s.done).map(s => setLabel(e.id, s)).join(' · ') || t('no sets')}</div></div>
</div>
})}
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index ce0b4dd42..8a954fcf0 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -1,13 +1,14 @@
import { create } from 'zustand'
import { api } from '../lib/api.js'
import { localTZ } from '../lib/format.js'
+import { registerCustom } from '../lib/exercises.js'
const KEY = 'gym_state_v1'
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,
+ exWeights: {}, workouts: [], active: null, customEx: [],
reminder: { on: false, time: '08:00', tz: null }
}
const clone = o => JSON.parse(JSON.stringify(o))
@@ -27,6 +28,7 @@ export const useStore = create((set, get) => {
const persist = (S, push = true) => {
S._ts = Date.now()
+ registerCustom(S.customEx)
localStorage.setItem(KEY, JSON.stringify(S))
set({ S })
if (push && get().user) {
@@ -46,7 +48,7 @@ export const useStore = create((set, get) => {
})
return {
- S: loadState(),
+ S: (() => { const s = loadState(); registerCustom(s.customEx); return s })(),
user: (() => { try { return JSON.parse(localStorage.getItem('gym_user')) || null } catch { return null } })(),
ready: false,
diff --git a/frontend/src/views/Library.jsx b/frontend/src/views/Library.jsx
index 652460d37..1f3f175b9 100644
--- a/frontend/src/views/Library.jsx
+++ b/frontend/src/views/Library.jsx
@@ -1,11 +1,11 @@
import { useState } from 'react'
import { useStore } from '../store/useStore.js'
-import { EXDB, BODYPARTS } from '../lib/exercises.js'
+import { EXDB, BODYPARTS, allExercises } from '../lib/exercises.js'
import { bestWeightFor } from '../lib/history.js'
import { fmtNum } from '../lib/format.js'
import { t } from '../lib/i18n.js'
import { Thumb } from '../components/Media.jsx'
-import { exerciseDetailSheet, addToRoutineSheet } from '../sheets.jsx'
+import { exerciseDetailSheet, addToRoutineSheet, customExSheet } from '../sheets.jsx'
export default function Library() {
const S = useStore(s => s.S)
@@ -13,7 +13,7 @@ export default function Library() {
const [bp, setBp] = useState('')
const [shown, setShown] = useState(40)
const ql = q.toLowerCase().trim()
- const f = EXDB.filter(e => (!bp || e.bp === bp) && (!ql || e.n.includes(ql) || e.tg.includes(ql) || e.eq.includes(ql)))
+ const f = allExercises(S).filter(e => (!bp || e.bp === bp) && (!ql || e.n.toLowerCase().includes(ql) || e.tg.includes(ql) || e.eq.includes(ql)))
return <>
<div className="hdr"><div><h1>{t('Exercises')}</h1><div className="sub">{t('{0} exercises with animations', EXDB.length)}</div></div></div>
@@ -24,6 +24,10 @@ export default function Library() {
{BODYPARTS.map(b => <button key={b} className={'chip' + (bp === b ? ' on' : '')} onClick={() => { setBp(b); setShown(40) }}>{t(b)}</button>)}
</div>
<div className="list">
+ <div className="item" onClick={() => customExSheet(null, ex => exerciseDetailSheet(ex), q.trim())}>
+ <div className="thumb thumb-x">✨</div>
+ <div className="grow"><div className="tt">{t('Create your own exercise')}</div><div className="ss">{t('name + body part, no animation')}</div></div><span className="chev">+</span>
+ </div>
{f.slice(0, shown).map(e => {
const best = bestWeightFor(S, e.id)
return <div key={e.id} className="item" onClick={() => exerciseDetailSheet(e)}>
diff --git a/frontend/src/views/RoutineEdit.jsx b/frontend/src/views/RoutineEdit.jsx
index 312c25c11..aa4f9de0a 100644
--- a/frontend/src/views/RoutineEdit.jsx
+++ b/frontend/src/views/RoutineEdit.jsx
@@ -4,17 +4,10 @@ import { useStore } from '../store/useStore.js'
import { EXIDX, isCardio } from '../lib/exercises.js'
import { fmtNum, uid } from '../lib/format.js'
import { t } from '../lib/i18n.js'
-import { supersetUnits } from '../lib/history.js'
+import { supersetUnits, cleanupSg } from '../lib/history.js'
import { Thumb } from '../components/Media.jsx'
import { emojiPicker, exercisePicker, exConfigSheet, confirmSheet } from '../sheets.jsx'
-// drop superset ids that no longer have an adjacent partner (after unlink/reorder)
-function cleanupSg(ex) {
- ex.forEach((e, i) => {
- if (e.sg && !(ex[i - 1]?.sg === e.sg || ex[i + 1]?.sg === e.sg)) delete e.sg
- })
-}
-
export default function RoutineEdit() {
const nav = useNavigate()
const { id } = useParams()