From 0a188ad4ab31f6c3a971dfa713f0d054c3b7fc94 Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Thu, 23 Apr 2026 11:29:33 +0200 Subject: [PATCH] =?UTF-8?q?fix(fitness):=20measure=20page=20polish=20?= =?UTF-8?q?=E2=80=94=20stable=20steppers,=20narrow=20history,=20body-parts?= =?UTF-8?q?=20chrome=20tweaks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Lock +/- button positions by normalizing stepped weight/body-fat values to .toFixed(1) so trailing zeros stay; placeholders also normalized. Input width no longer jitters through a step sequence. - Cap .history-section width on mobile/tablet to match .main-col (480px / 760px) so "Past measurements" aligns with the metric cards. - Body-parts page: - Remove the "Running totals" list from the right panel. - Hide the keyboard-shortcut legend by default; show on `?` (toggle) or Escape (dismiss), with a small `?` pill hint in its place. Added kbd_hint i18n string. - Push skip + back/next toward the edges of the bottombar; pull progress dots + close button inward symmetrically. - Center the keyboard legend / hint on the screen width rather than between the skip and nav buttons (position: absolute + translate). --- package.json | 2 +- src/lib/js/fitnessI18n.ts | 1 + .../[measure=fitnessMeasure]/+page.svelte | 16 ++-- .../body-parts/+page.svelte | 85 ++++++++++++------- 4 files changed, 67 insertions(+), 37 deletions(-) diff --git a/package.json b/package.json index 7879710d..8ad7ae3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "homepage", - "version": "1.46.0", + "version": "1.46.1", "private": true, "type": "module", "scripts": { diff --git a/src/lib/js/fitnessI18n.ts b/src/lib/js/fitnessI18n.ts index 42431748..42d8740e 100644 --- a/src/lib/js/fitnessI18n.ts +++ b/src/lib/js/fitnessI18n.ts @@ -297,6 +297,7 @@ const translations: Translations = { kbd_next: { en: 'next', de: 'weiter' }, kbd_skip: { en: 'skip', de: 'auslassen' }, kbd_wheel: { en: '\u00b10.1', de: '\u00b10,1' }, + kbd_hint: { en: 'Press ? for shortcuts', de: '? dr\u00fccken f\u00fcr Tastenk\u00fcrzel' }, no_body_parts_selected: { en: 'Enter at least one value before saving.', de: 'Bitte mindestens einen Wert eingeben.' diff --git a/src/routes/fitness/[measure=fitnessMeasure]/+page.svelte b/src/routes/fitness/[measure=fitnessMeasure]/+page.svelte index 3cbaa28c..6d7f63fa 100644 --- a/src/routes/fitness/[measure=fitnessMeasure]/+page.svelte +++ b/src/routes/fitness/[measure=fitnessMeasure]/+page.svelte @@ -186,12 +186,12 @@ function stepWeight(delta) { const cur = Number(formWeight) || lastWeight || 0; - formWeight = String(Math.round((cur + delta) * 10) / 10); + formWeight = (Math.round((cur + delta) * 10) / 10).toFixed(1); } function stepBodyFat(delta) { const cur = Number(formBodyFat) || lastBodyFat || 0; - formBodyFat = String(Math.round((cur + delta) * 10) / 10); + formBodyFat = (Math.round((cur + delta) * 10) / 10).toFixed(1); } /** @@ -393,7 +393,7 @@ type="number" step="0.1" bind:value={formWeight} - placeholder={lastWeight != null ? String(lastWeight) : '0.0'} + placeholder={lastWeight != null ? Number(lastWeight).toFixed(1) : '0.0'} class="metric-input" inputmode="decimal" onkeydown={(e) => onMetricKey(e, stepWeight)} @@ -424,7 +424,7 @@ type="number" step="0.1" bind:value={formBodyFat} - placeholder={lastBodyFat != null ? String(lastBodyFat) : '0.0'} + placeholder={lastBodyFat != null ? Number(lastBodyFat).toFixed(1) : '0.0'} class="metric-input" inputmode="decimal" onkeydown={(e) => onMetricKey(e, stepBodyFat)} @@ -588,6 +588,11 @@ margin-inline: auto; width: 100%; } + .history-section { + max-width: 480px; + margin-inline: auto; + width: 100%; + } h2 { margin: 0 0 0.5rem; font-size: 1.1rem; @@ -1314,7 +1319,8 @@ /* Weight + body fat side-by-side once there's room (tablet and up) */ @media (min-width: 560px) { .main-col, - .add-form { + .add-form, + .history-section { max-width: 760px; } .metric-grid { diff --git a/src/routes/fitness/[measure=fitnessMeasure]/body-parts/+page.svelte b/src/routes/fitness/[measure=fitnessMeasure]/body-parts/+page.svelte index 067509fe..5285dcee 100644 --- a/src/routes/fitness/[measure=fitnessMeasure]/body-parts/+page.svelte +++ b/src/routes/fitness/[measure=fitnessMeasure]/body-parts/+page.svelte @@ -140,14 +140,18 @@ return v ? `${v} cm` : '—'; } + let showShortcuts = $state(false); + /** @param {KeyboardEvent} e */ function onkey(e) { + const tag = /** @type {HTMLElement|null} */ (e.target)?.tagName; + const inInput = tag === 'INPUT'; + if (e.key === '?' && !inInput) { e.preventDefault(); showShortcuts = !showShortcuts; return; } + if (e.key === 'Escape' && showShortcuts) { e.preventDefault(); showShortcuts = false; return; } if (done) { if (e.key === 'ArrowLeft') { e.preventDefault(); idx = total - 1; direction = -1; } return; } - const tag = /** @type {HTMLElement|null} */ (e.target)?.tagName; - const inInput = tag === 'INPUT'; if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); next(); } else if (e.key === 'ArrowRight' && !inInput) { e.preventDefault(); next(); } else if (e.key === 'ArrowLeft' && !inInput) { e.preventDefault(); back(); } @@ -477,7 +481,7 @@ {/if} -