Merge remote-tracking branch 'pr/54' into coach

This commit is contained in:
Duarte Santos committed 2026-08-07 14:47:25 +02:00
commit a0ac473df7
2 files changed
+66 -4

No files matched your search

+19 -1
View File
@@ -4,13 +4,24 @@ import { DAYN, uid, exCount } from '../lib/format.js'
import { t } from '../lib/i18n.js'
import { dayAssignSheet, loadStarterPlan, planToolsSheet } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
import { Button } from '../components/ui.jsx'
import { Button, Row } from '../components/ui.jsx'
import { glyphOf, DEFAULT_GLYPH } from '../lib/glyphs.js'
import { DEMO } from '../lib/demo.js'
import { MOBILE } from '../lib/mobile.js'
import { coachAvailable } from '../lib/coach.js'
export default function Plan() {
const nav = useNavigate()
const S = useStore(s => s.S)
const update = useStore(s => s.update)
const config = useStore(s => s.config)
const user = useStore(s => s.user)
/* The Coach's only entry point in the app. Its screens have existed since the UI landed and
nothing linked to them, so the feature was reachable only by typing the URL — enabled,
configured, and invisible. The same predicate every other Coach surface uses gates it, so
an instance without the feature sees exactly the Plan screen it saw before. */
const showCoach = coachAvailable(config, user, { demo: DEMO, mobile: MOBILE })
const addRoutine = () => {
const r = { id: uid(), name: t('New routine'), emoji: DEFAULT_GLYPH, ex: [] }
@@ -23,6 +34,13 @@ export default function Plan() {
<div><h1>{t('Plan')}</h1><div className="sub">{t('Your weekly routine')}</div></div>
<button className="iconbtn" onClick={planToolsSheet} aria-label={t('Share your plan')} title={t('Share your plan')}><Icon name="upload" /></button>
</div>
{showCoach && <div className="list" style={{ marginBottom: 10 }}>
<Row icon="sparkles" iconTint="var(--acc)" accessory="chevron"
title={t('AI Coach')}
subtitle={t('Build a plan, or have it reviewed against what you actually logged.')}
onClick={() => nav('/coach')} />
</div>}
<div className="cols"><div>
<h4 className="sec">{t('Week schedule')}</h4>
<div className="list" style={{ display: 'flex', flexDirection: 'column' }}>