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.

feat(body-weight): weekly rate of change with a target corridor (#759)

Duarte Santos201d44377bbf
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c2ce3d1a9..2a46d1f20 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -95,6 +95,10 @@ per muscle. Settings → Workout → Fine-tuning turns it off.
the history and backups keep it, and your old custom fields stay in cm like before. The body
CSV export says each field's unit in its column, and importing that file now brings the
measurements back too, not just the weigh-ins.
+- **Your weekly rate, with a corridor** (#759). Under the body-weight chart on Home and in Stats:
+ the trend through the last three weeks of weigh-ins, in kg or lb and in % of body weight a
+ week, so one salty dinner can't fool it. Tap it to set what you aim for (lose, gain or hold,
+ in % or in your unit) and the card tells you whether you're on pace, too fast or too slow.
**Security.** Follow-ups to v1.4.2's audit.
- **Pairing the phone app asks you to confirm it's you** (passkey, or your password where that
diff --git a/frontend/src/components/WeightRate.jsx b/frontend/src/components/WeightRate.jsx
new file mode 100644
index 000000000..fb584d067
--- /dev/null
+++ b/frontend/src/components/WeightRate.jsx
@@ -0,0 +1,89 @@
+// The weekly rate under the body-weight chart (#759), on Home and in Stats: the trend through the
+// last three weeks of weigh-ins (lib/bodyweight.js weightRate), in the profile's unit and in
+// percent of body weight, and, with a corridor set, whether it is on pace. Tapping it sets the
+// corridor. Without one and without enough weigh-ins it stays out of the way.
+import { useMemo, useState } from 'react'
+import { useStore } from '../store/useStore.js'
+import { useUI } from '../store/useUI.js'
+import { t, dateLocale } from '../lib/i18n.js'
+import { weightRate, rateCorridor, rateStatus } from '../lib/bodyweight.js'
+import Icon from './Icon.jsx'
+import { Button, NumberField, Segmented } from './ui.jsx'
+
+// Two decimals, signed: a lean bulk is +0.2 kg a week, and one decimal would round half of it away.
+const signed = v => new Intl.NumberFormat(dateLocale(), { maximumFractionDigits: 2, signDisplay: 'exceptZero' }).format(Math.round(v * 100) / 100 + 0)
+const size = v => new Intl.NumberFormat(dateLocale(), { maximumFractionDigits: 2 }).format(v)
+
+const STATUS = {
+ in: { text: () => t('On pace'), color: 'var(--acc)' },
+ slow: { text: () => t('Slower than planned'), color: 'var(--yellow)' },
+ fast: { text: dir => t(dir === 'gain' ? 'Gaining faster than planned' : 'Losing faster than planned'), color: 'var(--yellow)' },
+ off: { text: () => t('Outside your range'), color: 'var(--yellow)' },
+}
+
+export const rateText = (rate, unit) => t('Trend {0} a week ({1})', signed(rate.perWeek) + ' ' + unit, signed(rate.pct) + ' %')
+
+export default function WeightRate({ S }) {
+ const rate = useMemo(() => weightRate(S.bodyweight), [S.bodyweight])
+ const corridor = rateCorridor(S.rateGoal)
+ if (!rate.enough && !corridor) return null
+ const status = rateStatus(rate, S.rateGoal)
+ return <button type="button" className="bw-rate small" onClick={rateGoalSheet} aria-label={t('Weekly rate')}>
+ <Icon name="chartLine" style={{ fontSize: 13 }} />
+ <span className="bw-rate-t">{rate.enough ? rateText(rate, S.unit) : t('A few more weigh-ins, spread over the next days, and you get a weekly trend.')}</span>
+ {status && <b style={{ color: STATUS[status].color }}>{STATUS[status].text(corridor.dir)}</b>}
+ <Icon name="chevronRight" className="dim" style={{ fontSize: 11, marginInlineStart: 'auto' }} />
+ </button>
+}
+
+function RateGoalSheet({ close }) {
+ const S = useStore(s => s.S)
+ const rate = weightRate(S.bodyweight)
+ const had = rateCorridor(S.rateGoal)
+ const [dir, setDir] = useState(had?.dir || 'lose')
+ const [by, setBy] = useState(had?.by || '%')
+ const [lo, setLo] = useState(had ? Math.abs(had.dir === 'gain' ? had.min : had.max) : 0.5)
+ const [hi, setHi] = useState(had ? Math.abs(had.dir === 'gain' ? had.max : had.min) : 1)
+ const unit = by === 'w' ? S.unit : '%'
+ const save = () => {
+ const goal = dir === 'hold' ? { dir, by, lo: 0, hi: hi || 0 } : { dir, by, lo: lo || 0, hi: hi || 0 }
+ if (!rateCorridor(goal)) { useUI.getState().toast(t('Enter a range first')); return }
+ useStore.getState().update(s => { s.rateGoal = goal })
+ close()
+ }
+ return <>
+ <h3>{t('Weekly rate')}</h3>
+ <div className="muted small" style={{ marginBottom: 12 }}>
+ {t('The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.')}
+ </div>
+ {rate.enough && <div className="small" style={{ marginBottom: 12 }}><b>{rateText(rate, S.unit)}</b></div>}
+ <Segmented value={dir} onChange={setDir}
+ options={[{ value: 'lose', label: t('Lose') }, { value: 'gain', label: t('Gain') }, { value: 'hold', label: t('Hold') }]} />
+ <div style={{ height: 10 }} />
+ <Segmented value={by} onChange={setBy}
+ options={[{ value: '%', label: t('% of body weight') }, { value: 'w', label: S.unit }]} />
+ <div className="rate-range">
+ {dir === 'hold'
+ ? <label className="measure-field"><span>{t('Within ±')}</span>
+ <span className="measure-input"><NumberField value={hi} onChange={setHi} aria-label={t('Within ±')} /><i>{unit}</i></span></label>
+ : <>
+ <label className="measure-field"><span>{t('From')}</span>
+ <span className="measure-input"><NumberField value={lo} onChange={setLo} aria-label={t('From')} /><i>{unit}</i></span></label>
+ <label className="measure-field"><span>{t('To')}</span>
+ <span className="measure-input"><NumberField value={hi} onChange={setHi} aria-label={t('To')} /><i>{unit}</i></span></label>
+ </>}
+ </div>
+ <div className="small dim" style={{ marginBottom: 14 }}>
+ {dir === 'hold'
+ ? t('Hold within ±{0} a week.', size(hi || 0) + ' ' + unit)
+ : t(dir === 'lose' ? 'Lose {0} to {1} a week.' : 'Gain {0} to {1} a week.', size(Math.min(lo || 0, hi || 0)), size(Math.max(lo || 0, hi || 0)) + ' ' + unit)}
+ {' '}{t('A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.')}
+ </div>
+ <Button variant="primary" onClick={save}>{t('Save')}</Button>
+ {had && <><div style={{ height: 8 }} /><Button variant="danger" onClick={() => { useStore.getState().update(s => { s.rateGoal = null }); close() }}>{t('Remove range')}</Button></>}
+ <div style={{ height: 8 }} />
+ <Button variant="ghost" className="dim" onClick={close}>{t('Cancel')}</Button>
+ </>
+}
+
+export const rateGoalSheet = () => useUI.getState().openSheet(close => <RateGoalSheet close={close} />)
diff --git a/frontend/src/components/WeightRate.test.jsx b/frontend/src/components/WeightRate.test.jsx
new file mode 100644
index 000000000..6ba235da1
--- /dev/null
+++ b/frontend/src/components/WeightRate.test.jsx
@@ -0,0 +1,92 @@
+// @vitest-environment happy-dom
+// #759: the weekly rate on the body-weight card, and the corridor it is held against.
+import React, { act } from 'react'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import { createRoot } from 'react-dom/client'
+import { DEF, useStore } from '../store/useStore.js'
+import { useUI } from '../store/useUI.js'
+import { isoOf } from '../lib/format.js'
+import WeightRate, { rateGoalSheet } from './WeightRate.jsx'
+
+const mounted = []
+function render(node) {
+ const host = document.createElement('div')
+ document.body.appendChild(host)
+ const root = createRoot(host)
+ mounted.push([root, host])
+ act(() => root.render(node))
+ return host
+}
+const topSheet = () => { const sheet = useUI.getState().sheets.at(-1); return render(sheet.render(() => useUI.getState().closeSheet(sheet.id))) }
+const button = (host, text) => [...host.querySelectorAll('button')].find(b => b.textContent.trim() === text)
+const type = (input, value) => act(() => {
+ Object.getOwnPropertyDescriptor(input.constructor.prototype, 'value').set.call(input, value)
+ input.dispatchEvent(new Event('input', { bubbles: true }))
+})
+
+// Losing 0.1 kg a day, weighed every other day for three weeks: -0.7 kg a week, about -0.85 %.
+const days = i => isoOf(new Date(Date.now() - i * 86400000))
+const cut = Array.from({ length: 11 }, (_, k) => ({ d: days(20 - 2 * k), w: Math.round((84 - 0.2 * k) * 10) / 10, t: 1 }))
+const install = patch => useStore.setState({ S: { ...structuredClone(DEF), unit: 'kg', bodyweight: cut, ...patch }, user: null })
+const Card = () => { const S = useStore(s => s.S); return <WeightRate S={S} /> }
+
+beforeEach(() => {
+ globalThis.IS_REACT_ACT_ENVIRONMENT = true
+ useUI.setState({ sheets: [], toast: vi.fn() })
+ install({})
+})
+afterEach(() => { act(() => mounted.splice(0).forEach(([root, host]) => { root.unmount(); host.remove() })) })
+
+describe('weekly rate on the body-weight card', () => {
+ it('shows the trend in the profile unit and in percent', () => {
+ const host = render(<Card />)
+ expect(host.querySelector('.bw-rate').textContent).toMatch(/Trend -0\.7 kg a week \(-0\.8\d %\)/)
+ })
+
+ it('stays out of the way with too few weigh-ins and no corridor', () => {
+ install({ bodyweight: cut.slice(0, 3) })
+ expect(render(<Card />).querySelector('.bw-rate')).toBeNull()
+ })
+
+ it('says whether a cut is on pace', () => {
+ install({ rateGoal: { dir: 'lose', by: '%', lo: 0.5, hi: 1 } })
+ expect(render(<Card />).querySelector('.bw-rate b').textContent).toBe('On pace')
+ install({ rateGoal: { dir: 'lose', by: 'w', lo: 0.25, hi: 0.5 } })
+ expect(render(<Card />).querySelector('.bw-rate b').textContent).toBe('Losing faster than planned')
+ install({ rateGoal: { dir: 'gain', by: '%', lo: 0.25, hi: 0.5 } })
+ expect(render(<Card />).querySelector('.bw-rate b').textContent).toBe('Slower than planned')
+ })
+
+ it('in pounds, says pounds', () => {
+ install({ unit: 'lb', bodyweight: cut.map(b => ({ ...b, w: Math.round(b.w * 22.046) / 10 })) })
+ expect(render(<Card />).querySelector('.bw-rate').textContent).toMatch(/Trend -1\.5\d? lb a week/)
+ })
+
+ it('sets a corridor from the sheet, and removes it again', () => {
+ const host = render(<Card />)
+ act(() => host.querySelector('.bw-rate').click())
+ const sheet = topSheet()
+ act(() => button(sheet, 'Gain').click())
+ act(() => button(sheet, 'kg').click())
+ type(sheet.querySelector('input[aria-label="From"]'), '0.1')
+ type(sheet.querySelector('input[aria-label="To"]'), '0.25')
+ act(() => button(sheet, 'Save').click())
+ expect(useStore.getState().S.rateGoal).toEqual({ dir: 'gain', by: 'w', lo: 0.1, hi: 0.25 })
+ expect(host.querySelector('.bw-rate b').textContent).toBe('Slower than planned')
+
+ rateGoalSheet()
+ const again = topSheet()
+ expect(again.querySelector('input[aria-label="From"]').value).toBe('0.1')
+ act(() => button(again, 'Remove range').click())
+ expect(useStore.getState().S.rateGoal).toBeNull()
+ })
+
+ it('a hold keeps within plus or minus one number', () => {
+ rateGoalSheet()
+ const sheet = topSheet()
+ act(() => button(sheet, 'Hold').click())
+ type(sheet.querySelector('input[aria-label="Within ±"]'), '0.25')
+ act(() => button(sheet, 'Save').click())
+ expect(useStore.getState().S.rateGoal).toEqual({ dir: 'hold', by: '%', lo: 0, hi: 0.25 })
+ })
+})
diff --git a/frontend/src/index.css b/frontend/src/index.css
index a0170e87c..d6ffbf1e1 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -297,6 +297,9 @@ h4.sec{
55px, so the button pair may drop to a second line — still flush right, hence the auto margin. */
.bw-head{flex-wrap:wrap;row-gap:8px}
.bw-head>.row{margin-inline-start:auto}
+.bw-rate{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;width:100%;margin-top:6px;padding:6px 2px;background:none;border:0;color:var(--label-2);font:inherit;text-align:start;cursor:pointer}
+.bw-rate-t{min-width:0}
+.rate-range{display:grid;gap:8px;margin:14px 0 8px}
/* ----------------------------------------------------------------- card -- */
.card{
diff --git a/frontend/src/lib/bodyweight-rate.test.js b/frontend/src/lib/bodyweight-rate.test.js
new file mode 100644
index 000000000..9f802faaf
--- /dev/null
+++ b/frontend/src/lib/bodyweight-rate.test.js
@@ -0,0 +1,78 @@
+import { describe, expect, it } from 'vitest'
+import { weightRate, rateCorridor, rateStatus } from './bodyweight.js'
+import { convertStateUnit } from './units.js'
+
+// #759: the weekly rate of change over the last three weeks, and a corridor to hold it against.
+const NOW = new Date('2026-10-21T09:00:00').getTime()
+const day = i => { const d = new Date(NOW - i * 86400000); return d.toISOString().slice(0, 10) }
+// Every other day for three weeks, losing 0.1 kg a day, with a water swing on top.
+const log = (perDay = -0.1, start = 85) => Array.from({ length: 11 }, (_, k) => {
+ const i = 20 - k * 2
+ return { d: day(i), w: start + perDay * (20 - i) + (k % 2 ? 0.4 : -0.4), t: 1 }
+})
+
+describe('weekly rate', () => {
+ it('is the slope over the window, per week and in percent of body weight', () => {
+ const r = weightRate(log(), { now: NOW })
+ expect(r.enough).toBe(true)
+ expect(r.n).toBe(11)
+ expect(r.perWeek).toBeCloseTo(-0.7, 0)
+ expect(r.pct).toBeCloseTo(r.perWeek / r.mean * 100, 6)
+ })
+
+ it('lets no single morning flip it', () => {
+ const calm = weightRate(log(0.05), { now: NOW })
+ const spiky = log(0.05)
+ spiky[spiky.length - 1].w += 2.5
+ expect(Math.sign(weightRate(spiky, { now: NOW }).perWeek)).toBe(Math.sign(calm.perWeek))
+ })
+
+ it('needs enough weigh-ins, far enough apart, inside the window', () => {
+ expect(weightRate(log().slice(0, 5), { now: NOW })).toEqual({ enough: false, n: 5 })
+ const crowded = Array.from({ length: 8 }, (_, i) => ({ d: day(i), w: 80 + i / 10 }))
+ expect(weightRate(crowded, { now: NOW }).enough).toBe(false)
+ const old = log().map(b => ({ ...b, d: day(40 + Number(b.d.slice(8)) % 20) }))
+ expect(weightRate(old, { now: NOW }).n).toBe(0)
+ expect(weightRate(undefined, { now: NOW })).toEqual({ enough: false, n: 0 })
+ })
+})
+
+describe('target corridor', () => {
+ const rate = (pct, perWeek = pct) => ({ enough: true, pct, perWeek })
+ it('reads sizes, in any order, into a signed range', () => {
+ expect(rateCorridor({ dir: 'lose', by: '%', lo: 1, hi: 0.5 })).toEqual({ dir: 'lose', by: '%', min: -1, max: -0.5 })
+ expect(rateCorridor({ dir: 'gain', by: 'w', lo: 0.1, hi: 0.25 })).toEqual({ dir: 'gain', by: 'w', min: 0.1, max: 0.25 })
+ expect(rateCorridor({ dir: 'hold', by: '%', lo: 0, hi: 0.2 })).toEqual({ dir: 'hold', by: '%', min: -0.2, max: 0.2 })
+ expect(rateCorridor({ dir: 'gain', lo: 0, hi: 0 })).toBeNull()
+ expect(rateCorridor(null)).toBeNull()
+ })
+
+ it('says in, too fast or too slow for a cut and a bulk', () => {
+ const cut = { dir: 'lose', by: '%', lo: 0.5, hi: 1 }
+ expect(rateStatus(rate(-0.7), cut)).toBe('in')
+ expect(rateStatus(rate(-1.3), cut)).toBe('fast')
+ expect(rateStatus(rate(-0.2), cut)).toBe('slow')
+ expect(rateStatus(rate(0.3), cut)).toBe('slow')
+ const bulk = { dir: 'gain', by: '%', lo: 0.25, hi: 0.5 }
+ expect(rateStatus(rate(0.41), bulk)).toBe('in')
+ expect(rateStatus(rate(0.8), bulk)).toBe('fast')
+ expect(rateStatus(rate(0.1), bulk)).toBe('slow')
+ expect(rateStatus(rate(-0.1), { dir: 'hold', by: '%', hi: 0.25 })).toBe('in')
+ expect(rateStatus(rate(0.4), { dir: 'hold', by: '%', hi: 0.25 })).toBe('off')
+ })
+
+ it('goes by the weight per week for a corridor in kg or lb, and by nothing without enough data', () => {
+ const cut = { dir: 'lose', by: 'w', lo: 0.25, hi: 0.5 }
+ expect(rateStatus(rate(-5, -0.3), cut)).toBe('in')
+ expect(rateStatus({ enough: false, n: 2 }, cut)).toBeNull()
+ })
+
+ it('a corridor in the profile unit moves with a kg/lb switch, one in % does not', () => {
+ const S = { unit: 'kg', bodyweight: [], rateGoal: { dir: 'lose', by: 'w', lo: 0.5, hi: 1 } }
+ const lb = convertStateUnit(S, 'lb')
+ expect(lb.rateGoal).toMatchObject({ dir: 'lose', by: 'w', lo: 1.1, hi: 2.2 })
+ expect(convertStateUnit(lb, 'kg').rateGoal).toMatchObject({ lo: 0.5, hi: 1 })
+ const pct = { unit: 'kg', bodyweight: [], rateGoal: { dir: 'lose', by: '%', lo: 0.5, hi: 1 } }
+ expect(convertStateUnit(pct, 'lb').rateGoal).toEqual(pct.rateGoal)
+ })
+})
diff --git a/frontend/src/lib/bodyweight.js b/frontend/src/lib/bodyweight.js
index 2f50c9473..d5d0fc5b6 100644
--- a/frontend/src/lib/bodyweight.js
+++ b/frontend/src/lib/bodyweight.js
@@ -52,3 +52,64 @@ export function logWeighIn(s, w, at = Date.now()) {
s.bodyweight.sort((a, b) => (a.d < b.d ? -1 : 1))
return true
}
+
+// ---- Weekly rate (#759) ----------------------------------------------------------------------
+// How fast the weight moves, for steering a cut or a bulk. Not this week's mean against last
+// week's: water and salt swing a morning by more than a lean bulk moves in a week. A straight
+// line through every weigh-in of the last three weeks (least squares) lets no one morning flip
+// it, and it needs enough of them, spread far enough apart, to say anything at all.
+export const RATE_WINDOW_DAYS = 21
+export const RATE_MIN_WEIGHINS = 6
+export const RATE_MIN_SPAN_DAYS = 10
+const DAY = 86400000
+
+/**
+ * The trend of the weigh-ins in the `days` up to `now`, in the weigh-ins' own unit per week and
+ * in percent of the window's mean weight per week. `{ enough: false, n }` when there are fewer
+ * than RATE_MIN_WEIGHINS, or they span less than RATE_MIN_SPAN_DAYS. Each weigh-in sits at noon
+ * of its day, so a correction typed later does not move it along the line.
+ */
+export function weightRate(bodyweight, { now = Date.now(), days = RATE_WINDOW_DAYS } = {}) {
+ const from = isoOf(new Date(now - (days - 1) * DAY)), to = isoOf(new Date(now))
+ const pts = (Array.isArray(bodyweight) ? bodyweight : [])
+ .filter(b => b?.d && b.d >= from && b.d <= to && Number(b.w) > 0)
+ .map(b => ({ x: new Date(b.d + 'T12:00:00').getTime() / DAY, y: Number(b.w) }))
+ const n = pts.length
+ const span = n ? Math.max(...pts.map(p => p.x)) - Math.min(...pts.map(p => p.x)) : 0
+ if (n < RATE_MIN_WEIGHINS || span < RATE_MIN_SPAN_DAYS - 0.5) return { enough: false, n }
+ const mx = pts.reduce((s, p) => s + p.x, 0) / n, my = pts.reduce((s, p) => s + p.y, 0) / n
+ const slope = pts.reduce((s, p) => s + (p.x - mx) * (p.y - my), 0) / pts.reduce((s, p) => s + (p.x - mx) ** 2, 0)
+ const perWeek = slope * 7
+ return { enough: true, n, perWeek, pct: perWeek / my * 100, mean: my }
+}
+
+/**
+ * The corridor a profile aims its rate at (S.rateGoal): `dir` lose, gain or hold, `by` '%' (of
+ * body weight) or 'w' (the profile's unit), and `lo`/`hi` as sizes, never signed: "lose 0.5 to 1
+ * a week" is { dir: 'lose', lo: 0.5, hi: 1 }. Hold keeps within ±hi. Null when it makes no sense.
+ */
+export function rateCorridor(goal) {
+ if (!goal || !['lose', 'gain', 'hold'].includes(goal.dir)) return null
+ const lo = Math.abs(Number(goal.lo) || 0), hi = Math.abs(Number(goal.hi) || 0)
+ const [a, b] = lo <= hi ? [lo, hi] : [hi, lo]
+ if (!(b > 0)) return null
+ const by = goal.by === 'w' ? 'w' : '%'
+ if (goal.dir === 'hold') return { dir: 'hold', by, min: -b, max: b }
+ return goal.dir === 'lose' ? { dir: 'lose', by, min: -b, max: -a } : { dir: 'gain', by, min: a, max: b }
+}
+
+/**
+ * Where a rate sits against the corridor: 'in', 'fast' (losing or gaining harder than planned),
+ * 'slow', or for hold 'off' (drifting out either way). Null without a rate or a corridor.
+ */
+export function rateStatus(rate, goal) {
+ const c = rateCorridor(goal)
+ if (!c || !rate?.enough) return null
+ const v = c.by === 'w' ? rate.perWeek : rate.pct
+ // What the card shows is rounded to two decimals; the verdict goes by the same number.
+ const r = Math.round(v * 100) / 100
+ if (r >= c.min && r <= c.max) return 'in'
+ if (c.dir === 'hold') return 'off'
+ if (c.dir === 'lose') return r < c.min ? 'fast' : 'slow'
+ return r > c.max ? 'fast' : 'slow'
+}
diff --git a/frontend/src/lib/units.js b/frontend/src/lib/units.js
index 49b2db4af..9d827a920 100644
--- a/frontend/src/lib/units.js
+++ b/frontend/src/lib/units.js
@@ -97,6 +97,12 @@ export function convertStateUnit(S, to) {
const out = { ...S, unit: to }
if (Array.isArray(S.bodyweight)) out.bodyweight = S.bodyweight.map(b => ({ ...b, w: bw(b.w) }))
if (S.targetW != null) out.targetW = bw(S.targetW)
+ // A weekly-rate corridor in the profile's unit (#759) moves with it, to the hundredth: 0.25 kg a
+ // week is 0.55 lb, and a tenth would make it 0.6. One in percent of body weight holds no weight.
+ if (S.rateGoal && S.rateGoal.by === 'w') {
+ const r = v => Math.round((to === 'lb' ? Number(v) * LB_PER_KG : Number(v) / LB_PER_KG) * 100) / 100
+ out.rateGoal = { ...S.rateGoal, lo: r(S.rateGoal.lo || 0), hi: r(S.rateGoal.hi || 0) }
+ }
if (S.exWeights) out.exWeights = Object.fromEntries(Object.entries(S.exWeights).map(([k, v]) => [k, v && typeof v === 'object' ? { ...v, w: c(v.w) } : c(v)]))
if (S.barWeights) out.barWeights = convBarWeights(S.barWeights, from, to, S.barDefaults)
// The plate inventory (S.plates) is carried over as it is, not converted: it is kept per unit
diff --git a/frontend/src/locales/ar.js b/frontend/src/locales/ar.js
index 86c05d945..ea8b77f95 100644
--- a/frontend/src/locales/ar.js
+++ b/frontend/src/locales/ar.js
@@ -2553,4 +2553,25 @@ export default {
"No unit": "بدون وحدة",
"{0} measurement check-in imported": "تم استيراد {0} تسجيل قياسات",
"{0} measurement check-ins imported": "تم استيراد {0} تسجيلات قياسات",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "المعدل الأسبوعي",
+ "Trend {0} a week ({1})": "الاتجاه {0} أسبوعيًا ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "بضع قياسات وزن أخرى موزعة على الأيام القادمة وستحصل على اتجاه أسبوعي.",
+ "On pace": "على المسار",
+ "Slower than planned": "أبطأ من المخطط",
+ "Gaining faster than planned": "تزيد أسرع من المخطط",
+ "Losing faster than planned": "تخسر أسرع من المخطط",
+ "Outside your range": "خارج نطاقك",
+ "Enter a range first": "أدخل نطاقًا أولًا",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "الاتجاه عبر قياسات وزنك في آخر 3 أسابيع، فلا يحركه عشاء مالح واحد. حدد نطاقًا وستخبرك البطاقة إن كنت على المسار.",
+ "Lose": "خسارة",
+ "Gain": "زيادة",
+ "Hold": "ثبات",
+ "% of body weight": "% من وزن الجسم",
+ "Within ±": "ضمن ±",
+ "Hold within ±{0} a week.": "الثبات ضمن ±{0} أسبوعيًا.",
+ "Lose {0} to {1} a week.": "خسارة {0} إلى {1} أسبوعيًا.",
+ "Gain {0} to {1} a week.": "زيادة {0} إلى {1} أسبوعيًا.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "التنشيف غالبًا 0.5 إلى 1 % أسبوعيًا، والتضخيم النظيف 0.25 إلى 0.5 %.",
+ "Remove range": "إزالة النطاق",
}
diff --git a/frontend/src/locales/bn.js b/frontend/src/locales/bn.js
index 9aa56d411..170d55286 100644
--- a/frontend/src/locales/bn.js
+++ b/frontend/src/locales/bn.js
@@ -2577,4 +2577,25 @@ export default {
"No unit": "কোনো একক নেই",
"{0} measurement check-in imported": "{0}টি মাপের রেকর্ড ইমপোর্ট হয়েছে",
"{0} measurement check-ins imported": "{0}টি মাপের রেকর্ড ইমপোর্ট হয়েছে",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "সাপ্তাহিক হার",
+ "Trend {0} a week ({1})": "প্রবণতা সপ্তাহে {0} ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "আগামী কয়েক দিনে আরও কয়েকবার ওজন মাপুন, তাহলে সাপ্তাহিক প্রবণতা পাবেন।",
+ "On pace": "ঠিক গতিতে",
+ "Slower than planned": "পরিকল্পনার চেয়ে ধীর",
+ "Gaining faster than planned": "পরিকল্পনার চেয়ে দ্রুত বাড়ছে",
+ "Losing faster than planned": "পরিকল্পনার চেয়ে দ্রুত কমছে",
+ "Outside your range": "আপনার সীমার বাইরে",
+ "Enter a range first": "আগে একটি সীমা দিন",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "গত ৩ সপ্তাহের ওজন মাপার ভিত্তিতে প্রবণতা, তাই এক রাতের নোনতা খাবারে এটা নড়ে না। একটি সীমা দিন, কার্ড জানাবে আপনি ঠিক গতিতে আছেন কি না।",
+ "Lose": "কমানো",
+ "Gain": "বাড়ানো",
+ "Hold": "ধরে রাখা",
+ "% of body weight": "শরীরের ওজনের %",
+ "Within ±": "± এর মধ্যে",
+ "Hold within ±{0} a week.": "সপ্তাহে ±{0} এর মধ্যে ধরে রাখা।",
+ "Lose {0} to {1} a week.": "সপ্তাহে {0} থেকে {1} কমানো।",
+ "Gain {0} to {1} a week.": "সপ্তাহে {0} থেকে {1} বাড়ানো।",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "কাটিং সাধারণত সপ্তাহে ০.৫ থেকে ১ %, লিন বাল্ক ০.২৫ থেকে ০.৫ %।",
+ "Remove range": "সীমা সরান",
}
diff --git a/frontend/src/locales/de.js b/frontend/src/locales/de.js
index 81819d1c8..81e7cc639 100644
--- a/frontend/src/locales/de.js
+++ b/frontend/src/locales/de.js
@@ -2518,4 +2518,25 @@ export default {
"No unit": "Ohne Einheit",
"{0} measurement check-in imported": "{0} Messung importiert",
"{0} measurement check-ins imported": "{0} Messungen importiert",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Wochentempo",
+ "Trend {0} a week ({1})": "Trend {0} pro Woche ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Noch ein paar Wiegungen über die nächsten Tage verteilt, dann bekommst du ein Wochentempo.",
+ "On pace": "Im Plan",
+ "Slower than planned": "Langsamer als geplant",
+ "Gaining faster than planned": "Nimmst schneller zu als geplant",
+ "Losing faster than planned": "Nimmst schneller ab als geplant",
+ "Outside your range": "Außerhalb deines Bereichs",
+ "Enter a range first": "Gib zuerst einen Bereich ein",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "Der Trend durch deine Wiegungen der letzten 3 Wochen, also bringt ihn ein salziges Abendessen nicht aus der Ruhe. Gib ihm einen Bereich, und die Karte sagt dir, ob du im Plan bist.",
+ "Lose": "Abnehmen",
+ "Gain": "Zunehmen",
+ "Hold": "Halten",
+ "% of body weight": "% des Körpergewichts",
+ "Within ±": "Innerhalb ±",
+ "Hold within ±{0} a week.": "Halte dich innerhalb von ±{0} pro Woche.",
+ "Lose {0} to {1} a week.": "{0} bis {1} pro Woche abnehmen.",
+ "Gain {0} to {1} a week.": "{0} bis {1} pro Woche zunehmen.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Eine Diät liegt oft bei 0,5 bis 1 % pro Woche, ein sauberer Aufbau bei 0,25 bis 0,5 %.",
+ "Remove range": "Bereich entfernen",
}
diff --git a/frontend/src/locales/es.js b/frontend/src/locales/es.js
index bef22e7fb..110768585 100644
--- a/frontend/src/locales/es.js
+++ b/frontend/src/locales/es.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "Sin unidad",
"{0} measurement check-in imported": "{0} registro de medidas importado",
"{0} measurement check-ins imported": "{0} registros de medidas importados",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Ritmo semanal",
+ "Trend {0} a week ({1})": "Tendencia de {0} por semana ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Unos cuantos pesajes más repartidos en los próximos días y tendrás una tendencia semanal.",
+ "On pace": "A buen ritmo",
+ "Slower than planned": "Más lento de lo previsto",
+ "Gaining faster than planned": "Subiendo más rápido de lo previsto",
+ "Losing faster than planned": "Bajando más rápido de lo previsto",
+ "Outside your range": "Fuera de tu rango",
+ "Enter a range first": "Primero indica un rango",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "La tendencia de tus pesajes de las últimas 3 semanas, así que una cena salada no la mueve. Dale un rango y la tarjeta te dice si vas a buen ritmo.",
+ "Lose": "Bajar",
+ "Gain": "Subir",
+ "Hold": "Mantener",
+ "% of body weight": "% del peso corporal",
+ "Within ±": "Dentro de ±",
+ "Hold within ±{0} a week.": "Mantener dentro de ±{0} por semana.",
+ "Lose {0} to {1} a week.": "Bajar de {0} a {1} por semana.",
+ "Gain {0} to {1} a week.": "Subir de {0} a {1} por semana.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Una definición suele ir de 0,5 a 1 % por semana, un volumen limpio de 0,25 a 0,5 %.",
+ "Remove range": "Quitar rango",
}
diff --git a/frontend/src/locales/fr.js b/frontend/src/locales/fr.js
index bcd658838..d33708389 100644
--- a/frontend/src/locales/fr.js
+++ b/frontend/src/locales/fr.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "Sans unité",
"{0} measurement check-in imported": "{0} relevé de mensurations importé",
"{0} measurement check-ins imported": "{0} relevés de mensurations importés",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Rythme hebdo",
+ "Trend {0} a week ({1})": "Tendance {0} par semaine ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Encore quelques pesées sur les prochains jours et tu auras une tendance hebdo.",
+ "On pace": "Dans le rythme",
+ "Slower than planned": "Plus lent que prévu",
+ "Gaining faster than planned": "Tu prends plus vite que prévu",
+ "Losing faster than planned": "Tu perds plus vite que prévu",
+ "Outside your range": "Hors de ta fourchette",
+ "Enter a range first": "Indique d’abord une fourchette",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "La tendance de tes pesées des 3 dernières semaines, donc un dîner bien salé ne la fait pas bouger. Donne-lui une fourchette et la carte te dit si tu es dans le rythme.",
+ "Lose": "Perdre",
+ "Gain": "Prendre",
+ "Hold": "Maintenir",
+ "% of body weight": "% du poids",
+ "Within ±": "À ± près",
+ "Hold within ±{0} a week.": "Rester à ±{0} près par semaine.",
+ "Lose {0} to {1} a week.": "Perdre de {0} à {1} par semaine.",
+ "Gain {0} to {1} a week.": "Prendre de {0} à {1} par semaine.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Une sèche, c’est souvent 0,5 à 1 % par semaine, une prise de masse propre 0,25 à 0,5 %.",
+ "Remove range": "Retirer la fourchette",
}
diff --git a/frontend/src/locales/hi.js b/frontend/src/locales/hi.js
index ab297dc31..fbabaf016 100644
--- a/frontend/src/locales/hi.js
+++ b/frontend/src/locales/hi.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "कोई इकाई नहीं",
"{0} measurement check-in imported": "{0} माप रिकॉर्ड आयात हुआ",
"{0} measurement check-ins imported": "{0} माप रिकॉर्ड आयात हुए",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "साप्ताहिक दर",
+ "Trend {0} a week ({1})": "रुझान {0} प्रति सप्ताह ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "अगले कुछ दिनों में कुछ और बार वज़न लें, फिर आपको साप्ताहिक रुझान मिलेगा।",
+ "On pace": "सही रफ़्तार पर",
+ "Slower than planned": "योजना से धीमा",
+ "Gaining faster than planned": "योजना से तेज़ बढ़ रहा है",
+ "Losing faster than planned": "योजना से तेज़ घट रहा है",
+ "Outside your range": "आपकी सीमा से बाहर",
+ "Enter a range first": "पहले एक सीमा डालें",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "पिछले 3 हफ़्तों के आपके वज़न से निकला रुझान, इसलिए एक नमकीन डिनर से यह नहीं हिलता। एक सीमा दें और कार्ड बताएगा कि आप सही रफ़्तार पर हैं या नहीं।",
+ "Lose": "घटाना",
+ "Gain": "बढ़ाना",
+ "Hold": "बनाए रखना",
+ "% of body weight": "शरीर के वज़न का %",
+ "Within ±": "± के भीतर",
+ "Hold within ±{0} a week.": "हर हफ़्ते ±{0} के भीतर बनाए रखना।",
+ "Lose {0} to {1} a week.": "हर हफ़्ते {0} से {1} घटाना।",
+ "Gain {0} to {1} a week.": "हर हफ़्ते {0} से {1} बढ़ाना।",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "कटिंग अक्सर हर हफ़्ते 0.5 से 1 % होती है, लीन बल्क 0.25 से 0.5 %।",
+ "Remove range": "सीमा हटाएँ",
}
diff --git a/frontend/src/locales/hu.js b/frontend/src/locales/hu.js
index 1541e76ee..cbe3a2b74 100644
--- a/frontend/src/locales/hu.js
+++ b/frontend/src/locales/hu.js
@@ -2501,4 +2501,25 @@ export default {
"No unit": "Nincs mértékegység",
"{0} measurement check-in imported": "{0} méretfelvétel importálva",
"{0} measurement check-ins imported": "{0} méretfelvétel importálva",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Heti tempó",
+ "Trend {0} a week ({1})": "Trend: heti {0} ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Még néhány mérés a következő napokban, és kapsz egy heti trendet.",
+ "On pace": "Jó ütemben",
+ "Slower than planned": "Lassabb a tervezettnél",
+ "Gaining faster than planned": "Gyorsabban hízol a tervezettnél",
+ "Losing faster than planned": "Gyorsabban fogysz a tervezettnél",
+ "Outside your range": "A tartományodon kívül",
+ "Enter a range first": "Előbb adj meg egy tartományt",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "Az utolsó 3 hét méréseidből számolt trend, így egy sós vacsora nem mozdítja el. Adj meg egy tartományt, és a kártya megmondja, jó ütemben haladsz-e.",
+ "Lose": "Fogyás",
+ "Gain": "Hízás",
+ "Hold": "Tartás",
+ "% of body weight": "a testsúly %-a",
+ "Within ±": "± határon belül",
+ "Hold within ±{0} a week.": "Heti ±{0} határon belül tartani.",
+ "Lose {0} to {1} a week.": "Heti {0}–{1} fogyás.",
+ "Gain {0} to {1} a week.": "Heti {0}–{1} hízás.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Szálkásításnál gyakran heti 0,5–1 %, tiszta tömegnövelésnél 0,25–0,5 %.",
+ "Remove range": "Tartomány törlése",
}
diff --git a/frontend/src/locales/it.js b/frontend/src/locales/it.js
index ae3db7bde..4562817ca 100644
--- a/frontend/src/locales/it.js
+++ b/frontend/src/locales/it.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "Senza unità",
"{0} measurement check-in imported": "{0} rilevazione di misure importata",
"{0} measurement check-ins imported": "{0} rilevazioni di misure importate",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Ritmo settimanale",
+ "Trend {0} a week ({1})": "Tendenza {0} a settimana ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Ancora qualche pesata nei prossimi giorni e avrai una tendenza settimanale.",
+ "On pace": "In linea",
+ "Slower than planned": "Più lento del previsto",
+ "Gaining faster than planned": "Stai aumentando più in fretta del previsto",
+ "Losing faster than planned": "Stai calando più in fretta del previsto",
+ "Outside your range": "Fuori dal tuo intervallo",
+ "Enter a range first": "Prima inserisci un intervallo",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "La tendenza delle tue pesate delle ultime 3 settimane, quindi una cena salata non la sposta. Dagli un intervallo e la scheda ti dice se sei in linea.",
+ "Lose": "Calare",
+ "Gain": "Aumentare",
+ "Hold": "Mantenere",
+ "% of body weight": "% del peso corporeo",
+ "Within ±": "Entro ±",
+ "Hold within ±{0} a week.": "Restare entro ±{0} a settimana.",
+ "Lose {0} to {1} a week.": "Calare da {0} a {1} a settimana.",
+ "Gain {0} to {1} a week.": "Aumentare da {0} a {1} a settimana.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Una definizione è spesso 0,5-1 % a settimana, una massa pulita 0,25-0,5 %.",
+ "Remove range": "Rimuovi intervallo",
}
diff --git a/frontend/src/locales/ko.js b/frontend/src/locales/ko.js
index 1e384cb31..a6a3ac37f 100644
--- a/frontend/src/locales/ko.js
+++ b/frontend/src/locales/ko.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "단위 없음",
"{0} measurement check-in imported": "측정 기록 {0}개를 가져왔습니다",
"{0} measurement check-ins imported": "측정 기록 {0}개를 가져왔습니다",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "주간 변화율",
+ "Trend {0} a week ({1})": "추세 주당 {0} ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "앞으로 며칠에 걸쳐 몇 번 더 체중을 재면 주간 추세를 볼 수 있어요.",
+ "On pace": "순조로워요",
+ "Slower than planned": "계획보다 느려요",
+ "Gaining faster than planned": "계획보다 빨리 늘고 있어요",
+ "Losing faster than planned": "계획보다 빨리 빠지고 있어요",
+ "Outside your range": "범위를 벗어났어요",
+ "Enter a range first": "먼저 범위를 입력하세요",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "최근 3주 동안의 체중 기록으로 본 추세라서, 짠 저녁 한 끼로는 흔들리지 않아요. 범위를 정하면 카드가 순조로운지 알려 줘요.",
+ "Lose": "감량",
+ "Gain": "증량",
+ "Hold": "유지",
+ "% of body weight": "체중의 %",
+ "Within ±": "± 범위",
+ "Hold within ±{0} a week.": "주당 ±{0} 이내로 유지.",
+ "Lose {0} to {1} a week.": "주당 {0}~{1} 감량.",
+ "Gain {0} to {1} a week.": "주당 {0}~{1} 증량.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "감량기는 보통 주당 0.5~1 %, 린 벌크는 0.25~0.5 % 정도예요.",
+ "Remove range": "범위 삭제",
}
diff --git a/frontend/src/locales/pl.js b/frontend/src/locales/pl.js
index cc0365d84..51ded9be8 100644
--- a/frontend/src/locales/pl.js
+++ b/frontend/src/locales/pl.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "Bez jednostki",
"{0} measurement check-in imported": "Zaimportowano {0} pomiar",
"{0} measurement check-ins imported": {"one":"Zaimportowano {0} pomiar","few":"Zaimportowano {0} pomiary","many":"Zaimportowano {0} pomiarów","other":"Zaimportowano {0} pomiaru"},
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Tempo tygodniowe",
+ "Trend {0} a week ({1})": "Trend {0} tygodniowo ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Jeszcze kilka ważeń w ciągu najbliższych dni i zobaczysz tygodniowy trend.",
+ "On pace": "W tempie",
+ "Slower than planned": "Wolniej niż w planie",
+ "Gaining faster than planned": "Przybierasz szybciej niż w planie",
+ "Losing faster than planned": "Chudniesz szybciej niż w planie",
+ "Outside your range": "Poza twoim zakresem",
+ "Enter a range first": "Najpierw podaj zakres",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "Trend z twoich ważeń z ostatnich 3 tygodni, więc jedna słona kolacja go nie ruszy. Podaj zakres, a karta powie ci, czy jesteś w tempie.",
+ "Lose": "Chudnięcie",
+ "Gain": "Przybranie",
+ "Hold": "Utrzymanie",
+ "% of body weight": "% masy ciała",
+ "Within ±": "W granicach ±",
+ "Hold within ±{0} a week.": "Utrzymać się w granicach ±{0} tygodniowo.",
+ "Lose {0} to {1} a week.": "Chudnąć od {0} do {1} tygodniowo.",
+ "Gain {0} to {1} a week.": "Przybierać od {0} do {1} tygodniowo.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Redukcja to często 0,5 do 1 % tygodniowo, czysta masa 0,25 do 0,5 %.",
+ "Remove range": "Usuń zakres",
}
diff --git a/frontend/src/locales/pt-BR.js b/frontend/src/locales/pt-BR.js
index f42a00864..3b2f39eb8 100644
--- a/frontend/src/locales/pt-BR.js
+++ b/frontend/src/locales/pt-BR.js
@@ -1604,6 +1604,27 @@ export const PT_BR_OVERRIDES = {
"No unit": "Sem unidade",
"{0} measurement check-in imported": "{0} registro de medidas importado",
"{0} measurement check-ins imported": "{0} registros de medidas importados",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Ritmo semanal",
+ "Trend {0} a week ({1})": "Tendência de {0} por semana ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Mais algumas pesagens ao longo dos próximos dias e você ganha uma tendência semanal.",
+ "On pace": "No ritmo",
+ "Slower than planned": "Mais devagar que o planejado",
+ "Gaining faster than planned": "Ganhando mais rápido que o planejado",
+ "Losing faster than planned": "Perdendo mais rápido que o planejado",
+ "Outside your range": "Fora da sua faixa",
+ "Enter a range first": "Informe uma faixa primeiro",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "A tendência das suas pesagens das últimas 3 semanas, então um jantar salgado não mexe nela. Dê uma faixa e o cartão diz se você está no ritmo.",
+ "Lose": "Perder",
+ "Gain": "Ganhar",
+ "Hold": "Manter",
+ "% of body weight": "% do peso corporal",
+ "Within ±": "Dentro de ±",
+ "Hold within ±{0} a week.": "Manter dentro de ±{0} por semana.",
+ "Lose {0} to {1} a week.": "Perder de {0} a {1} por semana.",
+ "Gain {0} to {1} a week.": "Ganhar de {0} a {1} por semana.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Um cutting costuma ficar em 0,5 a 1 % por semana, um bulking limpo em 0,25 a 0,5 %.",
+ "Remove range": "Remover faixa",
}
export default { ...pt, ...PT_BR_OVERRIDES }
diff --git a/frontend/src/locales/pt.js b/frontend/src/locales/pt.js
index c442286bb..125442c02 100644
--- a/frontend/src/locales/pt.js
+++ b/frontend/src/locales/pt.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "Sem unidade",
"{0} measurement check-in imported": "{0} registo de medidas importado",
"{0} measurement check-ins imported": "{0} registos de medidas importados",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Ritmo semanal",
+ "Trend {0} a week ({1})": "Tendência de {0} por semana ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Mais algumas pesagens ao longo dos próximos dias e ficas com uma tendência semanal.",
+ "On pace": "No ritmo",
+ "Slower than planned": "Mais devagar do que o previsto",
+ "Gaining faster than planned": "A ganhar mais depressa do que o previsto",
+ "Losing faster than planned": "A perder mais depressa do que o previsto",
+ "Outside your range": "Fora do teu intervalo",
+ "Enter a range first": "Indica primeiro um intervalo",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "A tendência das tuas pesagens das últimas 3 semanas, por isso um jantar salgado não a mexe. Dá-lhe um intervalo e o cartão diz-te se estás no ritmo.",
+ "Lose": "Perder",
+ "Gain": "Ganhar",
+ "Hold": "Manter",
+ "% of body weight": "% do peso corporal",
+ "Within ±": "Dentro de ±",
+ "Hold within ±{0} a week.": "Manter dentro de ±{0} por semana.",
+ "Lose {0} to {1} a week.": "Perder de {0} a {1} por semana.",
+ "Gain {0} to {1} a week.": "Ganhar de {0} a {1} por semana.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Uma fase de definição anda muitas vezes nos 0,5 a 1 % por semana, um bulk limpo nos 0,25 a 0,5 %.",
+ "Remove range": "Remover intervalo",
}
diff --git a/frontend/src/locales/ru.js b/frontend/src/locales/ru.js
index a6d79d746..43584f92e 100644
--- a/frontend/src/locales/ru.js
+++ b/frontend/src/locales/ru.js
@@ -2502,4 +2502,25 @@ export default {
"No unit": "Без единицы",
"{0} measurement check-in imported": "Импортирован {0} замер",
"{0} measurement check-ins imported": {"one":"Импортирован {0} замер","few":"Импортировано {0} замера","many":"Импортировано {0} замеров","other":"Импортировано {0} замера"},
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Темп в неделю",
+ "Trend {0} a week ({1})": "Тренд {0} в неделю ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Ещё несколько взвешиваний в ближайшие дни, и вы увидите недельный тренд.",
+ "On pace": "В темпе",
+ "Slower than planned": "Медленнее, чем планировалось",
+ "Gaining faster than planned": "Набираете быстрее, чем планировалось",
+ "Losing faster than planned": "Худеете быстрее, чем планировалось",
+ "Outside your range": "Вне вашего диапазона",
+ "Enter a range first": "Сначала укажите диапазон",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "Тренд по вашим взвешиваниям за последние 3 недели, так что один солёный ужин его не сдвинет. Задайте диапазон, и карточка подскажет, идёте ли вы в темпе.",
+ "Lose": "Сбросить",
+ "Gain": "Набрать",
+ "Hold": "Держать",
+ "% of body weight": "% веса тела",
+ "Within ±": "В пределах ±",
+ "Hold within ±{0} a week.": "Держаться в пределах ±{0} в неделю.",
+ "Lose {0} to {1} a week.": "Сбрасывать от {0} до {1} в неделю.",
+ "Gain {0} to {1} a week.": "Набирать от {0} до {1} в неделю.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Сушка обычно идёт по 0,5–1 % в неделю, чистый набор по 0,25–0,5 %.",
+ "Remove range": "Убрать диапазон",
}
diff --git a/frontend/src/locales/th.js b/frontend/src/locales/th.js
index 43953ced0..9bcba155f 100644
--- a/frontend/src/locales/th.js
+++ b/frontend/src/locales/th.js
@@ -2509,4 +2509,25 @@ export default {
"No unit": "ไม่มีหน่วย",
"{0} measurement check-in imported": "นำเข้าบันทึกสัดส่วน {0} รายการแล้ว",
"{0} measurement check-ins imported": "นำเข้าบันทึกสัดส่วน {0} รายการแล้ว",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "อัตราต่อสัปดาห์",
+ "Trend {0} a week ({1})": "แนวโน้ม {0} ต่อสัปดาห์ ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "ชั่งน้ำหนักอีกสักสองสามครั้งในวันถัดๆ ไป แล้วจะเห็นแนวโน้มรายสัปดาห์",
+ "On pace": "ตามเป้า",
+ "Slower than planned": "ช้ากว่าที่วางไว้",
+ "Gaining faster than planned": "เพิ่มเร็วกว่าที่วางไว้",
+ "Losing faster than planned": "ลดเร็วกว่าที่วางไว้",
+ "Outside your range": "อยู่นอกช่วงของคุณ",
+ "Enter a range first": "ใส่ช่วงก่อน",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "แนวโน้มจากการชั่งน้ำหนักของคุณใน 3 สัปดาห์ล่าสุด มื้อเย็นเค็มๆ มื้อเดียวจึงไม่ทำให้มันขยับ ตั้งช่วงไว้ แล้วการ์ดจะบอกว่าคุณตามเป้าหรือไม่",
+ "Lose": "ลด",
+ "Gain": "เพิ่ม",
+ "Hold": "คงที่",
+ "% of body weight": "% ของน้ำหนักตัว",
+ "Within ±": "ภายใน ±",
+ "Hold within ±{0} a week.": "คงไว้ภายใน ±{0} ต่อสัปดาห์",
+ "Lose {0} to {1} a week.": "ลด {0} ถึง {1} ต่อสัปดาห์",
+ "Gain {0} to {1} a week.": "เพิ่ม {0} ถึง {1} ต่อสัปดาห์",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "ช่วงลดไขมันมักอยู่ที่ 0.5 ถึง 1 % ต่อสัปดาห์ ช่วงเพิ่มกล้ามแบบลีนอยู่ที่ 0.25 ถึง 0.5 %",
+ "Remove range": "ลบช่วง",
}
diff --git a/frontend/src/locales/tr.js b/frontend/src/locales/tr.js
index 95d225858..8a6a70471 100644
--- a/frontend/src/locales/tr.js
+++ b/frontend/src/locales/tr.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "Birimsiz",
"{0} measurement check-in imported": "{0} ölçüm kaydı içe aktarıldı",
"{0} measurement check-ins imported": "{0} ölçüm kaydı içe aktarıldı",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Haftalık hız",
+ "Trend {0} a week ({1})": "Eğilim haftada {0} ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Önümüzdeki günlere yayılmış birkaç tartım daha, sonra haftalık eğilimin hazır.",
+ "On pace": "Hedefte",
+ "Slower than planned": "Plandan yavaş",
+ "Gaining faster than planned": "Plandan hızlı alıyorsun",
+ "Losing faster than planned": "Plandan hızlı veriyorsun",
+ "Outside your range": "Aralığının dışında",
+ "Enter a range first": "Önce bir aralık gir",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "Son 3 haftadaki tartımlarından çıkan eğilim, yani tek bir tuzlu akşam yemeği onu oynatmaz. Bir aralık ver, kart hedefte olup olmadığını söylesin.",
+ "Lose": "Ver",
+ "Gain": "Al",
+ "Hold": "Koru",
+ "% of body weight": "Vücut ağırlığının %'si",
+ "Within ±": "± içinde",
+ "Hold within ±{0} a week.": "Haftada ±{0} içinde kal.",
+ "Lose {0} to {1} a week.": "Haftada {0} ile {1} arası ver.",
+ "Gain {0} to {1} a week.": "Haftada {0} ile {1} arası al.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Yağ yakımı genelde haftada %0,5 ile %1, temiz bulk %0,25 ile %0,5 arasıdır.",
+ "Remove range": "Aralığı kaldır",
}
diff --git a/frontend/src/locales/uk.js b/frontend/src/locales/uk.js
index 8d242761b..4d2f787b1 100644
--- a/frontend/src/locales/uk.js
+++ b/frontend/src/locales/uk.js
@@ -2495,4 +2495,25 @@ export default {
"No unit": "Без одиниці",
"{0} measurement check-in imported": "Імпортовано {0} вимір",
"{0} measurement check-ins imported": {"one":"Імпортовано {0} вимір","few":"Імпортовано {0} виміри","many":"Імпортовано {0} вимірів","other":"Імпортовано {0} виміру"},
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "Тижневий темп",
+ "Trend {0} a week ({1})": "Тренд {0} на тиждень ({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "Ще кілька зважувань упродовж наступних днів, і ти побачиш тижневий тренд.",
+ "On pace": "У темпі",
+ "Slower than planned": "Повільніше, ніж планувалося",
+ "Gaining faster than planned": "Набираєш швидше, ніж планувалося",
+ "Losing faster than planned": "Худнеш швидше, ніж планувалося",
+ "Outside your range": "Поза твоїм діапазоном",
+ "Enter a range first": "Спершу введи діапазон",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "Тренд за твоїми зважуваннями останніх 3 тижнів, тож одна солона вечеря його не зрушить. Задай діапазон, і картка скаже, чи ти в темпі.",
+ "Lose": "Схуднути",
+ "Gain": "Набрати",
+ "Hold": "Тримати",
+ "% of body weight": "% ваги тіла",
+ "Within ±": "У межах ±",
+ "Hold within ±{0} a week.": "Триматися в межах ±{0} на тиждень.",
+ "Lose {0} to {1} a week.": "Худнути на {0}–{1} на тиждень.",
+ "Gain {0} to {1} a week.": "Набирати {0}–{1} на тиждень.",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "Сушка часто йде по 0,5–1 % на тиждень, чистий набір по 0,25–0,5 %.",
+ "Remove range": "Прибрати діапазон",
}
diff --git a/frontend/src/locales/zh-TW.js b/frontend/src/locales/zh-TW.js
index 49d87e5ce..bfbad824f 100644
--- a/frontend/src/locales/zh-TW.js
+++ b/frontend/src/locales/zh-TW.js
@@ -2491,4 +2491,25 @@ export default {
"No unit": "無單位",
"{0} measurement check-in imported": "已匯入 {0} 筆身體測量紀錄",
"{0} measurement check-ins imported": "已匯入 {0} 筆身體測量紀錄",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "每週變化",
+ "Trend {0} a week ({1})": "趨勢 每週 {0}({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "接下來幾天再量幾次,就能看到每週趨勢。",
+ "On pace": "節奏剛好",
+ "Slower than planned": "比計畫慢",
+ "Gaining faster than planned": "增重比計畫快",
+ "Losing faster than planned": "減重比計畫快",
+ "Outside your range": "超出你的範圍",
+ "Enter a range first": "請先輸入範圍",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "根據你最近 3 週的體重紀錄算出的趨勢,一頓鹹的晚餐動不了它。設個範圍,卡片會告訴你節奏對不對。",
+ "Lose": "減重",
+ "Gain": "增重",
+ "Hold": "維持",
+ "% of body weight": "體重的 %",
+ "Within ±": "± 以內",
+ "Hold within ±{0} a week.": "每週維持在 ±{0} 以內。",
+ "Lose {0} to {1} a week.": "每週減 {0} 到 {1}。",
+ "Gain {0} to {1} a week.": "每週增 {0} 到 {1}。",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "減脂期通常每週 0.5 到 1 %,乾淨增肌每週 0.25 到 0.5 %。",
+ "Remove range": "移除範圍",
}
diff --git a/frontend/src/locales/zh.js b/frontend/src/locales/zh.js
index b8332368d..b66abad76 100644
--- a/frontend/src/locales/zh.js
+++ b/frontend/src/locales/zh.js
@@ -2498,4 +2498,25 @@ export default {
"No unit": "无单位",
"{0} measurement check-in imported": "已导入 {0} 条身体测量记录",
"{0} measurement check-ins imported": "已导入 {0} 条身体测量记录",
+ // --- weekly rate and corridor (#759) ---
+ "Weekly rate": "每周变化",
+ "Trend {0} a week ({1})": "趋势 每周 {0}({1})",
+ "A few more weigh-ins, spread over the next days, and you get a weekly trend.": "接下来几天再称几次,就能看到每周趋势。",
+ "On pace": "节奏正好",
+ "Slower than planned": "比计划慢",
+ "Gaining faster than planned": "增重比计划快",
+ "Losing faster than planned": "减重比计划快",
+ "Outside your range": "超出你的范围",
+ "Enter a range first": "请先输入范围",
+ "The trend through your weigh-ins of the last 3 weeks, so one salty dinner does not move it. Give it a range and the card tells you whether you are on pace.": "根据你最近 3 周的称重算出的趋势,一顿咸的晚饭动不了它。设个范围,卡片会告诉你节奏对不对。",
+ "Lose": "减重",
+ "Gain": "增重",
+ "Hold": "保持",
+ "% of body weight": "体重的 %",
+ "Within ±": "± 以内",
+ "Hold within ±{0} a week.": "每周保持在 ±{0} 以内。",
+ "Lose {0} to {1} a week.": "每周减 {0} 到 {1}。",
+ "Gain {0} to {1} a week.": "每周增 {0} 到 {1}。",
+ "A cut is often 0.5 to 1 % a week, a lean bulk 0.25 to 0.5 %.": "减脂期通常每周 0.5 到 1 %,干净增肌每周 0.25 到 0.5 %。",
+ "Remove range": "移除范围",
}
diff --git a/frontend/src/store/useStore.js b/frontend/src/store/useStore.js
index b67016ec5..0dbade684 100644
--- a/frontend/src/store/useStore.js
+++ b/frontend/src/store/useStore.js
@@ -89,6 +89,8 @@ const gainedWorkoutMedia = (prev, next) => {
export const DEF = {
unit: 'kg', restSec: 90, restPauseSec: 15, sound: true, soundOnSilent: false, vibrateOnSilent: false, timerFlash: false, timedSetOvertime: false, keepAwake: true, lang: 'en',
theme: 'dark', accent: 'lime', body: 'male', targetW: null,
+ // The weekly-rate corridor on the body-weight card (#759, lib/bodyweight.js rateCorridor).
+ rateGoal: null,
bodyweight: [], routines: [], week: {}, dayPlan: {},
// A note per day off (#261): { [iso]: { tag, text, _ts } } (lib/day-notes.js). A noted day is
// excused from the missed-day nudge; each day merges on its own stamp (lib/sync-merge.js).
diff --git a/frontend/src/views/Home.jsx b/frontend/src/views/Home.jsx
index 06ff12c22..164da0102 100644
--- a/frontend/src/views/Home.jsx
+++ b/frontend/src/views/Home.jsx
@@ -17,6 +17,7 @@ import { tappable } from '../lib/use-sheet-keyboard.js'
import { glyphOf } from '../lib/glyphs.js'
import { dayNoteOf } from '../lib/day-notes.js'
import { weighInAt } from '../lib/bodyweight.js'
+import WeightRate from '../components/WeightRate.jsx'
// Home = what to do now + a quick glance. Deep charts & history live in Stats.
export default function Home() {
@@ -216,6 +217,8 @@ export default function Home() {
</div>
)}
<div className="chart" style={{ marginTop: 8 }}><LineChart points={bwPoints} h={130} unit={S.unit} goal={S.targetW} /></div>
+ {/* the weekly rate and, with one set, how it sits in its corridor (#759) */}
+ <WeightRate S={S} />
{/* 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>
diff --git a/frontend/src/views/Stats.jsx b/frontend/src/views/Stats.jsx
index da080ecf4..dd91e3912 100644
--- a/frontend/src/views/Stats.jsx
+++ b/frontend/src/views/Stats.jsx
@@ -9,6 +9,7 @@ import { speedUnitOf, speedLabel, toSpeed } from '../lib/speed.js'
import { t, exerciseNameFor, exerciseNameClass, getLang } from '../lib/i18n.js'
import { bwSheet, goalSheet, calendarSheet, dayOverrideSheet, workoutDetailSheet, exerciseHistorySheet, WorkoutRow, bwDeltaColor, weighInsSheet } from '../sheets.jsx'
import LineChart from '../components/LineChart.jsx'
+import WeightRate from '../components/WeightRate.jsx'
import Heatmap from '../components/Heatmap.jsx'
import Icon from '../components/Icon.jsx'
import { reportSheet } from '../components/ReportSheet.jsx'
@@ -757,6 +758,8 @@ export default function Stats() {
<Segmented className="seg-range" value={range} onChange={setRange}
options={rangeOptions()} />
<div className="chart"><LineChart points={bwPts} h={160} unit={S.unit} goal={S.targetW} /></div>
+ {/* the weekly rate and, with one set, how it sits in its corridor (#759) */}
+ {S.bodyweight.length > 0 && <WeightRate S={S} />}
{/* 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>