feat: refactor TrainingUnitSectionsEditor and enhance TrainingPlanningPage layout
Deploy Development / deploy (push) Successful in 35s
Test Suite / pytest-backend (push) Successful in 7s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 23s
Deploy Development / deploy (push) Successful in 35s
Test Suite / pytest-backend (push) Successful in 7s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Successful in 23s
- Replaced the tu-ex-run-block with a new tu-ex-debrief layout using CSS Grid for improved structure and responsiveness. - Updated the TrainingUnitSectionsEditor component to utilize the new layout, enhancing the user experience for inputting modifications and actual durations. - Introduced a sectionsEditMode state in TrainingPlanningPage to manage different editing modes (planning, refine, debrief) for better user guidance. - Adjusted the visibility of execution extras based on the current editing mode, streamlining the interface for users.
This commit is contained in:
1 parent
56ea36ea25
commit
00b22a756f
3 files changed
+133
-25
No files matched your search
@@ -118,6 +118,8 @@ function TrainingPlanningPage() {
|
||||
const [loading, setLoading] = useState(true)
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
const [editingUnit, setEditingUnit] = useState(null)
|
||||
/** Abschnitts-Editor: Planung / strukturelle Überarbeitung (ohne Ist-Felder) / Nachbereitung (Ist & Abweichungen) */
|
||||
const [sectionsEditMode, setSectionsEditMode] = useState('planning')
|
||||
const [draftPlanTemplateId, setDraftPlanTemplateId] = useState('')
|
||||
const [quickTemplateId, setQuickTemplateId] = useState('')
|
||||
const [exercisePickerOpen, setExercisePickerOpen] = useState(false)
|
||||
@@ -505,6 +507,7 @@ function TrainingPlanningPage() {
|
||||
sections: [defaultSection('Hauptteil')],
|
||||
...sessionAssignDefaults()
|
||||
})
|
||||
setSectionsEditMode('planning')
|
||||
setShowModal(true)
|
||||
}
|
||||
|
||||
@@ -532,6 +535,7 @@ function TrainingPlanningPage() {
|
||||
sections: [defaultSection('Hauptteil')],
|
||||
...sessionAssignDefaults()
|
||||
})
|
||||
setSectionsEditMode('planning')
|
||||
setShowModal(true)
|
||||
}
|
||||
|
||||
@@ -593,6 +597,7 @@ function TrainingPlanningPage() {
|
||||
return xs
|
||||
})(),
|
||||
})
|
||||
setSectionsEditMode(fullUnit.status === 'completed' ? 'debrief' : 'planning')
|
||||
setShowModal(true)
|
||||
} catch (err) {
|
||||
alert('Fehler beim Laden: ' + err.message)
|
||||
@@ -2254,6 +2259,67 @@ function TrainingPlanningPage() {
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: '2rem' }}>
|
||||
{editingUnit ? (
|
||||
<div style={{ marginBottom: '1rem' }}>
|
||||
<div
|
||||
role="radiogroup"
|
||||
aria-label="Modus für Abschnitte und Übungen"
|
||||
style={{
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
alignItems: 'center',
|
||||
gap: '10px',
|
||||
}}
|
||||
>
|
||||
<span className="form-label" style={{ marginBottom: 0, fontSize: '0.82rem' }}>
|
||||
Ablauf bearbeiten als
|
||||
</span>
|
||||
<div
|
||||
style={{
|
||||
display: 'inline-flex',
|
||||
borderRadius: '10px',
|
||||
border: '1.5px solid var(--border2)',
|
||||
overflow: 'hidden',
|
||||
background: 'var(--surface2)',
|
||||
}}
|
||||
>
|
||||
{[
|
||||
{ id: 'planning', label: 'Planung' },
|
||||
{ id: 'refine', label: 'Überarbeiten' },
|
||||
{ id: 'debrief', label: 'Nachbereitung' },
|
||||
].map((opt, i) => (
|
||||
<button
|
||||
key={opt.id}
|
||||
type="button"
|
||||
role="radio"
|
||||
aria-checked={sectionsEditMode === opt.id}
|
||||
onClick={() => setSectionsEditMode(opt.id)}
|
||||
style={{
|
||||
border: 'none',
|
||||
padding: '8px 14px',
|
||||
fontWeight: 600,
|
||||
fontSize: '0.85rem',
|
||||
cursor: 'pointer',
|
||||
background: sectionsEditMode === opt.id ? 'var(--accent-dark)' : 'transparent',
|
||||
color: sectionsEditMode === opt.id ? '#fff' : 'var(--text1)',
|
||||
whiteSpace: 'nowrap',
|
||||
...(i > 0 ? { borderLeft: '1.5px solid var(--border2)' } : {}),
|
||||
}}
|
||||
>
|
||||
{opt.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<p style={{ margin: '0.35rem 0 0', fontSize: '0.82rem', color: 'var(--text3)', lineHeight: 1.45 }}>
|
||||
{sectionsEditMode === 'debrief'
|
||||
? 'Ist‑Minuten rechts in derselben Spaltenbreite wie „Min“ (Plan); Abweichungen als Text über die volle Breite.'
|
||||
: sectionsEditMode === 'refine'
|
||||
? 'Struktur, Übungen und geplante Zeiten anpassen — ohne Ist‑Angaben in den Zeilen (wie Planung).'
|
||||
: 'Ablauf und geplante Minuten bearbeiten. Ist‑Werte und Abweichungen nur unter „Nachbereitung“.'}
|
||||
</p>
|
||||
</div>
|
||||
) : null}
|
||||
<TrainingUnitSectionsEditor
|
||||
heading="Abschnitte & Übungen"
|
||||
headingAccessory={
|
||||
@@ -2279,7 +2345,7 @@ function TrainingPlanningPage() {
|
||||
onPeekExercise={(id, variantId) =>
|
||||
setPlanningPeekCtx({ exerciseId: id, variantId: variantId ?? null })
|
||||
}
|
||||
showExecutionExtras={!!editingUnit}
|
||||
showExecutionExtras={Boolean(editingUnit) && sectionsEditMode === 'debrief'}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in new issue
Block a user