Arbeitsgewicht-Abfrage mit Slider, eigene Bestätigungs-Dialoge, Gewichts-History nur letzte 3
- Die 'Arbeitsgewicht bestätigen'-Abfrage im Workout nutzt jetzt denselben Slider + Plus/Minus (geteilte WeightInput-Komponente) - Alle window.confirm-Systemdialoge durch eigene, app-farbige Center-Dialoge ersetzt (confirmSheet): Workout verwerfen/vorzeitig beenden, Routine/Workout löschen, Abmelden, Reset, Backup importieren - Log-Sheet zeigt nur noch die letzten 3 Gewichts-Einträge
This commit is contained in:
1 parent
64f33dd3bd
commit
6e473a9815
4 files changed
+48
-28
No files matched your search
@@ -5,7 +5,7 @@ import { EXIDX, isCardio } from '../lib/exercises.js'
|
||||
import { fmtNum, uid } from '../lib/format.js'
|
||||
import { supersetUnits } from '../lib/history.js'
|
||||
import { Thumb } from '../components/Media.jsx'
|
||||
import { emojiPicker, exercisePicker, exConfigSheet } from '../sheets.jsx'
|
||||
import { emojiPicker, exercisePicker, exConfigSheet, confirmSheet } from '../sheets.jsx'
|
||||
|
||||
// drop superset ids that no longer have an adjacent partner (after unlink/reorder)
|
||||
function cleanupSg(ex) {
|
||||
@@ -71,14 +71,16 @@ export default function RoutineEdit() {
|
||||
<div className="small dim" style={{ margin: '10px 2px' }}>Tip: tap 🔗 on an exercise to superset it with the one above — you’ll do them back-to-back.</div>
|
||||
<button className="btn primary" onClick={() => exercisePicker(ex => exConfigSheet(ex, null, cfg => edit(x => { x.push({ id: ex.id, ...cfg }) })))}>+ Add exercise</button>
|
||||
<div style={{ height: 10 }} />
|
||||
<button className="btn danger" onClick={() => {
|
||||
if (!confirm('Delete "' + r.name + '"?')) return
|
||||
update(s => {
|
||||
s.routines = s.routines.filter(x => x.id !== id)
|
||||
Object.keys(s.week).forEach(k => { if (s.week[k] === id) delete s.week[k] })
|
||||
Object.keys(s.dayPlan).forEach(k => { if (s.dayPlan[k] === id) delete s.dayPlan[k] })
|
||||
})
|
||||
nav('/plan')
|
||||
}}>Delete routine</button>
|
||||
<button className="btn danger" onClick={() => confirmSheet({
|
||||
title: 'Delete routine?', message: `“${r.name}” and its exercises will be removed.`, confirmText: 'Delete', danger: true,
|
||||
onConfirm: () => {
|
||||
update(s => {
|
||||
s.routines = s.routines.filter(x => x.id !== id)
|
||||
Object.keys(s.week).forEach(k => { if (s.week[k] === id) delete s.week[k] })
|
||||
Object.keys(s.dayPlan).forEach(k => { if (s.dayPlan[k] === id) delete s.dayPlan[k] })
|
||||
})
|
||||
nav('/plan')
|
||||
}
|
||||
})}>Delete routine</button>
|
||||
</div>
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { useStore, DEF, hasData } from '../store/useStore.js'
|
||||
import { useUI } from '../store/useUI.js'
|
||||
import { ACCENTS, todayISO } from '../lib/format.js'
|
||||
import { webauthnOK, passkeyLogin, passkeyRegister, IS_ANDROID } from '../lib/api.js'
|
||||
import { loadStarterPlan } from '../sheets.jsx'
|
||||
import { loadStarterPlan, confirmSheet } from '../sheets.jsx'
|
||||
|
||||
export default function Settings() {
|
||||
const nav = useNavigate()
|
||||
@@ -26,8 +26,7 @@ export default function Settings() {
|
||||
try {
|
||||
const data = JSON.parse(rd.result)
|
||||
if (!data.workouts || !data.routines) throw new Error('not an openGym backup')
|
||||
if (!confirm('Replace all current data with this backup?')) return
|
||||
replaceState(Object.assign(JSON.parse(JSON.stringify(DEF)), data), true); toast('Backup imported ✓')
|
||||
confirmSheet({ title: 'Import backup?', message: 'This replaces all current data with the backup file.', confirmText: 'Import', danger: true, onConfirm: () => { replaceState(Object.assign(JSON.parse(JSON.stringify(DEF)), data), true); toast('Backup imported ✓') } })
|
||||
} catch (e) { toast('Import failed: ' + e.message) }
|
||||
}
|
||||
rd.readAsText(f)
|
||||
@@ -45,7 +44,7 @@ export default function Settings() {
|
||||
<h2>Account</h2>
|
||||
{user ? <div className="row between">
|
||||
<div><b>{user.name}</b><div className="small muted">Signed in with passkey — data syncs to this profile.</div></div>
|
||||
<button className="btn sm danger" onClick={() => { if (confirm('Sign out? Local data is synced to your profile first, then cleared from this device.')) { signOut(); nav('/home') } }}>Sign out</button>
|
||||
<button className="btn sm danger" onClick={() => confirmSheet({ title: 'Sign out?', message: 'Your data is synced to your profile first, then cleared from this device.', confirmText: 'Sign out', danger: true, onConfirm: () => { signOut(); nav('/home') } })}>Sign out</button>
|
||||
</div> : <>
|
||||
<div className="small muted" style={{ marginBottom: 10 }}>Guest mode — data lives only in this browser. Create a passkey profile to keep it safe and separate per person.</div>
|
||||
{webauthnOK() ? <>
|
||||
@@ -89,7 +88,7 @@ export default function Settings() {
|
||||
<div style={{ height: 8 }} /><button className="btn" onClick={() => fileRef.current.click()}>⬆️ Import backup</button>
|
||||
<input ref={fileRef} type="file" accept=".json,application/json" style={{ display: 'none' }} onChange={doImport} />
|
||||
<div style={{ height: 8 }} /><button className="btn" onClick={loadStarterPlan}>Load starter plan (PPL)</button>
|
||||
<div style={{ height: 8 }} /><button className="btn danger" onClick={() => { if (confirm('Delete ALL data (plan, workouts, body weight)?') && confirm('Really sure? This cannot be undone.')) { replaceState(JSON.parse(JSON.stringify(DEF)), true); nav('/home'); toast('All data reset') } }}>Reset everything</button>
|
||||
<div style={{ height: 8 }} /><button className="btn danger" onClick={() => confirmSheet({ title: 'Reset everything?', message: 'Deletes your plan, workouts and body weight on this device. This cannot be undone.', confirmText: 'Delete everything', danger: true, onConfirm: () => { replaceState(JSON.parse(JSON.stringify(DEF)), true); nav('/home'); toast('All data reset') } })}>Reset everything</button>
|
||||
</div>
|
||||
|
||||
<div className="card"><h2>Tip</h2>
|
||||
|
||||
@@ -7,7 +7,7 @@ import { effectiveRoutine, lastEntryFor, bestWeightFor, buildSets, setsDoneActiv
|
||||
import { fmtNum, fmtDate, todayISO, DAYN } from '../lib/format.js'
|
||||
import { beep, vibrate } from '../lib/sound.js'
|
||||
import Media from '../components/Media.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet } from '../sheets.jsx'
|
||||
import { startFlow, exercisePicker, exConfigSheet, exerciseDetailSheet, topWeightSheet, finishWorkout, workoutCompleteSheet, confirmSheet } from '../sheets.jsx'
|
||||
|
||||
/* ---------- start chooser (no active workout) ---------- */
|
||||
function StartChooser() {
|
||||
@@ -144,7 +144,7 @@ function ActiveWorkout() {
|
||||
|
||||
return <div className="narrow">
|
||||
<div className="hdr">
|
||||
<button className="iconbtn" onClick={() => { if (confirm('Discard this workout? Logged sets will be lost.')) { update(s => { s.active = null }); stopRest(); nav('/home') } }}>✕</button>
|
||||
<button className="iconbtn" onClick={() => confirmSheet({ title: 'Discard workout?', message: 'The sets you logged in this session will be lost.', confirmText: 'Discard', danger: true, onConfirm: () => { update(s => { s.active = null }); stopRest(); nav('/home') } })}>✕</button>
|
||||
<div style={{ textAlign: 'center' }}><div style={{ fontWeight: 800 }}>{A.name}</div><div className="sub"><Elapsed start={A.start} /> · {done}/{total} sets</div></div>
|
||||
<button className="iconbtn" style={{ color: 'var(--acc)' }} onClick={finishWorkout}>✓</button>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user