feat(combo-planning): enhance candidate interaction and UI for combination exercises
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / playwright-tests (push) Successful in 57s
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / playwright-tests (push) Successful in 57s
- Introduced new CSS styles for interactive candidate buttons and links in the `CombinationPlanBracket` and `CombinationCoachSlots` components, improving user engagement. - Updated `CombinationPlanBracket` to conditionally render candidates as buttons or links based on interaction type, enhancing navigation options. - Refactored candidate handling in `CombinationCoachSlots` to support new interaction methods, streamlining candidate exercise display. - Enhanced `ExercisePeekModal` and related components to support candidate peek functionality, allowing for a more seamless user experience. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
00edc7a93d
commit
502dddd3b3
10 files changed
+270
-109
No files matched your search
@@ -5,7 +5,6 @@ import ExerciseRichTextBlock from '../components/ExerciseRichTextBlock'
|
||||
import ExerciseAttachmentMediaStrip from '../components/ExerciseAttachmentMediaStrip'
|
||||
import CombinationPlanBracket from '../components/CombinationPlanBracket'
|
||||
import { formatSkillLevelSlug } from '../constants/skillLevels'
|
||||
import { sortCombinationSlotsForDisplay } from '../constants/combinationArchetypes'
|
||||
|
||||
function TagRow({ exercise }) {
|
||||
const tags = []
|
||||
@@ -52,28 +51,6 @@ function metaParts(exercise) {
|
||||
return parts
|
||||
}
|
||||
|
||||
/** Eindeutige Kandidaten-Übungen für Schnellnavigation unter der Klammerdarstellung */
|
||||
function flattenCombinationCandidateLinks(slots) {
|
||||
const rows = []
|
||||
const seen = new Set()
|
||||
sortCombinationSlotsForDisplay(slots || []).forEach((s) => {
|
||||
const cands =
|
||||
s.candidates && s.candidates.length
|
||||
? s.candidates
|
||||
: (s.candidate_exercise_ids || []).map((id) => ({
|
||||
exercise_id: id,
|
||||
title: null,
|
||||
}))
|
||||
cands.forEach((c) => {
|
||||
const eid = c.exercise_id
|
||||
if (eid == null || seen.has(eid)) return
|
||||
seen.add(eid)
|
||||
rows.push({ exercise_id: eid, title: (c.title || '').trim() || null })
|
||||
})
|
||||
})
|
||||
return rows
|
||||
}
|
||||
|
||||
function ExerciseDetailPage() {
|
||||
const { id } = useParams()
|
||||
const navigate = useNavigate()
|
||||
@@ -135,9 +112,6 @@ function ExerciseDetailPage() {
|
||||
(exercise.exercise_kind || '').toLowerCase().trim() === 'combination' &&
|
||||
Array.isArray(exercise.combination_slots) &&
|
||||
exercise.combination_slots.length > 0
|
||||
const combinationCandidateLinks = isCombinationDetail
|
||||
? flattenCombinationCandidateLinks(exercise.combination_slots)
|
||||
: []
|
||||
const catalogMethodProfileForBracket =
|
||||
exercise.method_profile &&
|
||||
typeof exercise.method_profile === 'object' &&
|
||||
@@ -186,20 +160,9 @@ function ExerciseDetailPage() {
|
||||
methodProfile={catalogMethodProfileForBracket}
|
||||
combinationSlots={exercise.combination_slots}
|
||||
planningAdjusted={false}
|
||||
candidateInteraction="link"
|
||||
/>
|
||||
</div>
|
||||
{combinationCandidateLinks.length > 0 ? (
|
||||
<div style={{ marginTop: '14px', fontSize: '0.88rem' }}>
|
||||
<div style={{ fontWeight: 600, marginBottom: '6px', color: 'var(--text2)' }}>Verknüpfte Einzelübungen</div>
|
||||
<ul style={{ margin: 0, paddingLeft: '1.2rem' }}>
|
||||
{combinationCandidateLinks.map((c) => (
|
||||
<li key={c.exercise_id}>
|
||||
<Link to={`/exercises/${c.exercise_id}`}>{c.title || `Übung #${c.exercise_id}`}</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
) : null}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom'
|
||||
import api from '../utils/api'
|
||||
import ExerciseFullContent from '../components/ExerciseFullContent'
|
||||
import ExercisePeekModal from '../components/ExercisePeekModal'
|
||||
import {
|
||||
flattenPlanTimeline,
|
||||
itemStableKey,
|
||||
@@ -178,6 +179,7 @@ export default function TrainingCoachPage() {
|
||||
const [trainerAppend, setTrainerAppend] = useState('')
|
||||
const [saveMarkDone, setSaveMarkDone] = useState(true)
|
||||
const [saving, setSaving] = useState(false)
|
||||
const [candidatePeekId, setCandidatePeekId] = useState(null)
|
||||
const [saveOk, setSaveOk] = useState(null)
|
||||
|
||||
const reloadUnit = useCallback(async () => {
|
||||
@@ -460,6 +462,12 @@ export default function TrainingCoachPage() {
|
||||
|
||||
return (
|
||||
<div className="training-coach-page training-coach-layout">
|
||||
<ExercisePeekModal
|
||||
key={candidatePeekId != null ? String(candidatePeekId) : 'coach-peek-closed'}
|
||||
open={candidatePeekId != null}
|
||||
exerciseId={candidatePeekId}
|
||||
onClose={() => setCandidatePeekId(null)}
|
||||
/>
|
||||
<nav
|
||||
className="no-print training-coach-meta-nav"
|
||||
style={{
|
||||
@@ -750,6 +758,7 @@ export default function TrainingCoachPage() {
|
||||
? currentEntry?.item?.planning_method_profile ?? null
|
||||
: null
|
||||
}
|
||||
onCandidateExercisePeek={(id) => setCandidatePeekId(id)}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -1223,6 +1223,7 @@ export default function TrainingFrameworkProgramEditPage() {
|
||||
/>
|
||||
|
||||
<ExercisePeekModal
|
||||
key={peekCtx != null ? String(peekCtx.exerciseId) : 'fw-peek-closed'}
|
||||
open={peekCtx != null}
|
||||
exerciseId={peekCtx?.exerciseId || 0}
|
||||
variantId={peekCtx?.variantId ?? undefined}
|
||||
|
||||
@@ -3087,6 +3087,7 @@ function TrainingPlanningPage() {
|
||||
}}
|
||||
/>
|
||||
<ExercisePeekModal
|
||||
key={planningPeekCtx != null ? String(planningPeekCtx.exerciseId) : 'plan-peek-closed'}
|
||||
open={planningPeekCtx != null}
|
||||
exerciseId={planningPeekCtx?.exerciseId}
|
||||
variantId={planningPeekCtx?.variantId ?? undefined}
|
||||
|
||||
Reference in new issue
Block a user