shinkan-jinkendo/frontend/src/components/planning/PlanTemplateStructurePreview.jsx
Lars f15aa7c415
All checks were successful
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 37s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m7s
Update version to 0.8.148 and enhance training plan template functionality
- Incremented app version to 0.8.148 and updated changelog to reflect new features.
- Improved the training plan template structure by adding a preview of sections, including support for split sessions.
- Introduced a new editing page for training plan templates, allowing users to modify templates directly.
- Enhanced the TrainingPlanningPageRoot to include a description field when saving templates, improving user guidance.
- Updated permissions to allow editing of training plan templates based on user roles.
2026-05-19 10:13:26 +02:00

54 lines
1.5 KiB
JavaScript

import React, { useMemo } from 'react'
import { formatPlanTemplateStructurePreview } from '../../utils/trainingUnitSectionsForm'
export default function PlanTemplateStructurePreview({ sections, compact = false }) {
const preview = useMemo(() => formatPlanTemplateStructurePreview(sections), [sections])
if (preview.isEmpty) {
return (
<p style={{ margin: 0, fontSize: compact ? '0.82rem' : '0.88rem', color: 'var(--text3)' }}>
Noch keine Abschnitte definiert.
</p>
)
}
return (
<ul
className="plan-template-structure-preview"
style={{
listStyle: 'none',
margin: compact ? '0.35rem 0 0' : '0.5rem 0 0',
padding: 0,
display: 'grid',
gap: compact ? '0.35rem' : '0.45rem',
}}
>
{preview.lines.map((line, idx) => (
<li
key={`${line.kind}-${line.label}-${idx}`}
style={{
fontSize: compact ? '0.82rem' : '0.88rem',
lineHeight: 1.45,
color: 'var(--text2)',
}}
>
<span
style={{
display: 'inline-block',
fontSize: '0.72rem',
fontWeight: 700,
letterSpacing: '0.02em',
textTransform: 'uppercase',
color: line.kind === 'parallel' ? 'var(--accent-dark)' : 'var(--text3)',
marginRight: '0.45rem',
}}
>
{line.label}
</span>
<span style={{ color: 'var(--text1)' }}>{line.detail}</span>
</li>
))}
</ul>
)
}