Update version to 0.8.148 and enhance training plan template functionality
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
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
- 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.
This commit is contained in:
1 parent
1684892bcb
commit
f15aa7c415
10 files changed
+583
-32
No files matched your search
@@ -266,6 +266,8 @@ export default function TrainingUnitSectionsEditor({
|
||||
betweenInsertMenus = true,
|
||||
/** Trainingsplanung: Phasen/Streams anlegen und Abschnitte zuordnen */
|
||||
enableParallelPhaseControls = false,
|
||||
/** Nur Abschnitts-Gliederung (Vorlagen): keine Übungen/Anmerkungen */
|
||||
structureOnly = false,
|
||||
}) {
|
||||
const { user } = useAuth()
|
||||
const planningCompactLegend = isCompactTagLegendMode(
|
||||
@@ -2021,15 +2023,17 @@ export default function TrainingUnitSectionsEditor({
|
||||
</select>
|
||||
</div>
|
||||
) : null}
|
||||
{planMin > 0 && (
|
||||
{!structureOnly && planMin > 0 && (
|
||||
<p style={{ fontSize: '0.78rem', color: 'var(--text2)', marginTop: '0.35rem' }}>
|
||||
Geplant in diesem Abschnitt: ca. {planMin} Min. (Übungen)
|
||||
</p>
|
||||
)}
|
||||
|
||||
{betweenInsertMenus ? renderBetweenInsertBand(sIdx, 0, itemCount) : null}
|
||||
{!structureOnly ? (
|
||||
<>
|
||||
{betweenInsertMenus ? renderBetweenInsertBand(sIdx, 0, itemCount) : null}
|
||||
|
||||
{(sec.items || []).map((it, iIdx) => {
|
||||
{(sec.items || []).map((it, iIdx) => {
|
||||
const dropHere =
|
||||
enableItemDragReorder &&
|
||||
dropTargetPos?.sIdx === sIdx &&
|
||||
@@ -2541,6 +2545,8 @@ export default function TrainingUnitSectionsEditor({
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
{useStreamTagDropUx && pl?.phaseKind === 'parallel' && parallelPhaseOrder != null
|
||||
? (() => {
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
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>
|
||||
)
|
||||
}
|
||||
@@ -653,6 +653,7 @@ function TrainingPlanningPageRoot() {
|
||||
const handleSaveAsTemplate = async (opts = {}) => {
|
||||
const name = window.prompt('Name für die neue Trainingsvorlage (nur Abschnitts-Gliederung):')
|
||||
if (!name?.trim()) return
|
||||
const descRaw = window.prompt('Kurzbeschreibung (optional, leer lassen zum Überspringen):')
|
||||
const visibility =
|
||||
typeof opts.visibility === 'string' && opts.visibility.trim()
|
||||
? String(opts.visibility).trim().toLowerCase()
|
||||
@@ -673,6 +674,7 @@ function TrainingPlanningPageRoot() {
|
||||
try {
|
||||
await api.createTrainingPlanTemplate({
|
||||
name: name.trim(),
|
||||
description: descRaw?.trim() ? descRaw.trim() : null,
|
||||
visibility,
|
||||
club_id: visibility === 'club' ? club_id : null,
|
||||
sections: templateSectionsPayloadFromFormSections(formData.sections),
|
||||
|
||||
Reference in new issue
Block a user