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.

Plan: the Coach gets its own button in the header instead of hiding in the share menu

Duarte Santos56b7d94a3415
diff --git a/frontend/src/index.css b/frontend/src/index.css
index bf9fbbd9e..875f25be3 100644
--- a/frontend/src/index.css
+++ b/frontend/src/index.css
@@ -234,6 +234,7 @@ button.conn:active{filter:brightness(1.12)}
a box this tight, and that is what turned "Упражнения" into "Упра / жнен / ия". */
.hdr>div{min-width:0}
.hdr>.btn{flex:none}
+.hdr>.hdr-actions{display:flex;align-items:center;gap:8px;flex:none}
.hdr h1{font-size:34px;line-height:1.06;font-weight:700;letter-spacing:-.028em;overflow-wrap:break-word}
@media (max-width:420px){.hdr h1{font-size:30px}}
.hdr .sub{color:var(--label-2);font-size:15px;letter-spacing:-.006em;margin-top:4px}
diff --git a/frontend/src/views/Plan.day-rows.test.jsx b/frontend/src/views/Plan.day-rows.test.jsx
index b70ac4123..173db6b93 100644
--- a/frontend/src/views/Plan.day-rows.test.jsx
+++ b/frontend/src/views/Plan.day-rows.test.jsx
@@ -92,19 +92,20 @@ describe('Plan — the menu', () => {
return menuSheet.mock.calls.at(-1)[0]
}
- it('has no Coach banner on the page; the Coach is the menu’s last entry when it is available', () => {
+ const coachButton = () => [...host.querySelectorAll('.hdr button')].find(b => b.textContent === 'Coach')
+
+ it('has its own Coach button in the header when the Coach is available, not a menu entry', () => {
mocks.coach = true
mount()
expect(host.textContent).not.toContain('Plan design and reviews')
- const menu = openMenu()
- const coach = menu.items.filter(Boolean).at(-1)
- expect(coach.label).toBe('Coach')
- act(() => coach.onClick())
+ expect(openMenu().items.filter(Boolean).map(i => i.label)).not.toContain('Coach')
+ act(() => coachButton().click())
expect(mocks.nav).toHaveBeenCalledWith('/coach')
})
it('leaves the Coach out where it is not available', () => {
mount()
+ expect(coachButton()).toBeUndefined()
expect(openMenu().items.filter(Boolean).map(i => i.label)).not.toContain('Coach')
})
diff --git a/frontend/src/views/Plan.jsx b/frontend/src/views/Plan.jsx
index 03b0b5395..c5ccb0b19 100644
--- a/frontend/src/views/Plan.jsx
+++ b/frontend/src/views/Plan.jsx
@@ -135,12 +135,13 @@ export default function Plan() {
try { localStorage.setItem(PLAN_VIEW_KEY, v) } catch { /* private mode: the view just isn't remembered */ }
}
- /* The Coach's way in from Plan. It used to be a banner over the week; it is the last entry of the
- Plan menu now, gated by the same predicate every other Coach surface uses, so an instance
- without the feature sees exactly the menu it would have without it. */
+ /* The Coach's way in from Plan: its own button in the header (a banner over the week was too
+ loud, the last entry of the share menu too hidden). Gated by the same predicate every other
+ Coach surface uses, so an instance without the feature sees exactly the header it would have
+ without it. */
const showCoach = coachAvailable(config, user, { demo: DEMO, mobile: MOBILE, coachMode })
- // Share, print, import, starter plans and the Coach: one menu behind the header button, so the
+ // Share, print, import and starter plans: one menu behind the header button, so the
// two views below are only about the plan itself.
const openMenu = () => {
const has = planHasRoutines(S)
@@ -152,7 +153,6 @@ export default function Plan() {
{ icon: 'note', label: t('Print / Save as PDF'), disabled: !has, onClick: printWholePlan },
{ icon: 'download', label: t('Import a plan file'), onClick: () => fileRef.current?.click() },
{ icon: 'clipboard', label: t('Load starter plan'), onClick: starterPlanSheet },
- showCoach && { icon: 'sparkles', label: t('Coach'), sub: t('Plan design and reviews, from your own training'), onClick: () => nav('/coach') },
],
})
}
@@ -163,7 +163,10 @@ export default function Plan() {
return <div className="narrow plan">
<div className="hdr">
<div><h1>{t('Plan')}</h1><div className="sub">{mode === 'rotation' ? t('Your routines in a loop') : t('Your weekly routine')}</div></div>
- <button className="iconbtn" onClick={openMenu} aria-label={t('Plan options')} title={t('Plan options')}><Icon name="share" /></button>
+ <div className="hdr-actions">
+ {showCoach && <Button size="sm" variant="tinted" icon="sparkles" onClick={() => nav('/coach')}>{t('Coach')}</Button>}
+ <button className="iconbtn" onClick={openMenu} aria-label={t('Plan options')} title={t('Plan options')}><Icon name="share" /></button>
+ </div>
</div>
<input ref={fileRef} type="file" accept="application/json,.json" onChange={pickFile} hidden />
<Segmented className="plan-views" value={view} onChange={setView}