Update version information and add training duration features
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m22s
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Successful in 38s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m22s
- Bumped application version to 0.8.150 and updated build date and database schema version. - Introduced new SQL migration for planned duration fields in training units and sections. - Added functions to handle focus areas and style directions in training framework programs. - Enhanced training planning components to support planned duration input and display. - Updated frontend components to manage and display planned duration for training units and sections.
This commit is contained in:
1 parent
ab612a5335
commit
5a8a212f40
12 files changed
+629
-149
No files matched your search
@@ -25,6 +25,7 @@ import {
|
||||
swapAdjacentPhaseRuns,
|
||||
reorderBlocksImmutableWithPlanLoc,
|
||||
reorderSectionBeforeParallelRunAsWholeGroup,
|
||||
reorderSectionAfterParallelRunAsWholeGroup,
|
||||
reorderSectionAsFirstInParallelStream,
|
||||
reorderBlockIntoParallelStreamEnd,
|
||||
globalInsertBeforeIndexForParallelStreamEnd,
|
||||
@@ -37,6 +38,7 @@ import {
|
||||
noteRow,
|
||||
sectionPlannedMinutes,
|
||||
} from '../utils/trainingUnitSectionsForm'
|
||||
import { formatDurationDisplay, parseDurationInput } from '../utils/trainingDurationUtils'
|
||||
import api from '../utils/api'
|
||||
import { isCompactTagLegendMode } from '../config/planningModuleUx'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
@@ -274,6 +276,19 @@ export default function TrainingUnitSectionsEditor({
|
||||
user?.training_planning_prefs?.module_display_mode
|
||||
)
|
||||
|
||||
const [useCompactPhaseMoves, setUseCompactPhaseMoves] = useState(() =>
|
||||
typeof window !== 'undefined'
|
||||
? window.matchMedia('(max-width: 768px)').matches
|
||||
: false
|
||||
)
|
||||
useEffect(() => {
|
||||
const mq = window.matchMedia('(max-width: 768px)')
|
||||
const apply = () => setUseCompactPhaseMoves(!!mq.matches)
|
||||
apply()
|
||||
mq.addEventListener('change', apply)
|
||||
return () => mq.removeEventListener('change', apply)
|
||||
}, [])
|
||||
|
||||
const ensure = (prev) =>
|
||||
prev && prev.length ? prev : [defaultSection()]
|
||||
|
||||
@@ -1299,6 +1314,47 @@ export default function TrainingUnitSectionsEditor({
|
||||
return sIdx === 0
|
||||
}
|
||||
|
||||
const moveSectionToPlanTarget = (sIdx, rawKey) => {
|
||||
if (!rawKey) return
|
||||
patch((prev) => {
|
||||
const opts = planSelectOptionsForSection(prev, sIdx, buildPlanTargetOptions(prev))
|
||||
const hit = opts.find((o) => o.key === rawKey)
|
||||
if (!hit) return prev
|
||||
const tpl = { ...hit.template }
|
||||
let next = prev.map((s, i) => (i === sIdx ? { ...s, planLoc: tpl } : s))
|
||||
if (enableParallelPhaseControls) next = afterSectionReorderParallelGuard(prev, next)
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
const moveSectionToWholeGroupAbove = (sIdx) => {
|
||||
const sec = list[sIdx]
|
||||
const po = sec?.planLoc?.phaseOrderIndex ?? 0
|
||||
if (sec?.planLoc?.phaseKind === 'parallel') {
|
||||
patch((prev) => {
|
||||
let next = reorderSectionBeforeParallelRunAsWholeGroup(prev, sIdx, po)
|
||||
if (enableParallelPhaseControls) next = afterSectionReorderParallelGuard(prev, next)
|
||||
return next
|
||||
})
|
||||
} else {
|
||||
moveSection(sIdx, -1)
|
||||
}
|
||||
}
|
||||
|
||||
const moveSectionToWholeGroupBelow = (sIdx) => {
|
||||
const sec = list[sIdx]
|
||||
const po = sec?.planLoc?.phaseOrderIndex ?? 0
|
||||
if (sec?.planLoc?.phaseKind === 'parallel') {
|
||||
patch((prev) => {
|
||||
let next = reorderSectionAfterParallelRunAsWholeGroup(prev, sIdx, po)
|
||||
if (enableParallelPhaseControls) next = afterSectionReorderParallelGuard(prev, next)
|
||||
return next
|
||||
})
|
||||
} else {
|
||||
moveSection(sIdx, 1)
|
||||
}
|
||||
}
|
||||
|
||||
const sectionMoveDisabledDown = (sIdx) => {
|
||||
const sec = list[sIdx]
|
||||
const L = sec?.planLoc
|
||||
@@ -2004,28 +2060,74 @@ export default function TrainingUnitSectionsEditor({
|
||||
}
|
||||
placeholder="Hinweise zum Abschnitt (Material, Zeit, Zielrichtung …)"
|
||||
/>
|
||||
{enableParallelPhaseControls ? (
|
||||
<div className="form-row" style={{ marginTop: '10px', marginBottom: '2px' }}>
|
||||
{!structureOnly ? (
|
||||
<div
|
||||
className="form-row"
|
||||
style={{ marginTop: '10px', marginBottom: '2px', maxWidth: '220px' }}
|
||||
>
|
||||
<label className="form-label" style={{ fontSize: '0.78rem' }}>
|
||||
Zuordnung
|
||||
Geplante Abschnittsdauer
|
||||
</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={planLocKey(sec.planLoc)}
|
||||
onChange={(e) => applySectionPlanTarget(sIdx, e.target.value)}
|
||||
<input
|
||||
type="text"
|
||||
className="form-input tu-ex-duration"
|
||||
inputMode="decimal"
|
||||
value={sec.planned_duration_min ?? ''}
|
||||
onChange={(e) =>
|
||||
updateSectionField(sIdx, 'planned_duration_min', e.target.value)
|
||||
}
|
||||
placeholder="z. B. 15 oder 0,25 h"
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
{enableParallelPhaseControls && useCompactPhaseMoves ? (
|
||||
<div className="tu-section-phase-moves" style={{ marginTop: '8px' }}>
|
||||
<span
|
||||
className="form-label"
|
||||
style={{ fontSize: '0.75rem', display: 'block', marginBottom: '6px' }}
|
||||
>
|
||||
<option value="">Standard — eine Ganzgruppe (klassischer Ablauf)</option>
|
||||
{planSelectOptionsForSection(list, sIdx, buildPlanTargetOptions(list)).map((o) => (
|
||||
<option key={o.key} value={o.key}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
Phase / Gruppe
|
||||
</span>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '4px' }}>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary framework-ctrl framework-ctrl--xs"
|
||||
title="In Ganzgruppe darüber"
|
||||
onClick={() => moveSectionToWholeGroupAbove(sIdx)}
|
||||
>
|
||||
Ganz ↑
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary framework-ctrl framework-ctrl--xs"
|
||||
title="In Ganzgruppe darunter"
|
||||
onClick={() => moveSectionToWholeGroupBelow(sIdx)}
|
||||
>
|
||||
Ganz ↓
|
||||
</button>
|
||||
{planSelectOptionsForSection(list, sIdx, buildPlanTargetOptions(list))
|
||||
.filter((o) => o.key.startsWith('par:'))
|
||||
.map((o) => (
|
||||
<button
|
||||
key={o.key}
|
||||
type="button"
|
||||
className="btn btn-secondary framework-ctrl framework-ctrl--xs"
|
||||
title={o.label}
|
||||
onClick={() => moveSectionToPlanTarget(sIdx, o.key)}
|
||||
>
|
||||
{o.label.length > 14 ? `${o.label.slice(0, 12)}…` : o.label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{!structureOnly && planMin > 0 && (
|
||||
<p style={{ fontSize: '0.78rem', color: 'var(--text2)', marginTop: '0.35rem' }}>
|
||||
Geplant in diesem Abschnitt: ca. {planMin} Min. (Übungen)
|
||||
Geplant in diesem Abschnitt:{' '}
|
||||
<strong>{formatDurationDisplay(planMin)}</strong>
|
||||
{parseDurationInput(sec.planned_duration_min) != null
|
||||
? ' (Abschnittsangabe)'
|
||||
: ' (Summe Übungen)'}
|
||||
</p>
|
||||
)}
|
||||
|
||||
|
||||
Reference in new issue
Block a user