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
Phone-width layout: a list row's title asks only for its own longest word, a date or time field drops a line rather than the screen edge, and the page title steps down instead of shredding
Duarte Santosa0a44cb6c05c
diff --git a/frontend/src/index.css b/frontend/src/index.cssindex c343058bc..10a33436b 100644--- a/frontend/src/index.css+++ b/frontend/src/index.css@@ -184,13 +184,19 @@ body.resting #app{padding-bottom:calc(206px + var(--sab))}.hdr{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin:8px 0 18px}/* The title block gives way, the button on the right never does: a flex item will not shrinkbelow its longest word, so "Упражнения" at 34px or "Hi Bartholomew_Jones" used to push the- gear / "By muscle" past the screen edge. A word that does not fit is hyphenated ("Упраж-- нения"; <html lang> follows the app language, so the right dictionary applies) and, for one- no dictionary knows, broken anywhere as the last resort. Ordinary titles still wrap at- spaces, and the button keeps its width instead of squeezing. */+ gear / "By muscle" past the screen edge. Two things follow from letting it shrink. Below 420px+ — every phone width we test — the title drops a step to 30px, because the 95 to 125px the+ Library button leaves the Polish and Russian titles is less than half of "Ćwiczenia" or+ "Упражнения" at 34px and they came apart into three lines; at 30px all 14 packs take two at+ most. And a word that still does not fit is broken with overflow-wrap:break-word, which moves+ the whole word to the next line first and breaks it only if it does not fit there either —+ `anywhere` broke "Bartholomew_Jones" mid-word even at 412px, where a line of its own was+ waiting for it. hyphens:auto goes with them: the hyphen costs a character's worth of width in+ a box this tight, and that is what turned "Упражнения" into "Упра / жнен / ия". */.hdr>div{min-width:0}.hdr>.btn{flex:none}-.hdr h1{font-size:34px;line-height:1.06;font-weight:700;letter-spacing:-.028em;hyphens:auto;overflow-wrap:anywhere}+.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}.iconbtn{@@ -260,16 +266,20 @@ h4.sec{display:flex;align-items:center;justify-content:center;background:var(--tint,var(--acc));color:#fff;}-/* The title column keeps at least 104px: with a basis of 0 it only got what a capped value left- over, and on a 320px phone "Progression" (96px) was painted over by "Linear progression" in a- 37px box. .lrow-t does not ellipsise on purpose — long settings titles wrap onto a second line,- and a floor the width of one long word is what keeps a single word from spilling. The value- next to it shrinks and ellipsises instead (below). */-.lrow-m{flex:1;min-width:104px;display:flex;flex-direction:column;gap:1px}+/* The title column never shrinks below its own longest word. With a basis of 0 and min-width:0 it+ only got what a capped value left over, and on a 320px phone "Progression" (96px) was painted over+ by "Linear progression" in a 37px box; min-width:auto — the flex default — is exactly the floor+ that case wants. A fixed 104px floor fixed that row and starved the rest: the backfill sheet's Date+ and Start-time rows have nothing but the title to give, so the floor shoved their fixed-width+ .timef off a 320px screen, and a short title like "Routine" (63px) took 104px away from the value+ beside it until "Freies Training" ellipsised. Asking only for the longest word takes nothing a row+ did not already owe the title. .lrow-t does not ellipsise on purpose — long settings titles wrap+ onto a second line — and the value next to it shrinks and ellipsises instead (below). */+.lrow-m{flex:1;min-width:auto;display:flex;flex-direction:column;gap:1px}.lrow-t{font-size:17px;letter-spacing:-.012em;line-height:1.25}.lrow-s{font-size:13px;color:var(--label-2);line-height:1.3}/* flex:none would let a long value ("Follow the routine (Linear progression)") run straight- through the title next to it, since the title's column is free to shrink down to its floor.+ through the title next to it, since the title's column only holds out for its longest word.Letting the value shrink and ellipsise instead keeps the two out of each other's way.The cap is max-width, not flex-basis: .lrow-m is flex:1, so its basis is 0 and it absorbsnone of the shrink — a long value would otherwise take the whole row and squeeze the title@@ -587,6 +597,13 @@ body.chips-dragging *{cursor:inherit}background:var(--surface-2);border:none;border-radius:8px;padding:6px 10px;font-size:16px;color:var(--label);outline:none;font-variant-numeric:tabular-nums;}+/* A date or time field is as wide as the browser draws it and will not give way, and neither will+ the title beside it once that is down to its longest word: the Polish "Godzina rozpoczęcia" plus+ the clock leaves a 320px row 17px short, and the field then hangs over the edge of the card with+ its picker icon. Such a row wraps the field onto a line of its own under the title instead, still+ flush right — the same way a row carrying an inline segmented control does. */+.lrow:has(.timef){flex-wrap:wrap}+.lrow>.timef{margin-left:auto}.timef::-webkit-calendar-picker-indicator{filter:invert(.5)}:root[data-theme="light"] .timef::-webkit-calendar-picker-indicator{filter:none}diff --git a/frontend/src/sheets.backfill.test.jsx b/frontend/src/sheets.backfill.test.jsxindex af0da25f2..de4cc9ee7 100644--- a/frontend/src/sheets.backfill.test.jsx+++ b/frontend/src/sheets.backfill.test.jsx@@ -1,5 +1,7 @@// @vitest-environment happy-domimport React, { act } from 'react'+import { readFileSync } from 'node:fs'+import { resolve } from 'node:path'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import { createRoot } from 'react-dom/client'import { useStore } from './store/useStore.js'@@ -22,6 +24,7 @@ function mountTopSheet() {return host}const button = (host, text) => [...host.querySelectorAll('button')].find(b => b.textContent.trim() === text)+const cssSource = readFileSync(resolve(process.cwd(), 'src/index.css'), 'utf8')describe('log a past workout', () => {beforeEach(() => {@@ -53,6 +56,26 @@ describe('log a past workout', () => {expect(useStore.getState().S.active).toBeNull()})+ // The Date and Start-time rows are the only .lrow rows in the app that pair a title with a+ // fixed-width field and nothing that can give way. A pixel floor under the title column therefore+ // comes straight out of the field: 104px pushed the date input 23px off a 320px screen, calendar+ // picker and all, so there was no way to open the picker on a small phone. The floor has to be the+ // row's own longest word (min-width:auto), which these short titles barely ask for.+ it('gives the date and time fields a title column that can shrink', () => {+ logPastWorkoutSheet()+ const host = mountTopSheet()+ const fields = [...host.querySelectorAll('.lrow input.timef')]+ expect(fields.map(i => i.type)).toEqual(['date', 'time'])+ for (const field of fields) expect(field.closest('.lrow').querySelectorAll('.lrow-v')).toHaveLength(0)+ const rule = cssSource.match(/^\.lrow-m\{([^}]*)\}/m)+ expect(rule?.[1]).toContain('min-width:auto')+ expect(rule[1]).not.toMatch(/min-width:\s*[\d.]/)+ // and where even the longest word leaves no room for the field (Polish "Godzina rozpoczęcia"+ // at 320px), the field drops onto its own line rather than over the edge of the card.+ expect(cssSource).toContain('.lrow:has(.timef){flex-wrap:wrap}')+ expect(cssSource).toContain('.lrow>.timef{margin-left:auto}')+ })+it('starts a backfilled session straight away on a free day', () => {logPastWorkoutSheet()const host = mountTopSheet()diff --git a/frontend/src/views/Library.test.jsx b/frontend/src/views/Library.test.jsxindex b4d95435f..7c5cf3ba7 100644--- a/frontend/src/views/Library.test.jsx+++ b/frontend/src/views/Library.test.jsx@@ -2,6 +2,8 @@// Favourites (issue #6): the Library floats starred exercises to the top of the current// result list — after the search and body-part filters, without reordering the rest.import React, { act } from 'react'+import { readFileSync } from 'node:fs'+import { resolve } from 'node:path'import { createRoot } from 'react-dom/client'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'import Library from './Library.jsx'@@ -32,6 +34,7 @@ function render() {return host}const names = host => [...host.querySelectorAll('.item .tt')].map(el => el.textContent).slice(1) // drop "Create your own"+const cssSource = readFileSync(resolve(process.cwd(), 'src/index.css'), 'utf8')beforeEach(() => {mocks.S = { unit: 'kg', lang: 'en', routines: [], workouts: [], customEx: [], exWeights: {}, equipProfiles: [], activeEquipId: null, equipFilterOn: false }@@ -54,6 +57,21 @@ describe('Library favourites', () => {expect(rows[2].querySelector('.fav-star')).toBeNull()})+ // The Library is the one page whose header puts a text button beside the title, so it leaves the+ // title the least room of anywhere in the app — 95px for Polish, 125px for Russian on a 320px+ // screen. The button must stay reachable (it is flex:none, the title block shrinks), but a title+ // squeezed that far must not come apart: at 34px "Упражнения" broke into three lines, so the+ // title drops a step on phone widths and breaks a word only as a last resort.+ it('keeps the header button reachable without shredding the title', () => {+ expect(cssSource).toContain('.hdr>div{min-width:0}')+ expect(cssSource).toContain('.hdr>.btn{flex:none}')+ expect(cssSource).toMatch(/@media \(max-width:420px\)\{\.hdr h1\{font-size:30px\}\}/)+ const h1 = cssSource.match(/^\.hdr h1\{([^}]*)\}/m)+ expect(h1?.[1]).toContain('overflow-wrap:break-word')+ expect(h1[1]).not.toContain('overflow-wrap:anywhere')+ expect(h1[1]).not.toContain('hyphens:auto')+ })+it('keeps a favourite on top inside a body-part filter, but never pulls one in from elsewhere', () => {const chest = EXDB.filter(e => e.bp === 'chest')const legs = EXDB.find(e => e.bp !== 'chest')