Enhance TrainingCoachPage and TrainingUnitRunPage with improved coach focus handling and UI updates
Deploy Development / deploy (push) Successful in 38s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m8s
Deploy Development / deploy (push) Successful in 38s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m8s
- Updated TrainingCoachPage to incorporate coach focus parameters from search queries, allowing for more precise control over displayed training streams. - Refactored session storage handling to better manage state related to coach focus, ensuring accurate step tracking during training sessions. - Enhanced TrainingUnitRunPage with improved layout for stream titles and added links for direct navigation to coaching views, improving user experience. - Introduced new utility functions in trainingPlanUtils for managing coach stream focus options and duration overrides, streamlining data handling across components.
This commit is contained in:
1 parent
c182ced7cd
commit
4cf7133bce
3 files changed
+234
-40
No files matched your search
@@ -208,8 +208,9 @@ function coachContextLabelForSection(sec, sectionsList) {
|
||||
return `Parallel · ${pt} · ${st}`
|
||||
}
|
||||
|
||||
/** Flache Reihenfolge für Coach-Timeline (global wie im Editor, inkl. gemischter Split-Abschnitte). */
|
||||
export function flattenPlanTimeline(unit) {
|
||||
/** Flache Reihenfolge für Coach-Timeline.
|
||||
* @param {object|null} coachFocus `{ phaseOrder, streamOrder }` = nur dieser Stream in dieser parallelen Phase; andere Split-Phasen weiterhin voll (alle Streams verschränkt). Null = Gesamtplan.*/
|
||||
export function flattenPlanTimeline(unit, coachFocus = null) {
|
||||
const sections = sectionsWithPlanLocForDisplay(unit)
|
||||
const model = buildPlanRunViewModelFromSections(sections)
|
||||
if (model.mode === 'empty') return []
|
||||
@@ -232,15 +233,78 @@ export function flattenPlanTimeline(unit) {
|
||||
})
|
||||
}
|
||||
|
||||
const f = coachFocus
|
||||
for (const run of model.runs) {
|
||||
for (const sec of run.globalOrderSections) {
|
||||
pushSectionItems(sec, coachContextLabelForSection(sec, sections))
|
||||
if (run.kind === 'legacy' || run.kind === 'whole_group') {
|
||||
for (const sec of run.globalOrderSections) {
|
||||
pushSectionItems(sec, coachContextLabelForSection(sec, sections))
|
||||
}
|
||||
continue
|
||||
}
|
||||
if (run.kind === 'parallel') {
|
||||
if (f == null || run.phaseOrderIndex !== f.phaseOrder) {
|
||||
for (const sec of run.globalOrderSections) {
|
||||
pushSectionItems(sec, coachContextLabelForSection(sec, sections))
|
||||
}
|
||||
} else {
|
||||
const st = run.streams?.find((x) => x.streamOrder === f.streamOrder)
|
||||
if (st?.sections?.length) {
|
||||
for (const sec of st.sections) {
|
||||
pushSectionItems(sec, coachContextLabelForSection(sec, sections))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
/** Optionen für Coach-Stream-Auswahl (phases · Gruppe). */
|
||||
export function listCoachStreamFocusOptions(unit) {
|
||||
const model = buildPlanRunViewModelFromSections(sectionsWithPlanLocForDisplay(unit))
|
||||
const opts = []
|
||||
for (const run of model.runs) {
|
||||
if (run.kind !== 'parallel' || !run.streams?.length) continue
|
||||
const phaseLabel =
|
||||
run.phaseTitle != null && String(run.phaseTitle).trim()
|
||||
? String(run.phaseTitle).trim()
|
||||
: `Phase ${run.phaseOrderIndex}`
|
||||
for (const st of run.streams) {
|
||||
const gl =
|
||||
st.streamTitle != null && String(st.streamTitle).trim()
|
||||
? String(st.streamTitle).trim()
|
||||
: `Gruppe ${st.streamOrder + 1}`
|
||||
opts.push({
|
||||
phaseOrder: run.phaseOrderIndex,
|
||||
streamOrder: st.streamOrder,
|
||||
label: `${phaseLabel} · ${gl}`,
|
||||
valueKey: `${run.phaseOrderIndex}-${st.streamOrder}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
||||
/** Alle Ist-Minuten-Overrides aus lokalem Delta-State für PUT (unabhängig von gefilterter Coach-Timeline). */
|
||||
export function durationOverridesMapFromDeltas(unit, deltas) {
|
||||
const out = {}
|
||||
if (!unit || !deltas || typeof deltas !== 'object') return out
|
||||
const sections = sortedSections(unit)
|
||||
sections.forEach((sec, si) => {
|
||||
const secOrder = sec.order_index ?? si
|
||||
sortedItems(sec).forEach((it, ii) => {
|
||||
if (it.item_type !== 'exercise' || it.id == null) return
|
||||
const k = itemStableKey(it, secOrder, ii)
|
||||
const dv = deltas[k]?.actual_duration_min
|
||||
if (dv !== undefined && dv !== '' && dv !== null && !Number.isNaN(Number(dv))) {
|
||||
out[String(it.id)] = { actual_duration_min: Number(dv) }
|
||||
}
|
||||
})
|
||||
})
|
||||
return out
|
||||
}
|
||||
|
||||
export function summarizeTimelineEntry({ item }) {
|
||||
if (!item) return ''
|
||||
if (item.item_type === 'note') {
|
||||
|
||||
Reference in new issue
Block a user