feat(training-unit-editor): integrate new summary function and enhance combination exercise display
Deploy Development / deploy (push) Successful in 38s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Successful in 56s

- Introduced `summarizeSlotProfileBrief` utility for concise slot profile summaries, improving the display of combination exercises.
- Updated `CombinationCoachSlots` and `ExercisePeekModal` components to utilize the new summary function for better user experience.
- Enhanced `TrainingUnitSectionsEditor` to manage combination slots more effectively, including improved title handling and display options.
- Adjusted `TrainingPlanningPage` to support additional peek context for combination exercises, streamlining the planning process.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 4.6 committed 2026-05-13 14:11:53 +02:00
1 parent 805ad3c5a5
commit 5dc93d9a8c
6 files changed
+298 -59

No files matched your search

@@ -3,7 +3,7 @@ import { GripVertical, Pencil } from 'lucide-react'
import CombinationMethodProfileEditor from './CombinationMethodProfileEditor'
import CombinationCoachSlots from './CombinationCoachSlots'
import { comboPlanningProfileJsonForEditor, effectiveComboMethodProfile } from '../utils/comboPlanningMethodProfile'
import { combinationArchetypeLabel } from '../constants/combinationArchetypes'
import { combinationArchetypeLabel, sortCombinationSlotsForDisplay } from '../constants/combinationArchetypes'
import {
comboSlotsOutlineForProfileEditor,
defaultSection,
@@ -12,6 +12,7 @@ import {
sectionPlannedMinutes,
} from '../utils/trainingUnitSectionsForm'
import api from '../utils/api'
import { readSlotProfilesV1, summarizeSlotProfileBrief } from '../utils/combinationMethodProfileUi'
import { isCompactTagLegendMode } from '../config/planningModuleUx'
import { useAuth } from '../context/AuthContext'
@@ -77,6 +78,59 @@ function compactComboPlanningCaption(it) {
return archLbl ? `${archLbl} · wie Katalog` : 'wie im Katalog'
}
/** Globale Eckdaten aus effective profile (optional unter Stationenliste). */
function comboRoughGlobalTimingHint(profileObj, archetypeKey) {
if (!profileObj || typeof profileObj !== 'object' || Array.isArray(profileObj)) return null
const bits = []
const rounds = profileObj.rounds
const ws = profileObj.work_seconds
const rb = profileObj.rest_between_rounds_sec
const hint = profileObj.hint_step_duration_sec
const globRest = profileObj.rest_between_sets_sec
if (rounds != null && rounds !== '') bits.push(`${rounds} Runden`)
if (ws != null && ws !== '') bits.push(`${ws}s Arbeit`)
if (rb != null && rb !== '') bits.push(`Pause ${rb}s`)
if (globRest != null && globRest !== '') bits.push(`Sets-Pause ${globRest}s`)
if (hint != null && hint !== '') bits.push(`Orientierung ~${hint}s`)
const arch = (archetypeKey || '').trim()
if (arch === 'time_domain_interval') {
const iw = profileObj.interval_work_sec
const ir = profileObj.interval_rest_sec
const ig = profileObj.interval_groups
if (iw != null && iw !== '') bits.push(`${iw}s Intervall`)
if (ir != null && ir !== '') bits.push(`${ir}s Erholung`)
if (ig != null && ig !== '') bits.push(`${ig} Gruppen`)
}
return bits.length ? bits.join(' · ') : null
}
/** Pro Station eine kompakte Textzeile für die Planungsliste. */
function comboPlanningStripBulletTexts(it) {
const slots = sortCombinationSlotsForDisplay(it.combination_slots || [])
if (!slots.length) return []
const mp = effectiveComboMethodProfile(it.catalog_method_profile || {}, it.planning_method_profile)
const byIx = new Map(readSlotProfilesV1(mp).map((r) => [Number(r.slot_index), r]))
const titles = it.combo_member_title_by_id || {}
return slots.map((slot, idx) => {
const siRaw = slot.slot_index
const siParsed =
siRaw === '' || siRaw == null ? idx : typeof siRaw === 'number' ? siRaw : parseInt(String(siRaw), 10)
const ix = Number.isFinite(siParsed) ? siParsed : idx
const stationLbl = ((slot.title || '').trim() || `Station ${ix}`)
const candIds = (slot.candidate_exercise_ids || [])
.map((raw) => (typeof raw === 'number' ? raw : parseInt(String(raw), 10)))
.filter((n) => Number.isFinite(n))
const namesJoined =
candIds.length === 0
? '(keine Übung)'
: candIds.map((id) => titles[String(id)] || `Übung ${id}`).join(' ↔ ')
const timing = summarizeSlotProfileBrief(byIx.get(ix))
let line = `${stationLbl}: ${namesJoined}`
if (timing) line += ` · ${timing}`
return line
})
}
/** Stabile Farbzurodnung aus Modul-ID (nur Darstellung). */
function planningModulePalette(moduleId) {
const id = normalizedPlanningModuleChainId(moduleId)
@@ -964,6 +1018,24 @@ export default function TrainingUnitSectionsEditor({
? undefined
: Number(it.exercise_variant_id)
const stripArchRaw =
isCombination && it.exercise_id ? String(it.catalog_method_archetype || '').trim() : ''
const stripArchLbl =
stripArchRaw && isCombination ? combinationArchetypeLabel(stripArchRaw) : null
const stripBullets =
isCombination && it.exercise_id ? comboPlanningStripBulletTexts(it) : []
const stripMpEff =
isCombination && it.exercise_id
? effectiveComboMethodProfile(
it.catalog_method_profile || {},
it.planning_method_profile,
)
: null
const stripGlobalRough =
isCombination && it.exercise_id && stripMpEff
? comboRoughGlobalTimingHint(stripMpEff, stripArchRaw)
: null
return (
<Fragment key={`${insertSlotKeyPrefix}sec-${sIdx}-blk-${iIdx}`}>
{!planningCompactLegend &&
@@ -1047,7 +1119,16 @@ export default function TrainingUnitSectionsEditor({
type="button"
className="btn btn-secondary framework-ctrl framework-ctrl--xs"
onClick={() =>
onPeekExercise(Number(it.exercise_id), variantIdPeek)
onPeekExercise(
Number(it.exercise_id),
variantIdPeek,
isCombination
? {
catalog_method_profile: it.catalog_method_profile,
planning_method_profile: it.planning_method_profile,
}
: undefined,
)
}
>
Vorschau
@@ -1142,29 +1223,73 @@ export default function TrainingUnitSectionsEditor({
style={{
display: 'flex',
flexWrap: 'wrap',
alignItems: 'center',
gap: '8px 10px',
padding: '6px 12px 8px',
alignItems: 'flex-start',
gap: '10px',
padding: '8px 12px 10px',
paddingLeft: enableItemDragReorder ? 44 : 12,
borderTop: '1px solid var(--border)',
background: 'var(--surface2)',
}}
>
<span
<div
style={{
flex: '1 1 200px',
minWidth: 0,
fontSize: '0.78rem',
color: 'var(--text2)',
flex: '1 1 160px',
minWidth: 0,
lineHeight: 1.45,
}}
title="Ablaufprofil für diese Kombi in diesem Termin — Editor öffnen zum Anpassen"
title="Stationen und grobe Zeiten aus Katalog bzw. Planungs-Anpassung — Details unter „Ablauf bearbeiten“ oder „Vorschau“"
>
<strong style={{ color: 'var(--text1)', fontWeight: 600 }}>Ablauf:&nbsp;</strong>
<span>{compactComboPlanningCaption(it)}</span>
</span>
<div style={{ marginBottom: stripBullets.length || stripGlobalRough ? 6 : 0 }}>
<strong style={{ color: 'var(--text1)', fontWeight: 600 }}>Archetyp:&nbsp;</strong>
<span style={{ color: 'var(--text1)' }}>
{stripArchLbl || stripArchRaw || '—'}
{stripArchRaw && stripArchLbl && stripArchLbl !== stripArchRaw ? (
<span style={{ marginLeft: 6, fontWeight: 400, color: 'var(--text3)', fontSize: '0.72rem' }}>
({stripArchRaw})
</span>
) : null}
</span>
<span style={{ marginLeft: 10, fontWeight: 500 }}>{compactComboPlanningCaption(it)}</span>
</div>
{stripGlobalRough ? (
<div
style={{
marginBottom: stripBullets.length ? 6 : 0,
fontSize: '0.74rem',
color: 'var(--text3)',
}}
>
<strong style={{ color: 'var(--text2)', fontWeight: 600 }}>Block:&nbsp;</strong>
{stripGlobalRough}
</div>
) : null}
{stripBullets.length > 0 ? (
<ul
style={{
margin: 0,
paddingLeft: '1.05rem',
fontSize: '0.74rem',
color: 'var(--text2)',
}}
>
{stripBullets.map((line, bi) => (
<li key={`combo-strip-${sIdx}-${iIdx}-${bi}`} style={{ marginBottom: 2 }}>
{line}
</li>
))}
</ul>
) : (
<div style={{ fontSize: '0.74rem', color: 'var(--text3)', fontStyle: 'italic' }}>
Stationen laden oder noch keine Kombi-Stationen im Katalog …
</div>
)}
</div>
<button
type="button"
className="btn btn-secondary framework-ctrl framework-ctrl--xs"
style={{ flexShrink: 0 }}
aria-haspopup="dialog"
aria-label="Ablaufprofil Kombination für diese Planung bearbeiten"
onClick={() => setComboPlanningModal({ sIdx, iIdx })}