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.

notes: make the session note real, and stop losing it

Duarte Santos3d30edddada9
diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.js
index 1f8b32c0f..91a4a63a8 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(291)
- expect(inherited).toHaveLength(447)
+ expect(inherited).toHaveLength(449)
// 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('5eca6d8b564c208b41f1be1890e3eaa0313e0ab901ed40a03b5d3071a65bd9f1')
+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('09c4fa5e04c8d3ea21916a6c07f074a35013b33d5d945ecfc13cd54cc8b7d41d')
})
test('does not leak European Portuguese UI terms', () => {
diff --git a/frontend/src/lib/session-note.test.jsx b/frontend/src/lib/session-note.test.jsx
new file mode 100644
index 000000000..aadf90505
--- /dev/null
+++ b/frontend/src/lib/session-note.test.jsx
@@ -0,0 +1,73 @@
+// @vitest-environment happy-dom
+// The session note shipped with a hole in it: buildCompletedWorkout read `active.note` and
+// nothing in the app ever wrote it, so the only way to get one was after the fact — and that
+// path threw the text away unless you happened to tab out of the field first.
+import { describe, expect, it, beforeEach, afterEach } from 'vitest'
+import React, { act } from 'react'
+import { createRoot } from 'react-dom/client'
+import { useStore } from '../store/useStore.js'
+import { useUI } from '../store/useUI.js'
+import { sessionNoteSheet, workoutDetailSheet } from '../sheets.jsx'
+import { buildCompletedWorkout } from './finish-workout.js'
+
+const mounted = []
+function render(open) {
+ open()
+ const sheet = useUI.getState().sheets.at(-1)
+ const host = document.createElement('div')
+ document.body.appendChild(host)
+ const root = createRoot(host)
+ mounted.push(root)
+ act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))
+ return host
+}
+const type = (el, value) => {
+ Object.getOwnPropertyDescriptor(el.constructor.prototype, 'value').set.call(el, value)
+ el.dispatchEvent(new Event('input', { bubbles: true }))
+}
+const unmountAll = () => act(() => { mounted.splice(0).forEach(r => r.unmount()) })
+
+const workout = () => ({
+ id: 'w1', d: '2026-08-25', start: 1, end: 2, name: 'Push', vol: 100,
+ entries: [{ id: 'bench', sets: [{ w: 100, r: 5, done: true }] }], prs: [],
+})
+
+describe('session note', () => {
+ beforeEach(() => {
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true
+ useUI.setState({ sheets: [] })
+ document.body.innerHTML = ''
+ })
+ afterEach(unmountAll)
+
+ it('can be written during the workout and survives finishing', () => {
+ useStore.setState(s => ({
+ S: { ...s.S, active: { id: 'w1', d: '2026-08-25', start: 1, name: 'Push', entries: [{ id: 'bench', sets: [] }] } },
+ }))
+ const host = render(() => sessionNoteSheet())
+ act(() => { type(host.querySelector('textarea'), 'slept badly, still hit it') })
+ act(() => { [...host.querySelectorAll('button')].find(b => /save/i.test(b.textContent)).click() })
+
+ const A = useStore.getState().S.active
+ expect(A.note).toBe('slept badly, still hit it')
+ // The path buildCompletedWorkout already had a test for is now actually reachable.
+ expect(buildCompletedWorkout(A, { end: 2 }).note).toBe('slept badly, still hit it')
+ })
+
+ it('is kept when the history sheet is dismissed without blurring the field', () => {
+ useStore.setState(s => ({ S: { ...s.S, workouts: [workout()] } }))
+ const host = render(() => workoutDetailSheet(useStore.getState().S.workouts[0]))
+ act(() => { type(host.querySelector('textarea'), 'good session') })
+ // Escape / Android back / swipe all unmount without a blur.
+ unmountAll()
+ expect(useStore.getState().S.workouts[0].note).toBe('good session')
+ })
+
+ it('clearing it removes the note rather than storing an empty string', () => {
+ useStore.setState(s => ({ S: { ...s.S, workouts: [{ ...workout(), note: 'old' }] } }))
+ const host = render(() => workoutDetailSheet(useStore.getState().S.workouts[0]))
+ act(() => { type(host.querySelector('textarea'), ' ') })
+ unmountAll()
+ expect(useStore.getState().S.workouts[0].note).toBeUndefined()
+ })
+})
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 03081a5df..8c911556c 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -687,6 +687,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'Sitzhöhe, Pin-Position, ein Hinweis zur Ausführung — bei jedem Training sichtbar.',
'From {0}:': 'Vom {0}:',
'Session note': 'Notiz zum Training',
+ 'Add session note': 'Notiz zum Training',
+ 'Edit session note': 'Notiz bearbeiten',
'How the session went as a whole.': 'Wie das Training insgesamt lief.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-Pause trainiert immer als ein Aufwärmsatz mit dieser Wiederholungszahl und ein Rest-Pause-Arbeitssatz — „Sätze“ wird nicht verwendet.'
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index 7634e53eb..b1ea117af 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'Altura del asiento, posición del pin, una indicación técnica — visible en cada sesión.',
'From {0}:': 'Del {0}:',
'Session note': 'Nota de la sesión',
+ 'Add session note': 'Añadir nota de la sesión',
+ 'Edit session note': 'Editar nota de la sesión',
'How the session went as a whole.': 'Cómo fue la sesión en conjunto.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause siempre entrena como una serie de calentamiento con estas reps y una serie de trabajo rest-pause — «Series» no se usa.'
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index a8b0fa339..387bf2564 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'Hauteur du siège, position de la goupille, un rappel technique — visible à chaque séance.',
'From {0}:': 'Du {0} :',
'Session note': 'Note de séance',
+ 'Add session note': 'Ajouter une note de séance',
+ 'Edit session note': 'Modifier la note de séance',
'How the session went as a whole.': 'Comment la séance s’est passée dans l’ensemble.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Le rest-pause s’entraîne toujours comme une série d’échauffement à ce nombre de reps, puis une série de travail rest-pause — « Séries » n’est pas utilisé.'
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index 70279e2f8..09038df9c 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'सीट की ऊँचाई, पिन की जगह, तकनीक का सुझाव — हर कसरत में दिखता है।',
'From {0}:': '{0} से:',
'Session note': 'सत्र का नोट',
+ 'Add session note': 'सत्र का नोट जोड़ें',
+ 'Edit session note': 'सत्र का नोट बदलें',
'How the session went as a whole.': 'पूरा सत्र कैसा रहा।',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'रेस्ट-पॉज़ हमेशा इसी रेप्स संख्या के एक वार्म-अप सेट और एक रेस्ट-पॉज़ वर्क सेट के रूप में किया जाता है — “सेट” का उपयोग नहीं होता।'
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index b394eace3..1c53c34ac 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'Altezza del sedile, posizione del pin, un promemoria tecnico — visibile a ogni sessione.',
'From {0}:': 'Del {0}:',
'Session note': 'Nota della sessione',
+ 'Add session note': 'Aggiungi nota della sessione',
+ 'Edit session note': 'Modifica nota della sessione',
'How the session went as a whole.': 'Com’è andata la sessione nel complesso.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Il rest-pause si allena sempre come una serie di riscaldamento a queste ripetizioni e una serie di lavoro rest-pause — “Serie” non viene usato.'
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 9f4287d9d..170f6d375 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': '시트 높이, 핀 위치, 자세 팁 — 매 운동마다 표시됩니다.',
'From {0}:': '{0}에서:',
'Session note': '운동 메모',
+ 'Add session note': '운동 메모 추가',
+ 'Edit session note': '운동 메모 편집',
'How the session went as a whole.': '이번 운동이 전체적으로 어땠는지.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': '레스트포즈는 항상 이 횟수의 워밍업 세트 하나와 레스트포즈 작업 세트 하나로 진행됩니다 — ‘세트’는 사용하지 않습니다.'
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index 37cd2151a..b914fbc37 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'Wysokość siedziska, pozycja bolca, wskazówka techniczna — widoczne w każdej sesji.',
'From {0}:': 'Z {0}:',
'Session note': 'Notatka do sesji',
+ 'Add session note': 'Dodaj notatkę do sesji',
+ 'Edit session note': 'Edytuj notatkę do sesji',
'How the session went as a whole.': 'Jak przebiegła cała sesja.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause zawsze trenuje się jako jedna seria rozgrzewkowa o tej liczbie powtórzeń i jedna seria robocza rest-pause — „Serie” nie są używane.'
}
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index 21d4bfb18..d14ccb131 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'Altura do banco, posição do pino, uma indicação técnica — visível em todas as sessões.',
'From {0}:': 'De {0}:',
'Session note': 'Nota da sessão',
+ 'Add session note': 'Adicionar nota da sessão',
+ 'Edit session note': 'Editar nota da sessão',
'How the session went as a whole.': 'Como correu a sessão no seu todo.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'O rest-pause treina sempre como uma série de aquecimento com estas repetições e uma série de trabalho rest-pause — «Séries» não é usado.'
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index c42e2233c..1e260d196 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'Высота сиденья, положение фиксатора, подсказка по технике — видно на каждой тренировке.',
'From {0}:': 'От {0}:',
'Session note': 'Заметка о тренировке',
+ 'Add session note': 'Добавить заметку',
+ 'Edit session note': 'Изменить заметку',
'How the session went as a whole.': 'Как прошла тренировка в целом.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause всегда выполняется как один разминочный подход с этим числом повторений и один рабочий подход rest-pause — «Подходы» не используются.'
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index d79c82a52..79b312557 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': 'Sehpa yüksekliği, pim konumu, bir teknik ipucu — her antrenmanda görünür.',
'From {0}:': '{0} tarihinden:',
'Session note': 'Antrenman notu',
+ 'Add session note': 'Antrenman notu ekle',
+ 'Edit session note': 'Antrenman notunu düzenle',
'How the session went as a whole.': 'Antrenmanın genel olarak nasıl geçtiği.',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause her zaman bu tekrar sayısında bir ısınma seti ve bir rest-pause çalışma seti olarak çalışılır — “Setler” kullanılmaz.'
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index 01a866941..533434d66 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -670,6 +670,8 @@ export default {
'Seat height, pin position, a form cue — shown every session.': '座椅高度、插销位置、动作要点 —— 每次训练都会显示。',
'From {0}:': '来自 {0}:',
'Session note': '训练备注',
+ 'Add session note': '添加训练备注',
+ 'Edit session note': '编辑训练备注',
'How the session went as a whole.': '这次训练整体感觉如何。',
'Rest-pause always trains as one warm-up set at this rep count, then one rest-pause work set — "Sets" is not used.': 'Rest-pause 始终按这个次数练一个热身组,再加一个 rest-pause 正式组 —— 不使用“组数”。'
}
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsx
index c70163d8b..00ad49f9c 100644
--- a/frontend/src/sheets.jsx
+++ b/frontend/src/sheets.jsx
@@ -923,6 +923,22 @@ function WorkoutDetail({ w, close }) {
const text = note.trim().slice(0, NOTE_MAX)
if (text) rec.note = text; else delete rec.note
})
+ // onBlur alone loses the note: Escape, the Android back gesture and swipe-to-dismiss all
+ // close the sheet without ever moving focus out of the textarea. Flush on unmount too. The
+ // ref is what makes that work — a cleanup closes over the note from its own render, which
+ // is the empty string this started with.
+ const latest = useRef(note)
+ latest.current = note
+ const initial = useRef(w.note || '')
+ useEffect(() => () => {
+ const text = latest.current.trim().slice(0, NOTE_MAX)
+ if (text === initial.current) return
+ update(s => {
+ const rec = s.workouts.find(x => x.id === w.id)
+ if (!rec) return // deleted from this very sheet
+ if (text) rec.note = text; else delete rec.note
+ })
+ }, [])
return <>
<h3>{w.name}</h3>
<div className="muted small" style={{ marginBottom: 12 }}>{[fmtDate(w.d, true), ...durPart(w.end - w.start), fmtVol(w.vol, st.unit), ...(w.bw ? [fmtNum(w.bw) + ' ' + st.unit] : [])].join(' · ')}</div>
@@ -1138,6 +1154,36 @@ function ExerciseNote({ entryIdx, close }) {
}
export const exerciseNoteSheet = entryIdx => ui().openSheet(close => <ExerciseNote entryIdx={entryIdx} close={close} />)
+/* The session note: how the whole workout went, as opposed to how one exercise went. It lives
+ on the active session, so buildCompletedWorkout carries it onto the finished workout and it
+ shows up again in history — where it stays editable. Written here rather than only after the
+ fact because "notes you can write during a workout" is the point; a note you can only add
+ once the session is filed is a different, smaller feature. */
+function SessionNote({ close }) {
+ const st = useStore(s => s.S)
+ const update = useStore(s => s.update)
+ const A = st.active
+ const [note, setNote] = useState(A?.note || '')
+ useEffect(() => { if (!A) close() }, [!A])
+ if (!A) return null
+
+ const save = () => {
+ const text = note.trim().slice(0, NOTE_MAX)
+ update(s => { if (!s.active) return; if (text) s.active.note = text; else delete s.active.note })
+ close()
+ }
+
+ return <>
+ <h3>{t('Session note')}</h3>
+ <textarea className="input" rows={4} maxLength={NOTE_MAX} value={note}
+ placeholder={t('How the session went as a whole.')}
+ onChange={e => setNote(e.target.value)} />
+ <div style={{ height: 18 }} />
+ <Button variant="primary" onClick={save}>{t('Save')}</Button>
+ </>
+}
+export const sessionNoteSheet = () => ui().openSheet(close => <SessionNote close={close} />)
+
/* Drop-set drops and rest-pause bursts are edited inline on the set row itself (Workout.jsx) —
no sheet, no timer. A planned exercise (see the "Intensifier" config below) arrives with them
already computed via applyIntensifierPlan; an unplanned straight set can still grow one live
diff --git a/frontend/src/views/Workout.jsx b/frontend/src/views/Workout.jsx
index 27ca2e9ac..d0a627977 100644
--- a/frontend/src/views/Workout.jsx
+++ b/frontend/src/views/Workout.jsx
@@ -10,7 +10,7 @@ import { t, exerciseNameFor } from '../lib/i18n.js'
import { api } from '../lib/api.js'
import { setProgressHighWater, supersetFlowStep, restAfterSet, restOnRecheck } from '../lib/supersetFlow.js'
import Media from '../components/Media.jsx'
-import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet } from '../sheets.jsx'
+import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet, exerciseNoteSheet, sessionNoteSheet } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
import { Button, Check, NumberField } from '../components/ui.jsx'
import { nextPrescription, applyPrescription, defaultIncrement } from '../lib/progression.js'
@@ -532,6 +532,13 @@ function ActiveWorkout() {
</div>
</>}
<div style={{ height: 10 }} />
+ {/* Wrapping up is when you know how the session went, so the note sits with the finish
+ button rather than somewhere in the header. */}
+ <div style={{ display: 'flex', justifyContent: 'center', marginBottom: 10 }}>
+ <Button size="sm" icon="pencil" variant={A.note ? 'tinted' : undefined} onClick={sessionNoteSheet}>
+ {A.note ? t('Edit session note') : t('Add session note')}
+ </Button>
+ </div>
{(() => {
const exDone = A.entries.filter(e => e.sets.length && e.sets.every(s => s.done)).length
const allDone = A.entries.length > 0 && exDone === A.entries.length
diff --git a/frontend/src/views/Workout.test.jsx b/frontend/src/views/Workout.test.jsx
index 1c7282e58..0564b8a68 100644
--- a/frontend/src/views/Workout.test.jsx
+++ b/frontend/src/views/Workout.test.jsx
@@ -46,6 +46,10 @@ vi.mock('../sheets.jsx', () => ({
finishWorkout: vi.fn(),
workoutCompleteSheet: vi.fn(),
confirmSheet: vi.fn(),
+ // Both note sheets belong here even though the tests never open one: Workout.jsx reads
+ // sessionNoteSheet during render, so a missing export is a render crash, not a no-op.
+ exerciseNoteSheet: vi.fn(),
+ sessionNoteSheet: vi.fn(),
}))
vi.mock('../components/Media.jsx', () => ({ default: () => null }))
// api.js reads navigator.userAgent at module scope. This file installs its own DOM inside the