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
Coach: the plan card's week strip starts on the day the week is set to start on
Duarte Santosf5ba17048fb5
diff --git a/frontend/src/views/CoachChat.jsx b/frontend/src/views/CoachChat.jsxindex 6fda295bd..f1aafe166 100644--- a/frontend/src/views/CoachChat.jsx+++ b/frontend/src/views/CoachChat.jsx@@ -17,7 +17,7 @@ import { useNavigate } from 'react-router-dom'import { useStore } from '../store/useStore.js'import { useUI } from '../store/useUI.js'import { t } from '../lib/i18n.js'-import { fmtDate, fmtNum, DAYS } from '../lib/format.js'+import { fmtDate, fmtNum, DAYS, weekOrder, weekStartOf } from '../lib/format.js'import { exLine } from '../lib/history.js'import { speedUnitOf } from '../lib/speed.js'import { DEMO } from '../lib/demo.js'@@ -334,7 +334,7 @@ function PlanCard({ p, S, update, toast, nav, refresh }) {{!!b.basedOn && <p className="pcard-sum" style={{ fontSize: 13 }}>{b.basedOn}</p>}</div>- <WeekStrip days={weekDays} />+ <WeekStrip days={weekDays} ws={weekStartOf(S)} />{b.routines.length > 1 && <div className="pcard-tabs">{b.routines.map((x, i) => <button key={x.id || i} className={'pcard-tab' + (i === tab ? ' on' : '')} onClick={() => setTab(i)}><Icon name={glyphOf(x.emoji)} />{x.name}</button>)}@@ -356,8 +356,9 @@ function PlanCard({ p, S, update, toast, nav, refresh }) {</div>}-const WeekStrip = ({ days }) => <div className="pcard-week">- {[1, 2, 3, 4, 5, 6, 0].map(d => <div key={d} className={'pcard-wd' + (days.has(d) ? ' on' : '')}>{t(DAYS[d])}</div>)}+// In the order the week is set to start on (Settings), like the Plan's own week.+const WeekStrip = ({ days, ws }) => <div className="pcard-week">+ {weekOrder(ws).map(d => <div key={d} className={'pcard-wd' + (days.has(d) ? ' on' : '')}>{t(DAYS[d])}</div>)}</div>const RoutineBlock = ({ r, unit, speedUnit }) => <div className="pcard-rt">@@ -634,7 +635,7 @@ function ProposalDetail({ entry, S }) {</>}{kind === 'create' && b && <>- <WeekStrip days={weekDays} />+ <WeekStrip days={weekDays} ws={weekStartOf(S)} />{b.routines.length > 1 && <div className="pcard-tabs" style={{ paddingInline: 0 }}>{b.routines.map((x, i) => <button key={x.id || i} className={'pcard-tab' + (i === tab ? ' on' : '')} onClick={() => setTab(i)}><Icon name={glyphOf(x.emoji)} />{x.name}</button>)}</div>}diff --git a/frontend/src/views/CoachChat.test.jsx b/frontend/src/views/CoachChat.test.jsxindex f1d19586d..0a19d4743 100644--- a/frontend/src/views/CoachChat.test.jsx+++ b/frontend/src/views/CoachChat.test.jsx@@ -212,6 +212,16 @@ describe('the Coach chat', () => {expect(mocks.S.coach.chat.at(-1).ref).toBe(mocks.S.coach.log.at(-1).id)})+ it('lays the plan’s week out from the day the week is set to start on', async () => {+ const days = () => [...container.querySelectorAll('.pcard-wd')].map(d => d.textContent)+ await mount({ id: 'p1', kind: 'create', bundle: bundle({ 0: 'x1', 1: 'x2' }) })+ expect(days()).toEqual(['Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'])+ const sunday = state(); sunday.weekStart = 0+ await mount({ id: 'p1', kind: 'create', bundle: bundle({ 0: 'x1', 1: 'x2' }) }, null, { S: sunday })+ expect(days()).toEqual(['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'])+ expect([...container.querySelectorAll('.pcard-wd.on')].map(d => d.textContent)).toEqual(['Su', 'Mo'])+ })+it('offers the quick actions only when nothing is running', async () => {await mount(null)expect(byText(/Review my training/)).toBeTruthy()