feat: enhance exercise selection and training unit management
- Updated ExercisePeekModal to support exercise variants, improving user experience when selecting exercises. - Enhanced ExercisePickerModal with multi-select functionality, allowing users to select multiple exercises at once. - Introduced drag-and-drop support for reordering training unit sections in TrainingUnitSectionsEditor, enhancing organization and usability. - Improved TrainingFrameworkProgramEditPage and TrainingPlanningPage to manage exercise selection and section movement across slots more effectively. - Added new CSS styles in app.css for better visual feedback during drag-and-drop actions and improved layout consistency.
This commit is contained in:
1 parent
354216cb4f
commit
2bfe67879f
6 files changed
+958
-411
No files matched your search
@@ -31,11 +31,22 @@ function TagMini({ exercise }) {
|
||||
)
|
||||
}
|
||||
|
||||
export default function ExercisePeekModal({ open, exerciseId, onClose, titleFallback }) {
|
||||
export default function ExercisePeekModal({
|
||||
open,
|
||||
exerciseId,
|
||||
variantId,
|
||||
onClose,
|
||||
titleFallback,
|
||||
}) {
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [err, setErr] = useState(null)
|
||||
const [exercise, setExercise] = useState(null)
|
||||
|
||||
const variant =
|
||||
variantId != null && variantId !== '' && exercise?.variants?.length
|
||||
? exercise.variants.find((v) => String(v.id) === String(variantId)) || null
|
||||
: null
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
setExercise(null)
|
||||
@@ -62,7 +73,7 @@ export default function ExercisePeekModal({ open, exerciseId, onClose, titleFall
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [open, exerciseId])
|
||||
}, [open, exerciseId, variantId])
|
||||
|
||||
if (!open) return null
|
||||
|
||||
@@ -100,6 +111,37 @@ export default function ExercisePeekModal({ open, exerciseId, onClose, titleFall
|
||||
{!loading && err && <p style={{ color: 'var(--danger)' }}>{err}</p>}
|
||||
{!loading && exercise && (
|
||||
<>
|
||||
{variant ? (
|
||||
<div
|
||||
style={{
|
||||
marginBottom: '0.75rem',
|
||||
padding: '8px 10px',
|
||||
borderRadius: '8px',
|
||||
background: 'var(--surface2)',
|
||||
border: '1px solid var(--border)',
|
||||
}}
|
||||
>
|
||||
<div style={{ fontSize: '0.78rem', fontWeight: 700, color: 'var(--text3)', marginBottom: 4 }}>
|
||||
Variante
|
||||
</div>
|
||||
<div style={{ fontWeight: 700, fontSize: '0.95rem' }}>
|
||||
{variant.variant_name || `Variante #${variant.id}`}
|
||||
</div>
|
||||
{variant.description ? (
|
||||
<div style={{ marginTop: 8, fontSize: '0.9rem', color: 'var(--text2)' }}>
|
||||
<HtmlBlock html={variant.description} />
|
||||
</div>
|
||||
) : null}
|
||||
{variant.execution_changes ? (
|
||||
<div style={{ marginTop: 10 }}>
|
||||
<h4 style={{ fontSize: '0.85rem', color: 'var(--text3)', marginBottom: 6 }}>
|
||||
Durchführung (Variante)
|
||||
</h4>
|
||||
<HtmlBlock html={variant.execution_changes} />
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
{exercise.summary && (
|
||||
<div style={{ fontSize: '0.95rem', color: 'var(--text2)' }}>
|
||||
<HtmlBlock html={exercise.summary} />
|
||||
|
||||
Reference in new issue
Block a user