feat(training-unit-editor): enhance combination slots handling and UI improvements
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 39s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Successful in 1m1s
Deploy Development / deploy (push) Successful in 40s
Test Suite / pytest-backend (push) Successful in 39s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Successful in 1m1s
- Added support for `compactPlanningView` and `omitGlobalKeyValueBlock` in the CombinationCoachSlots component to improve display options. - Updated the TrainingUnitSectionsEditor to fetch and manage combination slots more effectively, including new state management for modal interactions. - Introduced a new utility function `comboSlotsOutlineForProfileEditor` to streamline the display of combination slots in the editor. - Enhanced UI elements for better user experience when managing combination exercises and their associated slots. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
13efce6e36
commit
805ad3c5a5
3 files changed
+154
-14
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import api from './api'
|
||||
import { sortCombinationSlotsForDisplay } from '../constants/combinationArchetypes'
|
||||
|
||||
export function defaultSection(title = 'Hauptteil') {
|
||||
return { title, guidance_notes: '', items: [] }
|
||||
@@ -116,6 +117,7 @@ export async function hydrateExercisePlanningRow(exercise) {
|
||||
row.catalog_method_archetype =
|
||||
typeof full.method_archetype === 'string' ? full.method_archetype.trim() : ''
|
||||
row.catalog_method_profile = normalizeCatalogMethodProfile(full.method_profile)
|
||||
row.combination_slots = Array.isArray(full.combination_slots) ? full.combination_slots : []
|
||||
}
|
||||
}
|
||||
row.planning_method_profile = null
|
||||
@@ -245,9 +247,10 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
unique.map(async (id) => {
|
||||
try {
|
||||
const ex = await api.getExercise(id)
|
||||
const ek = String(ex.exercise_kind || 'simple').toLowerCase().trim()
|
||||
cache.set(id, {
|
||||
title: ex.title || '',
|
||||
exercise_kind: String(ex.exercise_kind || 'simple').toLowerCase().trim(),
|
||||
exercise_kind: ek,
|
||||
variants: Array.isArray(ex.variants) ? ex.variants : [],
|
||||
visibility: ex.visibility || 'private',
|
||||
club_id: ex.club_id ?? null,
|
||||
@@ -255,6 +258,7 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
status: ex.status || 'draft',
|
||||
method_archetype: typeof ex.method_archetype === 'string' ? ex.method_archetype.trim() : '',
|
||||
method_profile: normalizeCatalogMethodProfile(ex.method_profile),
|
||||
combination_slots: ek === 'combination' && Array.isArray(ex.combination_slots) ? ex.combination_slots : [],
|
||||
})
|
||||
} catch {
|
||||
cache.set(id, {
|
||||
@@ -267,6 +271,7 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
status: 'draft',
|
||||
method_archetype: '',
|
||||
method_profile: {},
|
||||
combination_slots: [],
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -301,11 +306,29 @@ export async function enrichSectionsWithVariants(sections) {
|
||||
exercise_club_id: c.club_id,
|
||||
exercise_created_by: c.created_by,
|
||||
exercise_status: c.status,
|
||||
...(isCombo ? { combination_slots: c.combination_slots || [] } : {}),
|
||||
}
|
||||
}),
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Outline für CombinationMethodProfileEditor: pro‑Slot‑Zeiten nur sichtbar, wenn Stationen übergeben werden.
|
||||
*/
|
||||
export function comboSlotsOutlineForProfileEditor(combinationSlots) {
|
||||
if (!Array.isArray(combinationSlots) || combinationSlots.length === 0) return null
|
||||
const sorted = sortCombinationSlotsForDisplay(combinationSlots)
|
||||
return sorted.map((s, i) => {
|
||||
const rawIx = s.slot_index
|
||||
const si =
|
||||
rawIx === '' || rawIx == null ? null : typeof rawIx === 'number' ? rawIx : parseInt(String(rawIx), 10)
|
||||
return {
|
||||
slot_index: Number.isFinite(si) ? si : i,
|
||||
title: (s.title != null ? String(s.title) : '').trim(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function parseMin(v) {
|
||||
if (v === '' || v === null || v === undefined) return null
|
||||
const n = parseInt(String(v), 10)
|
||||
|
||||
Reference in new issue
Block a user