Home: an einem Ruhetag steht dort, wann die naechste Einheit ist
Die Today-Zeile war an einem Ruhetag eine Sackgasse: "Pausentag", Punkt. Die Antwort auf die naechstliegende Frage — wann dann? — steht schon im State, nur hat sie nie jemand ausgesprochen. nextTrainingDay() sitzt neben effectiveRoutine und schaut ab morgen sieben Tage voraus. Es nimmt ein ISO-Datum statt die Uhr zu lesen, damit Aufrufer und Tests sich einig sind, was "heute" ist. Ein Tag mit einer Routine ohne Uebungen zaehlt nicht: den zu starten landet in einer leeren Session, ist also keine Antwort (dieselbe Bedingung, die auch die TabBar vor dem Start prueft). Verschiebungen aus dayPlan gelten in beide Richtungen — ein auf 'rest' gesetzter Tag faellt raus, ein per Datum eingeplanter kommt rein. Ist die ganze Woche Pause: null, und die Zeile bleibt wie sie war. Angezeigt nur, wenn heute wirklich nichts ansteht — kein laufendes Training, keine Routine, kein schon erledigtes Training. Strings in allen vierzehn Sprachen, pt-BR-Fingerabdruck nachgezogen.
This commit is contained in:
1 parent
45c4756cd0
commit
ddaaf12929
17 files changed
+90
-5
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { useState } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { useStore } from '../store/useStore.js'
|
||||
import { effectiveRoutine, effectiveRoutineId, streakWeeks, lastBW, setsDoneActive } from '../lib/history.js'
|
||||
import { fmtNum, fmtDate, todayISO, isoOf, weekKey, DAYS } from '../lib/format.js'
|
||||
import { effectiveRoutine, effectiveRoutineId, nextTrainingDay, streakWeeks, lastBW, setsDoneActive } from '../lib/history.js'
|
||||
import { fmtNum, fmtDate, todayISO, isoOf, weekKey, DAYS, DAYN } from '../lib/format.js'
|
||||
import { t, dateLocale } from '../lib/i18n.js'
|
||||
import { bwSheet, goalSheet, dayOverrideSheet, calendarSheet, startFlow, loadStarterPlan, bwDeltaColor } from '../sheets.jsx'
|
||||
import LineChart from '../components/LineChart.jsx'
|
||||
@@ -21,6 +21,8 @@ export default function Home() {
|
||||
const today = new Date()
|
||||
const routine = effectiveRoutine(S, todayISO())
|
||||
const todayOvr = S.dayPlan[todayISO()] !== undefined
|
||||
// On a rest day, saying when you train next beats leaving the row as a full stop.
|
||||
const next = !S.active && !routine ? nextTrainingDay(S, todayISO()) : null
|
||||
const bw = lastBW(S)
|
||||
const prevBW = S.bodyweight.length > 1 ? S.bodyweight[S.bodyweight.length - 2] : null
|
||||
const delta = bw && prevBW ? bw.w - prevBW.w : null
|
||||
@@ -78,6 +80,7 @@ export default function Home() {
|
||||
<div className="ttl">{S.active ? t('{0} — in progress', S.active.name)
|
||||
: doneToday ? (doneToday.name ? t('{0} — done', doneToday.name) : t('Workout done'))
|
||||
: routine ? routine.name : t('Rest day')}{todayOvr && routine && !doneToday ? ' · ' + t('rescheduled') : ''}</div>
|
||||
{next && !doneToday && <div className="ss">{t('Next session: {0}, {1}', t(DAYN[next.weekday]), next.routine.name)}</div>}
|
||||
</div>
|
||||
</div>
|
||||
{S.active ? <span className="tag" style={{ color: 'var(--orange)', background: 'color-mix(in srgb,var(--orange) 16%,transparent)' }}>{t('Resume')}</span>
|
||||
|
||||
Reference in new issue
Block a user