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

+68 -2
View File
@@ -1,10 +1,13 @@
/**
* Schnellansicht einer Übung aus dem Katalog (ohne die Planungsseite zu verlassen).
*/
import React, { useEffect, useState } from 'react'
import React, { useEffect, useMemo, useState } from 'react'
import { Link } from 'react-router-dom'
import api from '../utils/api'
import ExerciseRichTextBlock from './ExerciseRichTextBlock'
import CombinationCoachSlots from './CombinationCoachSlots'
import { combinationArchetypeLabel } from '../constants/combinationArchetypes'
import { effectiveComboMethodProfile } from '../utils/comboPlanningMethodProfile'
function TagMini({ exercise }) {
const parts = []
@@ -29,6 +32,8 @@ export default function ExercisePeekModal({
variantId,
onClose,
titleFallback,
/** Nur Planung: effektives method_profile aus Zeilen-Katalog + Planungs-Override */
peekExtras,
}) {
const [loading, setLoading] = useState(false)
const [err, setErr] = useState(null)
@@ -39,6 +44,22 @@ export default function ExercisePeekModal({
? exercise.variants.find((v) => String(v.id) === String(variantId)) || null
: null
const isCombination =
exercise &&
String(exercise.exercise_kind || 'simple').toLowerCase().trim() === 'combination'
const comboMethodProfileEffective = useMemo(() => {
if (!exercise || !isCombination) return {}
const fromPeek =
peekExtras?.catalog_method_profile &&
typeof peekExtras.catalog_method_profile === 'object' &&
!Array.isArray(peekExtras.catalog_method_profile) &&
Object.keys(peekExtras.catalog_method_profile).length > 0
? peekExtras.catalog_method_profile
: exercise.method_profile || {}
return effectiveComboMethodProfile(fromPeek, peekExtras?.planning_method_profile ?? null)
}, [exercise, isCombination, peekExtras])
useEffect(() => {
if (!open) {
setExercise(null)
@@ -69,6 +90,8 @@ export default function ExercisePeekModal({
if (!open) return null
const sheetWide = Boolean(isCombination && exercise && !loading)
return (
<div className="admin-modal-backdrop" role="presentation" onClick={(e) => e.target === e.currentTarget && onClose()}>
<div
@@ -77,7 +100,7 @@ export default function ExercisePeekModal({
aria-modal="true"
aria-labelledby="exercise-peek-title"
style={{
maxWidth: '620px',
maxWidth: sheetWide ? 'min(760px, 96vw)' : '620px',
width: '100%',
maxHeight: '88vh',
display: 'flex',
@@ -103,6 +126,49 @@ export default function ExercisePeekModal({
{!loading && err && <p style={{ color: 'var(--danger)' }}>{err}</p>}
{!loading && exercise && (
<>
{isCombination ? (
<>
<div
style={{
marginBottom: '12px',
padding: '8px 10px',
borderRadius: '8px',
background: 'var(--surface2)',
border: '1px solid var(--border)',
fontSize: '0.82rem',
color: 'var(--text2)',
lineHeight: 1.45,
}}
>
<strong style={{ color: 'var(--text1)' }}>Kombination</strong>
<span style={{ marginLeft: 8 }}>
{(() => {
const ak = String(exercise.method_archetype || '').trim()
const lbl = ak ? combinationArchetypeLabel(ak) : null
return lbl || ak || 'Archetyp nicht gesetzt'
})()}
</span>
{peekExtras?.planning_method_profile != null &&
typeof peekExtras.planning_method_profile === 'object' &&
!Array.isArray(peekExtras.planning_method_profile) ? (
<span style={{ marginLeft: 8, color: 'var(--accent-dark)', fontWeight: 600 }}>
· Planung angepasst
</span>
) : null}
</div>
<CombinationCoachSlots
combinationSlots={
Array.isArray(exercise.combination_slots) ? exercise.combination_slots : []
}
methodArchetype={exercise.method_archetype || ''}
methodProfile={comboMethodProfileEffective}
compactPlanningView
omitGlobalKeyValueBlock={false}
/>
<hr style={{ border: 'none', borderTop: '1px solid var(--border)', margin: '1rem 0' }} />
</>
) : null}
{variant ? (
<div
style={{