Custom exercises: optional description + reachable delete

Adds an optional free-text description to custom exercises, shown where
a built-in exercise shows its animation (detail + config sheets) and
included in exercise search.

Deleting was only reachable from the Exercises tab detail sheet, which
you never pass through when tapping an exercise inside a routine. The
routine's config sheet now offers "Edit or delete this exercise", and
its old "Remove exercise" button is relabelled "Remove from routine" so
removing from a routine and deleting for good are no longer confusable.

Refs #11
This commit is contained in:
Duarte Santos committed 2026-07-22 00:34:27 +02:00
1 parent 0cefcb3636
commit a4f73e34d1
15 files changed
+80 -19

No files matched your search

+8 -3
View File
@@ -7,13 +7,18 @@ 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".
- 📝 **Optional description** — setup, cues, anything you want to remember. It shows on the
exercise's detail and config sheets (where a built-in exercise would show its animation),
and it's searchable, so you can find your own exercises by their cues too.
- 🏋️ 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.
- ✏️ Edit (rename, change body part or description) or delete your custom exercises — from
their detail sheet in the Exercises tab, or straight from the exercise inside a routine via
"Edit or delete this exercise". Deleting removes them from your routines; already-logged
workouts keep their sets and still show the exercise name. (The routine sheet's old "Remove
exercise" button is now labelled "Remove from routine", so the two are no longer confusable.)
- 🌍 Fully translated into all 12 UI languages, and synced to your profile like the rest of
your data.
+3
View File
@@ -134,6 +134,9 @@ a{color:var(--acc)}
.input{width:100%;background:var(--bg2);border:1px solid var(--line);border-radius:12px;
padding:13px 14px;font-size:1rem;outline:none}
.input:focus{border-color:var(--acc)}
textarea.input{min-height:88px;resize:vertical;line-height:1.45}
.exnote{background:var(--bg2);border-radius:12px;padding:12px 14px;line-height:1.5;
white-space:pre-wrap;font-size:.92rem;margin-bottom:10px}
.search{position:relative}
.search .input{padding-left:40px}
.search svg{position:absolute;left:13px;top:50%;transform:translateY(-50%);width:17px;height:17px;
+5 -1
View File
@@ -346,5 +346,9 @@ export default {
'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'
'Finish your current workout first': 'Beende zuerst dein laufendes Workout',
'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'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'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'
'Finish your current workout first': 'Termina primero tu entrenamiento actual',
'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'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'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'
'Finish your current workout first': 'Terminez d’abord votre séance en cours',
'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'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'Delete “{0}”?': '“{0}” हटाएं?',
'It will be removed from your routines. Already-logged workouts keep their sets.': 'यह आपकी रूटीन से हट जाएगी। दर्ज की गई वर्कआउट में सेट बने रहेंगे।',
'Exercise deleted': 'एक्सरसाइज़ हटाई गई',
'Finish your current workout first': 'पहले चल रही वर्कआउट पूरी करें'
'Finish your current workout first': 'पहले चल रही वर्कआउट पूरी करें',
'Description (optional) — setup, cues, anything you want to remember': 'विवरण (वैकल्पिक) — सेटअप, संकेत, जो कुछ भी याद रखना चाहें',
'Delete exercise': 'एक्सरसाइज़ हटाएं',
'Edit or delete this exercise': 'इस एक्सरसाइज़ को संपादित या हटाएं',
'Remove from routine': 'रूटीन से हटाएं'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'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'
'Finish your current workout first': 'Prima concludi l’allenamento in corso',
'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'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'Delete “{0}”?': '“{0}” 삭제할까요?',
'It will be removed from your routines. Already-logged workouts keep their sets.': '루틴에서 제거됩니다. 이미 기록된 운동은 세트를 유지합니다.',
'Exercise deleted': '운동 삭제됨',
'Finish your current workout first': '진행 중인 운동을 먼저 마치세요'
'Finish your current workout first': '진행 중인 운동을 먼저 마치세요',
'Description (optional) — setup, cues, anything you want to remember': '설명 (선택) — 세팅, 큐, 기억하고 싶은 모든 것',
'Delete exercise': '운동 삭제',
'Edit or delete this exercise': '이 운동 편집 또는 삭제',
'Remove from routine': '루틴에서 제거'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'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'
'Finish your current workout first': 'Najpierw zakończ bieżący trening',
'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'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'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'
'Finish your current workout first': 'Termina primeiro o treino atual',
'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'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'Delete “{0}”?': 'Удалить «{0}»?',
'It will be removed from your routines. Already-logged workouts keep their sets.': 'Оно будет убрано из ваших программ. Записанные тренировки сохранят свои подходы.',
'Exercise deleted': 'Упражнение удалено',
'Finish your current workout first': 'Сначала завершите текущую тренировку'
'Finish your current workout first': 'Сначала завершите текущую тренировку',
'Description (optional) — setup, cues, anything you want to remember': 'Описание (необязательно) — настройка, подсказки, всё, что хотите запомнить',
'Delete exercise': 'Удалить упражнение',
'Edit or delete this exercise': 'Изменить или удалить это упражнение',
'Remove from routine': 'Убрать из программы'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'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'
'Finish your current workout first': 'Önce mevcut antrenmanını bitir',
'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'
}
+5 -1
View File
@@ -328,5 +328,9 @@ export default {
'Delete “{0}”?': '删除「{0}」?',
'It will be removed from your routines. Already-logged workouts keep their sets.': '将从你的计划中移除。已记录的训练会保留其组数。',
'Exercise deleted': '动作已删除',
'Finish your current workout first': '请先完成当前训练'
'Finish your current workout first': '请先完成当前训练',
'Description (optional) — setup, cues, anything you want to remember': '描述(可选)——设置、要点,任何你想记住的内容',
'Delete exercise': '删除动作',
'Edit or delete this exercise': '编辑或删除此动作',
'Remove from routine': '从计划中移除'
}
+13 -4
View File
@@ -161,6 +161,7 @@ function ExerciseDetail({ ex, close }) {
<span className="tag">🛠 {t(ex.eq)}</span>
{(ex.sm || []).slice(0, 3).map((s, i) => <span key={i} className="tag">{t(s)}</span>)}
</div>
{ex.desc && <div className="exnote">{ex.desc}</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 }}>
@@ -211,17 +212,19 @@ export const addToRoutineSheet = ex => ui().openSheet(close => <AddToRoutine ex=
function CustomExForm({ existing, prefill, onDone, close }) {
const [n, setN] = useState(existing ? existing.n : (prefill || ''))
const [bp, setBp] = useState(existing ? existing.bp : '')
const [desc, setDesc] = useState(existing ? (existing.desc || '') : '')
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 }
const d = desc.trim().slice(0, 1000)
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 } })
if (existing) update(s => { const c = (s.customEx || []).find(x => x.id === id); if (c) { c.n = name; c.bp = bp; c.desc = d } })
else {
id = 'c' + uid()
update(s => { (s.customEx = s.customEx || []).push({ id, n: name, bp, tg: '', eq: 'custom', custom: true }) })
update(s => { (s.customEx = s.customEx || []).push({ id, n: name, bp, desc: d, tg: '', eq: 'custom', custom: true }) })
}
close()
toast(existing ? t('Saved ✓') : t('“{0}” created ✓', name))
@@ -235,7 +238,11 @@ function CustomExForm({ existing, prefill, onDone, close }) {
{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>}
<textarea className="input" rows={4} maxLength={1000} placeholder={t('Description (optional) — setup, cues, anything you want to remember')}
value={desc} onChange={e => setDesc(e.target.value)} />
<div style={{ height: 14 }} />
<button className="btn primary" onClick={save}>{existing ? t('Save') : t('Create exercise')}</button>
{existing && <><div style={{ height: 8 }} /><button className="btn danger" onClick={() => { close(); deleteCustomEx(existing) }}>🗑 {t('Delete exercise')}</button></>}
</>
}
export const customExSheet = (existing, onDone, prefill) => ui().openSheet(close => <CustomExForm existing={existing} prefill={prefill} onDone={onDone} close={close} />)
@@ -278,7 +285,7 @@ function ExercisePicker({ onPick, close }) {
const all = allExercises(st)
let f = all.filter(e =>
(bp === '★' ? usage[e.id] : (!bp || e.bp === bp)) &&
(!ql || e.n.toLowerCase().includes(ql) || e.tg.includes(ql) || e.eq.includes(ql)))
(!ql || e.n.toLowerCase().includes(ql) || e.tg.includes(ql) || e.eq.includes(ql) || (e.desc || '').toLowerCase().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 <>
@@ -323,6 +330,7 @@ function ExConfig({ ex, existing, onSave, onDelete, close }) {
{cardio && <span className="tag acc">🏃 {t('Cardio')}</span>}
<span className="tag">{t(ex.tg || ex.bp)}</span><span className="tag">{t(ex.eq)}</span>
</div>
{ex.desc && <div className="exnote">{ex.desc}</div>}
<div className="row cfgrow" style={{ marginBottom: 18 }}>
{cardio ? <>
<Stepper label={t('Intervals')} value={c.sets} step={1} decimal={false} onChange={v => setC(x => ({ ...x, sets: v }))} />
@@ -335,7 +343,8 @@ function ExConfig({ ex, existing, onSave, onDelete, close }) {
</>}
</div>
<button className="btn primary" onClick={save}>{existing ? t('Save') : t('Add to routine')}</button>
{onDelete && <><div style={{ height: 8 }} /><button className="btn danger" onClick={() => { close(); onDelete() }}>{t('Remove exercise')}</button></>}
{ex.custom && <><div style={{ height: 8 }} /><button className="btn" onClick={() => { close(); customExSheet(ex) }}>✏️ {t('Edit or delete this exercise')}</button></>}
{onDelete && <><div style={{ height: 8 }} /><button className="btn danger" onClick={() => { close(); onDelete() }}>{t('Remove from routine')}</button></>}
</>
}
export const exConfigSheet = (ex, existing, onSave, onDelete) => ui().openSheet(close => <ExConfig ex={ex} existing={existing} onSave={onSave} onDelete={onDelete} close={close} />)
+1 -1
View File
@@ -13,7 +13,7 @@ export default function Library() {
const [bp, setBp] = useState('')
const [shown, setShown] = useState(40)
const ql = q.toLowerCase().trim()
const f = allExercises(S).filter(e => (!bp || e.bp === bp) && (!ql || e.n.toLowerCase().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) || (e.desc || '').toLowerCase().includes(ql)))
return <>
<div className="hdr"><div><h1>{t('Exercises')}</h1><div className="sub">{t('{0} exercises with animations', EXDB.length)}</div></div></div>