Salud moves to Home's header: a sixth tab pushed Start off centre
Tests / test (push) Canceled after 0s
Publish Docker images / build (., ./web/Dockerfile, web) (push) Canceled after 0s
Publish Docker images / build (./api, ./api/Dockerfile, api) (push) Canceled after 0s

The tab bar is a flex row of equal columns with the Start button raised in the
middle, so the tab count has to stay odd. Adding Salud as a sixth pushed that disc
half a column to the right, and it read immediately as "the button moved" — the
app's primary action is the one thing in the bar that must not drift.

Salud is now the heart button in Home's header, next to the gear, with the same
destination and the same route (/health). It is reachable from Settings → Data as
well, which was already there. The tab bar is back to five: Home, Plan, Start,
Stats, Exercises.

Two tests, because this is the kind of change that regresses silently: TabBar.test.jsx
asserts the odd count and that the raised button is the middle child (plus that no tab
points at /health), and Home.health-door.test.jsx asserts the heart sits in the same
non-shrinking container as the gear and navigates to /health — if that breaks, the
screen is only reachable from Settings, where nobody looks for it.

Also: the Comments in Home, TabBar, README, CHANGELOG and docs/HEALTH.md now say
where Salud is, and one test assertion checks flexGrow/flexShrink rather than the
`flex: none` shorthand — the CSSOM rewrites that to `0 0 auto`, which is what the
first version of the test tripped over.
This commit is contained in:
dsantillan committed 2026-09-23 10:23:31 -04:00
1 parent 691e664d3f
commit 8d190bb591
7 files changed
+129 -9

No files matched your search

