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.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Body weight: every weigh-in, week by week with the week's average and its change (Discord)
Duarte Santos5214691e4eb4
diff --git a/frontend/src/lib/bodyweight.js b/frontend/src/lib/bodyweight.jsnew file mode 100644index 000000000..385a853da--- /dev/null+++ b/frontend/src/lib/bodyweight.js@@ -0,0 +1,28 @@+// Weigh-ins read back week by week (Discord 'Weight'). From one morning to the next, body weight+// moves with water, salt and the last meal by more than it moves in a month, so the number worth+// following is the week's mean — the one a single weigh-in on the card cannot give you.+import { weekKey } from './format.js'++/**+ * The weigh-ins grouped into weeks, newest week first. Each week carries its mean, how many+ * weigh-ins it holds, the change of its mean from the week before it that has any (null for the+ * first), and its entries newest first. `ws` is the first day of the week (weekStartOf), so the+ * weeks are the ones the calendar and the week strip show. The stored order is not relied on,+ * and an entry with no day or no weight is skipped rather than averaged in as 0.+ * Returns [{ key, avg, n, delta, entries }], `key` being the iso date the week starts on.+ */+export function weeklyWeights(bodyweight, ws) {+ const byWeek = new Map()+ for (const b of Array.isArray(bodyweight) ? bodyweight : []) {+ if (!b?.d || !(Number(b.w) > 0)) continue+ const key = weekKey(b.d, ws)+ if (!byWeek.has(key)) byWeek.set(key, [])+ byWeek.get(key).push(b)+ }+ const weeks = [...byWeek.keys()].sort().map(key => {+ const entries = byWeek.get(key).slice().sort((a, b) => (a.d < b.d ? 1 : a.d > b.d ? -1 : 0))+ return { key, n: entries.length, avg: entries.reduce((sum, b) => sum + Number(b.w), 0) / entries.length, entries }+ })+ weeks.forEach((week, i) => { week.delta = i ? week.avg - weeks[i - 1].avg : null })+ return weeks.reverse()+}diff --git a/frontend/src/lib/bodyweight.test.js b/frontend/src/lib/bodyweight.test.jsnew file mode 100644index 000000000..9085895bd--- /dev/null+++ b/frontend/src/lib/bodyweight.test.js@@ -0,0 +1,41 @@+import { describe, expect, it } from 'vitest'+import { weeklyWeights } from './bodyweight.js'++// Discord 'Weight': every weigh-in, week by week, with the week's mean.+describe('weeklyWeights', () => {+ // 2026-09-07 is a Monday, 2026-09-13 the Sunday after it.+ const log = [+ { d: '2026-09-01', w: 81 },+ { d: '2026-09-03', w: 80 },+ { d: '2026-09-07', w: 80.5 },+ { d: '2026-09-09', w: 79.5 },+ { d: '2026-09-13', w: 79 },+ ]++ it('groups by the profile\'s week, newest week and newest weigh-in first, with means and changes', () => {+ const weeks = weeklyWeights(log, 1)+ expect(weeks.map(w => w.key)).toEqual(['2026-09-07', '2026-08-31'])+ expect(weeks[0]).toMatchObject({ n: 3, avg: 79.66666666666667 })+ expect(weeks[0].entries.map(b => b.d)).toEqual(['2026-09-13', '2026-09-09', '2026-09-07'])+ expect(weeks[1]).toMatchObject({ n: 2, avg: 80.5, delta: null })+ expect(weeks[0].delta).toBeCloseTo(-0.8333, 3)+ })++ it('moves the boundary with a Sunday week start', () => {+ const weeks = weeklyWeights(log, 0)+ expect(weeks.map(w => [w.key, w.n])).toEqual([['2026-09-13', 1], ['2026-09-06', 2], ['2026-08-30', 2]])+ })++ it('compares with the last week that has weigh-ins, not the calendar week before', () => {+ const weeks = weeklyWeights([{ d: '2026-08-03', w: 82 }, { d: '2026-09-07', w: 80 }], 1)+ expect(weeks[0].delta).toBe(-2)+ })++ it('does not rely on the stored order and skips entries it cannot place', () => {+ const weeks = weeklyWeights([{ d: '2026-09-09', w: 79 }, { d: '2026-09-07', w: 81 }, { w: 70 }, { d: '2026-09-08', w: 0 }, null], 1)+ expect(weeks).toHaveLength(1)+ expect(weeks[0]).toMatchObject({ n: 2, avg: 80 })+ expect(weeks[0].entries.map(b => b.d)).toEqual(['2026-09-09', '2026-09-07'])+ expect(weeklyWeights(undefined, 1)).toEqual([])+ })+})diff --git a/frontend/src/lib/pt-br-locale.test.js b/frontend/src/lib/pt-br-locale.test.jsindex 51dbc1a89..b0bd84359 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(680)- expect(inherited).toHaveLength(678)+ expect(inherited).toHaveLength(684)// 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('b3837351e4968a720eae9ce421e45b0aeedb91708ded6745293551f812b88b2a')+ expect(fingerprint, 'pt-PT inheritance changed; review the inherited pt-BR wording').toBe('c7856e07f5fae071e1729b8169b7799ef88684080a7dd7fa565e405851ddcf24')})test('does not leak European Portuguese UI terms', () => {diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.jsindex bd6820713..920ee3e6f 100644--- a/frontend/src/locales/de.js+++ b/frontend/src/locales/de.js@@ -1327,4 +1327,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Dieses Training eintragen','Mark all sets done': 'Alle Sätze abhaken',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Alle Wiegungen',+ '{0} weigh-in': '{0} Wiegung',+ '{0} weigh-ins': '{0} Wiegungen',+ 'Weekly average': 'Wochendurchschnitt',+ 'Week of {0}': 'Woche vom {0}',+ 'Average {0}': 'Schnitt {0}',}diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.jsindex 722f8ad90..229a693fc 100644--- a/frontend/src/locales/es.js+++ b/frontend/src/locales/es.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Registrar este entrenamiento','Mark all sets done': 'Marcar todas las series como hechas',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Todos los pesajes',+ '{0} weigh-in': '{0} pesaje',+ '{0} weigh-ins': '{0} pesajes',+ 'Weekly average': 'Media semanal',+ 'Week of {0}': 'Semana del {0}',+ 'Average {0}': 'Media {0}',}diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.jsindex fd6274537..c63248e17 100644--- a/frontend/src/locales/fr.js+++ b/frontend/src/locales/fr.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Enregistrer cette séance','Mark all sets done': 'Cocher toutes les séries',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Toutes les pesées',+ '{0} weigh-in': '{0} pesée',+ '{0} weigh-ins': '{0} pesées',+ 'Weekly average': 'Moyenne hebdomadaire',+ 'Week of {0}': 'Semaine du {0}',+ 'Average {0}': 'Moyenne {0}',}diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.jsindex a87d07d6c..cb940db53 100644--- a/frontend/src/locales/hi.js+++ b/frontend/src/locales/hi.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'यह वर्कआउट दर्ज करें','Mark all sets done': 'सभी सेट पूरे मार्क करें',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'सभी वज़न मापन',+ '{0} weigh-in': '{0} वज़न मापन',+ '{0} weigh-ins': '{0} वज़न मापन',+ 'Weekly average': 'साप्ताहिक औसत',+ 'Week of {0}': '{0} वाला सप्ताह',+ 'Average {0}': 'औसत {0}',}diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.jsindex 743070b9c..994457b88 100644--- a/frontend/src/locales/hu.js+++ b/frontend/src/locales/hu.js@@ -1310,4 +1310,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Az edzés rögzítése','Mark all sets done': 'Összes sorozat késznek jelölése',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Összes mérés',+ '{0} weigh-in': '{0} mérés',+ '{0} weigh-ins': '{0} mérés',+ 'Weekly average': 'Heti átlag',+ 'Week of {0}': 'Hét: {0}',+ 'Average {0}': 'Átlag {0}',}diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.jsindex e82b28677..96cbbc95d 100644--- a/frontend/src/locales/it.js+++ b/frontend/src/locales/it.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Registra questo allenamento','Mark all sets done': 'Segna tutte le serie come fatte',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Tutte le pesate',+ '{0} weigh-in': '{0} pesata',+ '{0} weigh-ins': '{0} pesate',+ 'Weekly average': 'Media settimanale',+ 'Week of {0}': 'Settimana del {0}',+ 'Average {0}': 'Media {0}',}diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.jsindex 21b15bc95..b2ef74bd1 100644--- a/frontend/src/locales/ko.js+++ b/frontend/src/locales/ko.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': '이 운동 기록','Mark all sets done': '모든 세트 완료로 표시',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': '모든 체중 기록',+ '{0} weigh-in': '체중 기록 {0}개',+ '{0} weigh-ins': '체중 기록 {0}개',+ 'Weekly average': '주간 평균',+ 'Week of {0}': '{0} 주',+ 'Average {0}': '평균 {0}',}diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.jsindex ccf13408b..e2fb24bcd 100644--- a/frontend/src/locales/pl.js+++ b/frontend/src/locales/pl.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Zapisz ten trening','Mark all sets done': 'Oznacz wszystkie serie jako zrobione',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Wszystkie ważenia',+ '{0} weigh-in': '{0} ważenie',+ '{0} weigh-ins': '{0} ważeń',+ 'Weekly average': 'Średnia tygodniowa',+ 'Week of {0}': 'Tydzień od {0}',+ 'Average {0}': 'Średnio {0}',}diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.jsindex 08aa14197..51b2d265e 100644--- a/frontend/src/locales/pt.js+++ b/frontend/src/locales/pt.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Registar este treino','Mark all sets done': 'Marcar todas as séries como feitas',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Todas as pesagens',+ '{0} weigh-in': '{0} pesagem',+ '{0} weigh-ins': '{0} pesagens',+ 'Weekly average': 'Média semanal',+ 'Week of {0}': 'Semana de {0}',+ 'Average {0}': 'Média {0}',}diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.jsindex faa95aa72..3ffb150ea 100644--- a/frontend/src/locales/ru.js+++ b/frontend/src/locales/ru.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Записать эту тренировку','Mark all sets done': 'Отметить все подходы выполненными',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Все взвешивания',+ '{0} weigh-in': 'Взвешиваний: {0}',+ '{0} weigh-ins': 'Взвешиваний: {0}',+ 'Weekly average': 'Среднее за неделю',+ 'Week of {0}': 'Неделя с {0}',+ 'Average {0}': 'В среднем {0}',}diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.jsindex 94d1cd8d0..a8ff62fe8 100644--- a/frontend/src/locales/th.js+++ b/frontend/src/locales/th.js@@ -1318,4 +1318,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'บันทึกการฝึกนี้','Mark all sets done': 'ทำเครื่องหมายทุกเซ็ตว่าเสร็จแล้ว',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'บันทึกน้ำหนักทั้งหมด',+ '{0} weigh-in': 'บันทึก {0} ครั้ง',+ '{0} weigh-ins': 'บันทึก {0} ครั้ง',+ 'Weekly average': 'ค่าเฉลี่ยรายสัปดาห์',+ 'Week of {0}': 'สัปดาห์เริ่ม {0}',+ 'Average {0}': 'เฉลี่ย {0}',}diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.jsindex c21d901df..0f0eb548a 100644--- a/frontend/src/locales/tr.js+++ b/frontend/src/locales/tr.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': 'Bu antrenmanı kaydet','Mark all sets done': 'Tüm setleri tamamlandı olarak işaretle',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': 'Tüm tartımlar',+ '{0} weigh-in': '{0} tartım',+ '{0} weigh-ins': '{0} tartım',+ 'Weekly average': 'Haftalık ortalama',+ 'Week of {0}': '{0} haftası',+ 'Average {0}': 'Ortalama {0}',}diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.jsindex 5590c06a1..48196c56b 100644--- a/frontend/src/locales/zh.js+++ b/frontend/src/locales/zh.js@@ -1307,4 +1307,11 @@ export default {// --- a missed day logged afterwards (#284) ---'Log this workout': '补记这次训练','Mark all sets done': '将所有组标为完成',+ // --- every weigh-in, week by week ---+ 'All weigh-ins': '全部称重记录',+ '{0} weigh-in': '{0} 次称重',+ '{0} weigh-ins': '{0} 次称重',+ 'Weekly average': '每周平均',+ 'Week of {0}': '{0} 起的一周',+ 'Average {0}': '平均 {0}',}diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 229841370..a3d5c903b 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -37,6 +37,7 @@ import { isFav, toggleFav, sortFavouritesFirst } from './lib/favourites.js'import { buildSessionEntries, buildPlannedEntry } from './lib/session-start.js'import { buildCombinedEntries, deriveSessionName } from './lib/session-merge.js'import { workoutsOn, backfillStart, backfillEnd, completeBackfill } from './lib/backfill.js'+import { weeklyWeights } from './lib/bodyweight.js'import { workoutText } from './lib/workout-text.js'import { copyText } from './lib/clipboard.js'@@ -217,7 +218,6 @@ function BwSheet({ required, onDone, close }) {if (onDone) onDone(n); else toast(t('Weight saved'))}const recent = [...st.bodyweight].reverse().slice(0, 3)- const delEntry = d => update(s => { s.bodyweight = s.bodyweight.filter(b => b.d !== d) })return <>{/* This sheet opens `locked` — swipe/backdrop/Escape/Android-back all no-op on it (seeModals.jsx) so an accidental tap on "Start" can't be walked back by reflex the way@@ -242,12 +242,11 @@ function BwSheet({ required, onDone, close }) {{!required && recent.length > 0 && <><h4 className="sec">{t('Recent weigh-ins')}</h4><div className="list" style={{ gap: 0 }}>- {recent.map(b => <div key={b.d} className="row between" style={{ padding: '9px 2px', borderBottom: '1px solid var(--sep)' }}>- <span className="small muted">{fmtDate(b.d, true)}</span>- <span className="row" style={{ gap: 12 }}><b>{fmtNum(b.w)} {unit}</b>- <button className="iconbtn" style={{ width: 32, height: 30, borderRadius: 8, fontSize: 15, color: 'var(--red)' }} onClick={() => delEntry(b.d)} aria-label="delete"><Icon name="trash" /></button></span>- </div>)}+ {recent.map(b => <WeighInRow key={b.d} b={b} unit={unit} />)}</div>+ {st.bodyweight.length > recent.length && <div className="row" style={{ justifyContent: 'flex-end', marginTop: 6 }}>+ <Button size="sm" variant="ghost" trailingIcon="chevronRight" onClick={weighInsSheet}>{t('All weigh-ins')}</Button>+ </div>}</>}</>}@@ -256,6 +255,58 @@ export function bwSheet(opts = {}) {return h}+// One weigh-in with its delete button, in the log sheet's recent three and in the full list.+function WeighInRow({ b, unit }) {+ const delEntry = () => update(s => { s.bodyweight = s.bodyweight.filter(x => x.d !== b.d) })+ return <div className="row between" style={{ padding: '9px 2px', borderBottom: '1px solid var(--sep)' }}>+ <span className="small muted">{fmtDate(b.d, true)}</span>+ <span className="row" style={{ gap: 12 }}><b>{fmtNum(b.w)} {unit}</b>+ <button className="iconbtn" style={{ width: 32, height: 30, borderRadius: 8, fontSize: 15, color: 'var(--red)' }} onClick={delEntry} aria-label="delete"><Icon name="trash" /></button></span>+ </div>+}++/* ============================ weigh-ins ============================ */+// Every weigh-in, week by week (Discord 'Weight'): each week under its mean and how far that+// moved from the week before, the numbers behind the curve on the card. The chart plots the+// weekly means, since the swing from one morning to the next is what makes a single weigh-in+// hard to read. The weeks start on the profile's first day of the week.+function WeighIns() {+ const st = useStore(s => s.S)+ const ws = weekStartOf(st)+ const weeks = useMemo(() => weeklyWeights(st.bodyweight, ws), [st.bodyweight, ws])+ const points = useMemo(() => [...weeks].reverse()+ .map(w => ({ t: new Date(w.key + 'T12:00:00').getTime(), y: Math.round(w.avg * 100) / 100, d: w.key })), [weeks])+ const n = weeks.reduce((sum, w) => sum + w.n, 0)+ if (!n) return <>+ <h3>{t('Weigh-ins')}</h3>+ <div className="empty"><div className="ico"><Icon name="scale" /></div>{t('No entries yet — log your weight to start the curve.')}</div>+ </>+ return <>+ <h3 style={{ marginBottom: 2 }}>{t('Weigh-ins')}</h3>+ <div className="muted small" style={{ marginBottom: 10 }}>{t(n === 1 ? '{0} weigh-in' : '{0} weigh-ins', n)}</div>+ <div className="chart"><LineChart points={points} h={140} unit={st.unit} goal={st.targetW} /></div>+ <div className="small dim" style={{ marginTop: 6 }}>{t('Weekly average')}</div>+ {weeks.map(w => {+ // Only a change the display can show: at one decimal, 0.02 kg is "0", and an arrow over a+ // zero says something moved when, as far as the screen goes, nothing did.+ const moved = w.delta != null && fmtNum(Math.abs(w.delta)) !== fmtNum(0)+ return <div key={w.key} data-week={w.key}>+ <div className="row between" style={{ margin: '16px 2px 4px', gap: 8 }}>+ <span className="small" style={{ fontWeight: 600 }}>{t('Week of {0}', fmtDate(w.key))}</span>+ <span className="small row" style={{ gap: 8 }}>+ {moved && <span className="row" style={{ gap: 2, fontWeight: 500, color: bwDeltaColor(w.delta, w.avg) }}>+ <Icon name={w.delta > 0 ? 'arrowUp' : 'arrowDown'} style={{ fontSize: 12 }} />{fmtNum(Math.abs(w.delta))}+ </span>}+ <span className="muted" style={{ whiteSpace: 'nowrap' }}>{t('Average {0}', fmtNum(w.avg) + ' ' + st.unit)}</span>+ </span>+ </div>+ <div className="list" style={{ gap: 0 }}>{w.entries.map(b => <WeighInRow key={b.d} b={b} unit={st.unit} />)}</div>+ </div>+ })}+ </>+}+export const weighInsSheet = () => ui().openSheet(close => <WeighIns close={close} />)+/* ============================ import from another app ============================ */// Shows what a parsed export would actually do before anything is written. An import is// the one action where "just try it" is expensive — it's someone's entire trainingdiff --git a/frontend/src/sheets.weighin-history.test.jsx b/frontend/src/sheets.weighin-history.test.jsxnew file mode 100644index 000000000..22b54928d--- /dev/null+++ b/frontend/src/sheets.weighin-history.test.jsx@@ -0,0 +1,94 @@+// @vitest-environment happy-dom+// Discord 'Weight': "click on the body weight log to see the weight history and weekly average".+import React, { act } from 'react'+import { afterEach, beforeEach, describe, expect, it } from 'vitest'+import { createRoot } from 'react-dom/client'+import { DEF, useStore } from './store/useStore.js'+import { useUI } from './store/useUI.js'+import { bwSheet, weighInsSheet } from './sheets.jsx'++const clone = v => JSON.parse(JSON.stringify(v))+const mounted = []+function mountTopSheet() {+ 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 button = (host, text) => [...host.querySelectorAll('button')].find(b => b.textContent.trim() === text)++// Two Monday-started weeks: 31 Aug – 6 Sep and 7 – 13 Sep 2026.+const LOG = [+ { d: '2026-09-01', w: 81, t: 1 }, { d: '2026-09-03', w: 80, t: 2 },+ { d: '2026-09-07', w: 80.5, t: 3 }, { d: '2026-09-09', w: 79.5, t: 4 }, { d: '2026-09-13', w: 79, t: 5 },+]+function install(extra = {}) {+ const S = clone(DEF)+ Object.assign(S, { unit: 'kg', bodyweight: clone(LOG), weekStart: 1, targetW: null }, extra)+ useStore.setState({ S, user: null })+}++beforeEach(() => {+ globalThis.IS_REACT_ACT_ENVIRONMENT = true+ useUI.setState({ sheets: [] })+ document.body.innerHTML = ''+ install()+})+afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }) })++describe('weigh-ins sheet', () => {+ it('lists every weigh-in under its week, newest first, with the week\'s average and change', () => {+ weighInsSheet()+ const host = mountTopSheet()+ expect(host.querySelector('h3').textContent).toBe('Weigh-ins')+ expect(host.textContent).toContain('5 weigh-ins')+ expect(host.querySelector('.chart svg')).toBeTruthy()+ const weeks = [...host.querySelectorAll('[data-week]')]+ expect(weeks.map(w => w.dataset.week)).toEqual(['2026-09-07', '2026-08-31'])+ expect(weeks[0].textContent).toContain('Average 79.7 kg')+ expect(weeks[0].textContent).toContain('0.8') // down from 80.5 the week before+ expect(weeks[1].textContent).toContain('Average 80.5 kg')+ expect(weeks[0].querySelectorAll('button[aria-label="delete"]')).toHaveLength(3)+ expect(weeks[1].querySelectorAll('button[aria-label="delete"]')).toHaveLength(2)+ })++ it('follows a Sunday week start', () => {+ install({ weekStart: 0 })+ weighInsSheet()+ expect([...mountTopSheet().querySelectorAll('[data-week]')].map(w => w.dataset.week)).toEqual(['2026-09-13', '2026-09-06', '2026-08-30'])+ })++ it('deletes a weigh-in from the list', () => {+ weighInsSheet()+ const host = mountTopSheet()+ act(() => { host.querySelector('[data-week="2026-08-31"] button[aria-label="delete"]').click() })+ expect(useStore.getState().S.bodyweight.map(b => b.d)).toEqual(['2026-09-01', '2026-09-07', '2026-09-09', '2026-09-13'])+ expect(host.textContent).toContain('4 weigh-ins')+ })++ it('has an empty state', () => {+ install({ bodyweight: [] })+ weighInsSheet()+ const host = mountTopSheet()+ expect(host.querySelector('.empty')).toBeTruthy()+ expect(host.querySelector('.chart')).toBeNull()+ })++ it('is reached from the log sheet once there are more weigh-ins than its recent three', () => {+ bwSheet()+ const log = mountTopSheet()+ expect(log.querySelectorAll('button[aria-label="delete"]')).toHaveLength(3)+ const all = button(log, 'All weigh-ins')+ expect(all).toBeTruthy()+ act(() => { all.click() })+ expect(mountTopSheet().querySelector('h3').textContent).toBe('Weigh-ins')++ useUI.setState({ sheets: [] })+ install({ bodyweight: clone(LOG).slice(0, 2) })+ bwSheet()+ expect(button(mountTopSheet(), 'All weigh-ins')).toBeUndefined()+ })+})diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsxindex 49baab18c..10ad3e0cd 100644--- a/frontend/src/views/Home.jsx+++ b/frontend/src/views/Home.jsx@@ -4,7 +4,7 @@ import { useStore } from '../store/useStore.js'import { effectiveRoutines, effectiveRoutineIds, nextTrainingDay, streakWeeks, lastBW, setsDoneActive } from '../lib/history.js'import { fmtNum, fmtDate, todayISO, isoOf, weekKey, weekStartOf, weekDayOffset, DAYS, DAYN } from '../lib/format.js'import { t, dateLocale } from '../lib/i18n.js'-import { bwSheet, goalSheet, dayOverrideSheet, calendarSheet, startFlow, starterPlanSheet, bwDeltaColor } from '../sheets.jsx'+import { bwSheet, goalSheet, dayOverrideSheet, calendarSheet, startFlow, starterPlanSheet, bwDeltaColor, weighInsSheet } from '../sheets.jsx'import LineChart from '../components/LineChart.jsx'import Icon from '../components/Icon.jsx'import { Button } from '../components/ui.jsx'@@ -166,6 +166,10 @@ export default function Home() {</div>)}<div className="chart" style={{ marginTop: 8 }}><LineChart points={bwPoints} h={130} unit={S.unit} goal={S.targetW} /></div>+ {/* every weigh-in, week by week with its average (Discord 'Weight') */}+ <div className="row" style={{ justifyContent: 'flex-end', marginTop: 4 }}>+ <Button size="sm" variant="ghost" trailingIcon="chevronRight" onClick={weighInsSheet}>{t('All weigh-ins')}</Button>+ </div></> : <div className="muted small">{S.weighIn === false? t('No entries yet — log your weight to start the curve.'): t("No entries yet — log your weight to start the curve. It's also asked before every workout.")}</div>}diff --git a/frontend/src/views/Home.startdoor.test.jsx b/frontend/src/views/Home.startdoor.test.jsxindex ee980827d..1758037f2 100644--- a/frontend/src/views/Home.startdoor.test.jsx+++ b/frontend/src/views/Home.startdoor.test.jsx@@ -15,7 +15,7 @@ const nav = vi.fn()vi.mock('react-router-dom', () => ({ useNavigate: () => nav }))vi.mock('../sheets.jsx', () => ({starterPlanSheet: vi.fn(), bwSheet: vi.fn(), goalSheet: vi.fn(), dayOverrideSheet: vi.fn(),- calendarSheet: vi.fn(), startFlow: vi.fn(), bwDeltaColor: () => '',+ calendarSheet: vi.fn(), startFlow: vi.fn(), bwDeltaColor: () => '', weighInsSheet: vi.fn(),}))const routines = [{ id: 'r1', name: 'Push', emoji: null, ex: [{ id: '0025' }] }]diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsxindex 3af72bb3b..dcb4f4cca 100644--- a/frontend/src/views/Stats.jsx+++ b/frontend/src/views/Stats.jsx@@ -5,7 +5,7 @@ import { EXIDX, matchExercise, betterWeight } from '../lib/exercises.js'import { lastBW, streakWeeks, setLabel, modeOf, effortOf, metricModeForEntry, metricRowsForEntry, bestWeightForEntry } from '../lib/history.js'import { fmtNum, fmtDate, fmtVol, todayISO, weekStartOf } from '../lib/format.js'import { t, exerciseNameFor, getLang } from '../lib/i18n.js'-import { bwSheet, goalSheet, calendarSheet, workoutDetailSheet, exerciseHistorySheet, WorkoutRow, bwDeltaColor } from '../sheets.jsx'+import { bwSheet, goalSheet, calendarSheet, workoutDetailSheet, exerciseHistorySheet, WorkoutRow, bwDeltaColor, weighInsSheet } from '../sheets.jsx'import LineChart from '../components/LineChart.jsx'import Heatmap from '../components/Heatmap.jsx'import Icon from '../components/Icon.jsx'@@ -465,6 +465,10 @@ export default function Stats() {<Segmented className="seg-range" value={range} onChange={setRange}options={[{ value: 30, label: '1M' }, { value: 90, label: '3M' }, { value: 365, label: '1Y' }, { value: 0, label: t('All') }]} /><div className="chart"><LineChart points={bwPts} h={160} unit={S.unit} goal={S.targetW} /></div>+ {/* every weigh-in, week by week with its average (Discord 'Weight') */}+ {S.bodyweight.length > 0 && <div className="row" style={{ justifyContent: 'flex-end', marginTop: 4 }}>+ <Button size="sm" variant="ghost" trailingIcon="chevronRight" onClick={weighInsSheet}>{t('All weigh-ins')}</Button>+ </div>}</div><div className="card">diff --git a/frontend/src/views/Stats.recovery.test.jsx b/frontend/src/views/Stats.recovery.test.jsxindex 93c105236..5a5b75fc7 100644--- a/frontend/src/views/Stats.recovery.test.jsx+++ b/frontend/src/views/Stats.recovery.test.jsx@@ -34,7 +34,7 @@ vi.mock('react-router-dom', () => ({ useNavigate: () => () => {} }))vi.mock('../sheets.jsx', () => ({bwSheet: () => {}, goalSheet: () => {}, calendarSheet: () => {}, workoutDetailSheet: () => {},exerciseHistorySheet: mocks.exerciseHistorySheet,- WorkoutRow: () => React.createElement('div'), bwDeltaColor: () => 'inherit',+ WorkoutRow: () => React.createElement('div'), bwDeltaColor: () => 'inherit', weighInsSheet: () => {},}))vi.mock('../components/LineChart.jsx', () => ({ default: () => React.createElement('div') }))vi.mock('../components/Heatmap.jsx', () => ({ default: () => React.createElement('div') }))diff --git a/frontend/src/views/starter-entry.test.jsx b/frontend/src/views/starter-entry.test.jsxindex 5dab0a8ca..a31487be2 100644--- a/frontend/src/views/starter-entry.test.jsx+++ b/frontend/src/views/starter-entry.test.jsx@@ -13,7 +13,7 @@ import Plan from './Plan.jsx'vi.mock('react-router-dom', () => ({ useNavigate: () => () => {} }))vi.mock('../sheets.jsx', () => ({starterPlanSheet: vi.fn(), bwSheet: vi.fn(), goalSheet: vi.fn(), dayOverrideSheet: vi.fn(),- calendarSheet: vi.fn(), startFlow: vi.fn(), bwDeltaColor: () => '',+ calendarSheet: vi.fn(), startFlow: vi.fn(), bwDeltaColor: () => '', weighInsSheet: vi.fn(),dayAssignSheet: vi.fn(), planToolsSheet: vi.fn(),}))