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
Menus: a title that is a sentence is shown as written ("Convert to lb?", not "Convert To Lb?")
Duarte Santos98a26a3f6494
diff --git a/frontend/src/sheets.jsx b/frontend/src/sheets.jsxindex 265b7a4b5..e895fd0a3 100644--- a/frontend/src/sheets.jsx+++ b/frontend/src/sheets.jsx@@ -84,9 +84,10 @@ export function askAddDeviceData(extras) {// everything that is not a set you are about to log: the point of a single "more" button is// that the ten things you do once a session stop competing with the two you do every set.// items: [{ icon, label, sub, onClick, danger, disabled, on }] — `on` draws a check for toggles.-// titleClass replaces the title's default title-casing, for a title that is an exercise name-// carrying its own casing from a translated pack (exerciseNameClass).-function MenuSheet({ title, titleClass = 'capitalize', subtitle, items, close }) {+// A title is shown as written: most are sentences ("Convert to lb?", "Set 2"), which a default+// title-casing turned into "Convert To Lb?". An exercise name passes exerciseNameClass as+// titleClass, which title-cases the lower-case packs and leaves a cased one alone.+function MenuSheet({ title, titleClass = '', subtitle, items, close }) {return <>{title && <h3 className={titleClass || undefined} style={{ marginBottom: subtitle ? 2 : 10 }}>{title}</h3>}{subtitle && <div className="muted small" style={{ marginBottom: 10 }}>{subtitle}</div>}diff --git a/frontend/src/sheets.test.jsx b/frontend/src/sheets.test.jsxindex 9c1b83e4d..88d8fe077 100644--- a/frontend/src/sheets.test.jsx+++ b/frontend/src/sheets.test.jsx@@ -5,7 +5,7 @@ import { createRoot } from 'react-dom/client'import { EXDB } from './lib/exercises.js'import { useStore } from './store/useStore.js'import { useUI } from './store/useUI.js'-import { exConfigSheet } from './sheets.jsx'+import { exConfigSheet, menuSheet } from './sheets.jsx'const ex = EXDB.find(e => e.id === '0009')const mounted = []@@ -79,3 +79,25 @@ describe('exercise configuration progression step', () => {expect(useUI.getState().sheets).toHaveLength(0)})})++// QA 1.3.9: "Convert To Lb?" — the menu title was title-cased whatever it said.+describe('menu sheet title', () => {+ afterEach(() => { act(() => { mounted.splice(0).forEach(root => root.unmount()) }) })+ const titleOf = opts => {+ useUI.setState({ sheets: [] })+ menuSheet({ items: [], ...opts })+ const sheet = useUI.getState().sheets.at(-1)+ const host = document.createElement('div')+ document.body.appendChild(host)+ const root = createRoot(host)+ mounted.push(root)+ act(() => root.render(sheet.render(() => useUI.getState().closeSheet(sheet.id))))+ return host.querySelector('h3')+ }+ it('shows a sentence as written', () => {+ expect(titleOf({ title: 'Convert to lb?' }).className).toBe('')+ })+ it('still title-cases an exercise name when asked to', () => {+ expect(titleOf({ title: 'barbell curl', titleClass: 'capitalize' }).className).toBe('capitalize')+ })+})