Bugfix-Runde vom Board: Coach-Speichern auf Android (#42), Baender wie Koerpergewicht (#39), Einheitenwechsel rechnet um (#22), Mitte-Tab im Workout (#29/#21), Kopie-Namen, Geister-Wochentag, Swap-Picker

- #42: "Save and use the Coach" blieb auf Android 16 grau. Der sichere Speicher wird jetzt mit
  4 s Timeout angesprochen (coach-secrets.js withTimeout), die Geraete-Einstellung wird VOR dem
  Schluessel geschrieben, und jeder Fehler landet als Toast statt in einem stummen Promise.
- #39: isBodyweightEq zaehlt 'band'/'resistance band' mit (54 Katalog-Uebungen) — ein Reps-Stepper,
  Progression in Wdh./Saetzen; der Bodyweight-Schalter je Uebung ueberstimmt weiterhin.
- #22: Settings → Gewichtseinheit fragt: Zahlen umrechnen (lib/units.js convertStateUnit ueber
  Saetze, Drops, topW, Ziele, inc, Warm-up-Configs, exWeights, barWeights, Koerpergewicht, Zielgewicht;
  lb auf 0.5, kg auf 0.25 gerundet, Hin- und Rueckweg stabil) oder nur die Beschriftung aendern.
  Fussnote entsprechend, alter Hinweis-String raus. 5 neue Strings in 14 Packs.
- #29/#21: der Mitte-Tab heisst auf dem Workout-Screen "Workout" und leuchtet; sonst "Resume",
  das zum gemerkten Eintrag (S.active.cur) fuehrt, der sich seit !92 nie von selbst bewegt.
- !85: Kopie einer Kopie wird "Name (Copy 2)", nicht "(Copy) (Copy)".
- !94: ein Wochentag, dessen Routine nicht mehr existiert, loest keine Bestaetigung aus.
- !72: das "+" im Swap-Picker uebernimmt sofort mit Standard-Config wie ueberall sonst.
This commit is contained in:
Duarte Santos committed 2026-09-05 13:58:07 +02:00
1 parent 3773f65355
commit b5769b9c38
25 files changed
+251 -34

No files matched your search

+6 -1
View File
@@ -87,10 +87,15 @@ export default function CoachSetup() {
if (!chosen) return toast(t('Pick a model'))
setBusy(true)
try {
if (key.trim()) { await setApiKey(key.trim()); setHasKey(true); setKey('') }
// The mode first, the key second: the settings file is the cheap, reliable write, the
// key goes through the platform's secure store, which is the step that can misbehave.
// Either way the user hears what happened instead of watching a greyed-out button (#42).
await setCoachLocal({ mode: 'byok', provider, model: chosen, baseUrl: meta.baseUrl ? (validateBaseUrl(baseUrl).value || null) : null })
if (key.trim()) { await setApiKey(key.trim()); setHasKey(true); setKey('') }
toast(t('The Coach is on'))
nav('/coach')
} catch (e) {
toast(e?.message || t('Could not connect'))
} finally { setBusy(false) }
}
+19 -3
View File
@@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { useStore, DEF, hasData } from '../store/useStore.js'
import { workoutControls } from '../lib/workout-controls.js'
import { convertStateUnit } from '../lib/units.js'
import { useUI } from '../store/useUI.js'
import { ACCENTS, todayISO, localTZ, weekStartOf, MONDAY, SUNDAY } from '../lib/format.js'
import { effortOf } from '../lib/history.js'
@@ -12,7 +13,7 @@ import { t, LANGS, INSTR_LANGS } from '../lib/i18n.js'
import { DEMO, REPO } from '../lib/demo.js'
import { MOBILE, shareExport, syncReminder } from '../lib/mobile.js'
import { ConnectSheet } from './MobileOnboarding.jsx'
import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet } from '../sheets.jsx'
import { starterPlanSheet, confirmSheet, importFromApp, importFromHevy, equipmentProfileSheet, menuSheet } from '../sheets.jsx'
import Icon from '../components/Icon.jsx'
import { Section, Row, SelectRow, Switch, Segmented, Button, TextField } from '../components/ui.jsx'
@@ -27,6 +28,21 @@ export default function Settings() {
const importRef = useRef(null)
const wakeOK = wakeLockSupported()
// Two honest choices on a unit switch (issue #22): convert the numbers, or keep them and only
// change the label — the old behaviour, still right for someone who logged in lb all along
// under a kg label. Closing the sheet leaves the unit as it was.
const switchUnit = v => {
if (v === S.unit) return
menuSheet({
title: t('Convert to {0}?', v),
subtitle: t('Every stored weight — logged sets, working weights, routine targets, body weight, bar weights — is in {0}. Convert the numbers, or keep them and only change the label?', S.unit),
items: [
{ icon: 'shuffle', label: t('Convert the numbers'), onClick: () => replaceState(convertStateUnit(useStore.getState().S, v)) },
{ icon: 'pencil', label: t('Keep the numbers, change the label'), onClick: () => update(s => { s.unit = v }) },
],
})
}
const doExport = async () => {
const json = JSON.stringify(S, null, 2)
const name = 'opengym-backup-' + todayISO() + '.json'
@@ -120,7 +136,7 @@ export default function Settings() {
</Section>}
{/* ---------- general ---------- */}
<Section title={t('General')} footer={t('Note: switching units only changes the label — logged numbers are not converted.')}>
<Section title={t('General')} footer={t('Switching the unit offers to convert every stored weight.')}>
<SelectRow
icon="globe" iconTint="var(--blue)" title={t('Language')}
value={S.lang || 'en'} onChange={v => update(s => { s.lang = v })}
@@ -132,7 +148,7 @@ export default function Settings() {
<Row icon="scale" iconTint="var(--teal)" title={t('Weight unit')}>
<Segmented className="seg-inline"
options={[{ value: 'kg', label: 'kg' }, { value: 'lb', label: 'lb' }]}
value={S.unit} onChange={v => update(s => { s.unit = v })} />
value={S.unit} onChange={v => switchUnit(v)} />
</Row>
{/* Monday or Sunday — the Plan list, the Home strip, the calendar grid and every
"this week" total follow it. Stored as a getDay() index (see lib/format.js). */}