Implement planning layout and enhance training module functionality
Deploy Development / deploy (push) Failing after 23s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 6s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Has been cancelled

- Added a new PlanningLayout component to manage the training planning interface, allowing for better organization of related pages.
- Introduced a FormActionBar component across various modals and forms to standardize action buttons for saving and canceling.
- Updated the TrainingPlanningPageRoot and TrainingPlanningUnitFormModal to utilize the new FormActionBar for improved user experience.
- Enhanced the TrainingModuleEditPage and TrainingFrameworkProgramEditPage with save and close functionality, streamlining the editing process.
- Refactored existing modals to incorporate the new layout and action bar, ensuring consistency across the application.
This commit is contained in:
Lars committed 2026-05-19 10:02:39 +02:00
1 parent 82705f0c3e
commit 4fee5a2b47
14 files changed
+525 -207

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
/**
* Feste Aktionsleiste für Formulare/Modale: Speichern, Speichern & schließen, Abbrechen.
* Bleibt sichtbar (sticky), während der Formularinhalt scrollt.
*/
export default function FormActionBar({
placement = 'bottom',
variant = 'default',
saving = false,
saveLabel,
saveAndCloseLabel = 'Speichern & schließen',
cancelLabel = 'Abbrechen',
onSave,
onSaveAndClose,
onCancel,
showSave = true,
showSaveAndClose = true,
showCancel = true,
formId,
isNew = false,
primaryIsSaveOnly = false,
}) {
const labelSave = saveLabel ?? (isNew ? 'Anlegen' : 'Speichern')
const showSaveBtn = showSave && (Boolean(onSave) || Boolean(formId))
const showCloseBtn = showSaveAndClose && (Boolean(onSaveAndClose) || Boolean(formId))
const showCancelBtn = showCancel && Boolean(onCancel)
if (!showSaveBtn && !showCloseBtn && !showCancelBtn) return null
const saveBtnClass = `btn form-action-bar__btn${
primaryIsSaveOnly ? ' btn-primary' : ' btn-secondary'
}`
const closeBtnClass = `btn form-action-bar__btn${
primaryIsSaveOnly ? ' btn-secondary' : ' btn-primary'
}`
return (
<div
className={`form-action-bar form-action-bar--${placement} form-action-bar--${variant}`}
role="group"
aria-label="Formularaktionen"
>
<div className="form-action-bar__inner">
{showCancelBtn ? (
<button
type="button"
className="btn btn-secondary form-action-bar__btn form-action-bar__btn--cancel"
onClick={onCancel}
disabled={saving}
>
{cancelLabel}
</button>
) : (
<span className="form-action-bar__spacer" aria-hidden />
)}
<div className="form-action-bar__primary-group">
{showSaveBtn ? (
<button
type={formId && !onSave ? 'submit' : 'button'}
form={formId && !onSave ? formId : undefined}
className={saveBtnClass}
disabled={saving}
onClick={onSave || undefined}
>
{saving ? 'Speichern…' : labelSave}
</button>
) : null}
{showCloseBtn ? (
<button
type={formId && !onSaveAndClose ? 'submit' : 'button'}
form={formId && !onSaveAndClose ? formId : undefined}
className={closeBtnClass}
disabled={saving}
onClick={onSaveAndClose || undefined}
>
{saving ? 'Speichern…' : saveAndCloseLabel}
</button>
) : null}
</div>
</div>
</div>
)
}