+2 -1
View File
@@ -2,7 +2,8 @@
## Sin publicar — Apple Health (Salud)
A new **Salud** tab, next to Plan, and an endpoint behind it. An iOS automation in *Health Auto
A new **Salud** screen, opened from the heart button in Home's header (next to the gear — the tab
bar keeps its five tabs so the raised Start button stays centred), and an endpoint behind it. An iOS automation in *Health Auto
Export* POSTs Apple Health to your profile and the data shows up as read-only cards: steps, heart
rate, sleep, weight, oxygen, workouts, and every other metric HAE can export — including ones this
fork has never heard of, which land under **Other** with a humanised name and a detail sheet listing
+1 -1
View File
@@ -94,7 +94,7 @@ as a home-screen app, passkey sign-in, offline support, sync across your phone a
- 🎨 **Designed, not assembled** — light/dark themes and 8 accent colors saved to your profile, over a hand-drawn icon set instead of emoji, so it looks the same on every phone
- 🌍 **14 languages** — full UI translation (EN, DE, ES, FR, IT, PT (Portugal), PT (Brazil), PL, TR, RU, ZH, KO, HI, TH, HU); exercise instructions localized in 12 of them and built-in exercise names shown bilingually in PT-BR and HU, all loaded on demand so the app stays fast
- 📥 **Bring your history with you** — import from **FitNotes** (Android and iOS), **Strong** and **Hevy** (CSV or directly with a [Hevy Pro API key](https://hevy.com/settings?developer)), or body weight straight out of an **Apple Health** export. Exercise names are matched against the library and anything unrecognised becomes one of your own exercises, so nothing in the file is dropped
- ❤️ **Salud: your Apple Health, live** — a **Salud** tab draws whatever your iPhone reports: steps, heart rate, sleep, weight, oxygen, workouts and every other metric Health Auto Export can send, as cards with trends over 7/30/90/365 days. Per profile and private by construction — each profile mints its own **write-only** ingest key, the phone's data lands in its own file, and re-sends are de-duplicated, so an automation firing every five minutes never counts a day twice. See [docs/HEALTH.md](docs/HEALTH.md)
- ❤️ **Salud: your Apple Health, live** — a **Salud** screen (the heart button in Home's header) draws whatever your iPhone reports: steps, heart rate, sleep, weight, oxygen, workouts and every other metric Health Auto Export can send, as cards with trends over 7/30/90/365 days. Per profile and private by construction — each profile mints its own **write-only** ingest key, the phone's data lands in its own file, and re-sends are de-duplicated, so an automation firing every five minutes never counts a day twice. See [docs/HEALTH.md](docs/HEALTH.md)
- 📦 **Yours to keep** — one-tap JSON export/import, guest mode, **no telemetry**; switching kg ↔ lb offers to convert every stored number
- 🤖 **Ask an AI about your training** (optional) — an [MCP server](mcp/README.md) lets a client like Claude Desktop or Cursor read your history in your own words: *"what did I bench last week?"*. Read-only, spawned locally by the client, nothing leaves your box. Not in the Docker build — if you don't use an AI assistant, it isn't there
- 🧠 **An AI coach that writes your plan** (optional, off by default) — answer a handful of questions and it designs a week of routines; later it reads what you actually logged and proposes changes, each one with the evidence behind it. You approve every change and can undo it. It runs on **your** server under **your** provider account — Anthropic, OpenAI, Gemini or any OpenAI-compatible endpoint (Ollama on your LAN counts) with a pasted API key on the default image, or the Claude Agent SDK / Codex CLI on a separate build. The phone app can use your instance or its own key. See [docs/AI_COACH.md](docs/AI_COACH.md)
+4 -3
View File
@@ -3,9 +3,10 @@
KuentaGYM does not read Apple Health. Your iPhone posts it.
An iOS automation in [Health Auto Export](https://www.healthexportapp.com/) (HAE) reads Apple
Health and POSTs its JSON export to your KuentaGYM profile. The **Salud** tab draws whatever
arrived, as read-only cards; `api/vitals.js` does the arithmetic; `frontend/src/lib/vitals-view.js`
decides which number each card shows.
Health and POSTs its JSON export to your KuentaGYM profile. The **Salud** screen — the heart button
in Home's header, next to the gear: the tab bar keeps its five tabs so its raised Start button stays
centred — draws whatever arrived, as read-only cards; `api/vitals.js` does the arithmetic;
`frontend/src/lib/vitals-view.js` decides which number each card shows.
Nothing here is an input. There is no way to type a step count into this screen, and the workouts
the watch records are shown as a list rather than merged into your workout history — they carry no
+5 -3
View File
@@ -32,9 +32,11 @@ export default function TabBar({ onStart }) {
<nav id="tabbar">
<Tab k="home" icon="house" to="/home" label={t('Home')} />
<Tab k="plan" icon="calendar" to="/plan" label={t('Plan')} />
{/* Apple Health. Next to Plan because both answer "what am I doing about my body", and
second in the bar (not last) because it is a place you go on purpose, not a drawer. */}
<Tab k="health" icon="heart" to="/health" label={t('Health')} />
{/* NOTE: five tabs, and it has to stay an odd number. The bar is a flex row of equal
columns with the Start button raised in the middle, so a sixth tab pushes Start off
centre by half a column and the app's primary action visibly drifts right (tried with
Salud, reverted). A new destination belongs in a header — Salud lives next to the gear
on Home — or it replaces one of these five. */}
{/* On the workout screen itself there is nothing to resume, so the button reads as the
tab it is and stays lit (#29); anywhere else it brings you back to the exercise you
were on — the marker is kept in S.active.cur and never moves on its own (#21). */}
+58
View File
@@ -0,0 +1,58 @@
// @vitest-environment happy-dom
/* The bar is a flex row of equal columns with the Start button raised in the middle, so the
number of tabs has to stay ODD: a sixth tab pushed Start off centre by half a column and the
app's primary action visibly drifted right (Salud lived here for one afternoon). Which five
they are matters too — Salud is reached from Home's header, next to the gear. */
import React, { act } from 'react'
import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { useStore } from '../store/useStore.js'
const nav = vi.fn()
vi.mock('react-router-dom', () => ({
useNavigate: () => nav,
useLocation: () => ({ pathname: '/home' })
}))
vi.mock('../sheets.jsx', () => ({ startFlow: vi.fn() }))
const { default: TabBar } = await import('./TabBar.jsx')
let host, root
beforeEach(() => {
globalThis.IS_REACT_ACT_ENVIRONMENT = true
nav.mockClear()
host = document.createElement('div'); document.body.appendChild(host); root = createRoot(host)
useStore.setState(s => ({ S: { ...s.S, active: null, routines: [], week: {}, dayPlan: {} }, user: { id: 'u1', name: 'Test' } }))
})
afterEach(() => { act(() => root.unmount()); host.remove() })
const mount = () => act(() => root.render(<TabBar onStart={vi.fn()} />))
const tabs = () => [...host.querySelectorAll('#tabbar > button')]
describe('the tab bar', () => {
it('has an odd number of tabs, so the raised Start button stays in the middle', () => {
mount()
expect(tabs().length).toBe(5)
expect(tabs()[2].classList.contains('start')).toBe(true)
// Two on each side of it, or the disc is off centre by half a column.
expect(tabs().slice(0, 2).every(b => !b.classList.contains('start'))).toBe(true)
expect(tabs().slice(3).every(b => !b.classList.contains('start'))).toBe(true)
})
it('goes Home, Plan, Start, Stats, Exercises', () => {
mount()
const labels = tabs().map(b => b.querySelector('span:last-child').textContent)
expect(labels).toEqual(['Home', 'Plan', 'Start', 'Stats', 'Exercises'])
})
it('does not carry Salud: it lives in Home\'s header, next to the gear', () => {
mount()
expect(host.textContent).not.toContain('Health')
const clicked = []
tabs().forEach(b => { b.dispatchEvent(new MouseEvent('click', { bubbles: true })); clicked.push(nav.mock.calls.at(-1)[0]) })
expect(clicked).not.toContain('/health')
expect(clicked).toContain('/plan')
expect(clicked).toContain('/stats')
expect(clicked).toContain('/library')
})
})
@@ -0,0 +1,51 @@
// @vitest-environment happy-dom
/* Salud is not in the tab bar (five tabs, so Start stays centred — see TabBar.test.jsx), which
makes Home's header the way in. It has to sit next to the gear and go to /health: if this
breaks, the screen is reachable only from Settings, which is where nobody looks for it. */
import React, { act } from 'react'
import { createRoot } from 'react-dom/client'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { useStore } from '../store/useStore.js'
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: () => ''
}))
const { default: Home } = await import('./Home.jsx')
let host, root
beforeEach(() => {
globalThis.IS_REACT_ACT_ENVIRONMENT = true
nav.mockClear()
host = document.createElement('div'); document.body.appendChild(host); root = createRoot(host)
useStore.setState(s => ({ S: { ...s.S, routines: [], week: {}, dayPlan: {}, workouts: [], bodyweight: [], active: null }, user: { id: 'u1', name: 'Test' } }))
})
afterEach(() => { act(() => root.unmount()); host.remove() })
const headerButtons = () => [...host.querySelectorAll('.hdr button')]
const click = el => act(() => { el.dispatchEvent(new MouseEvent('click', { bubbles: true })) })
describe('Home\'s header', () => {
it('offers Salud next to the gear, in that order', () => {
act(() => root.render(<Home />))
const labels = headerButtons().map(b => b.getAttribute('aria-label'))
expect(labels).toEqual(['Health', 'Settings'])
// Same container, or they end up on separate lines / far apart on a narrow phone.
expect(headerButtons()[0].parentElement).toBe(headerButtons()[1].parentElement)
// ...and that container must not shrink. The CSSOM rewrites `flex: none` to `0 0 auto`, so
// this asserts the property that actually matters rather than the shorthand that was typed.
const wrap = headerButtons()[0].parentElement
expect([wrap.style.flexGrow, wrap.style.flexShrink]).toEqual(['0', '0'])
})
it('takes Salud to /health', () => {
act(() => root.render(<Home />))
click(headerButtons()[0])
expect(nav).toHaveBeenCalledWith('/health')
click(headerButtons()[1])
expect(nav).toHaveBeenCalledWith('/settings')
})
})
+8 -1
View File
@@ -66,7 +66,14 @@ export default function Home() {
return <div className="narrow">
<div className="hdr">
<div><h1>{user ? t('Hi {0}', user.name) : 'KuentaGYM'}</h1><div className="sub">{today.toLocaleDateString(dateLocale(), { weekday: 'long', day: 'numeric', month: 'long' })}</div></div>
<button className="iconbtn" onClick={() => nav('/settings')} aria-label={t('Settings')}><Icon name="gear" /></button>
{/* Salud sits here rather than in the tab bar: the bar holds five tabs so its raised
Start button stays centred, and Health is a place you visit on purpose, not a drawer
you flip through mid-session. `flex: none` for the same reason `.hdr>.btn` has it —
the title gives way on a narrow phone, these two do not. */}
<div style={{ display: 'flex', gap: 8, flex: 'none' }}>
<button className="iconbtn" onClick={() => nav('/health')} aria-label={t('Health')} title={t('Health')}><Icon name="heart" /></button>
<button className="iconbtn" onClick={() => nav('/settings')} aria-label={t('Settings')}><Icon name="gear" /></button>
</div>
</div>
<div className="card">