refactor: update navigation components and styles for improved consistency
Deploy Development / deploy (push) Successful in 34s
Test Suite / pytest-backend (push) Successful in 6s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 6s
Test Suite / playwright-tests (push) Failing after 28s

- Replaced legacy .capture-shell with .app-subnav-shell and integrated PageSectionNav for a unified navigation experience across multiple pages.
- Refactored AdminCatalogsPage, AdminMaturityModelsPage, ClubsPage, ExercisesListPage, MediaWikiImportPage, SkillsPage, and TrainingFrameworkProgramEditPage to utilize the new PageSectionNav component for tab navigation.
- Enhanced CSS styles for better responsiveness and visual clarity in navigation elements.
- Improved accessibility features with appropriate ARIA roles and attributes for better usability.
This commit is contained in:
Lars committed 2026-05-06 12:49:35 +02:00
1 parent 1e1fd80fb7
commit db8af53652
11 files changed
+243 -451

No files matched your search

+19 -27
View File
@@ -1,6 +1,19 @@
import { useState, useEffect } from 'react'
import { api } from '../utils/api'
import AdminPageNav from '../components/AdminPageNav'
import PageSectionNav from '../components/PageSectionNav'
const CATALOG_SUBTABS = [
{ id: 'focus-areas', label: 'Fokusbereiche' },
{ id: 'training-styles', label: 'Stilrichtungen' },
{ id: 'training-types', label: 'Trainingsstil' },
{ id: 'hierarchy', label: 'Hierarchie' },
{ id: 'target-groups', label: 'Zielgruppen' },
{ id: 'target-groups-matrix', label: 'Zuordnungen' },
{ id: 'training-characters', label: 'Trainingscharakter' },
{ id: 'skill-categories', label: 'Fähigkeitskategorien' },
{ id: 'trainer-assignments', label: 'Trainer-Zuordnungen' },
]
export default function AdminCatalogsPage() {
const [activeTab, setActiveTab] = useState('focus-areas')
@@ -318,33 +331,12 @@ export default function AdminCatalogsPage() {
<h1 className="page-title">Stammdaten-Kataloge</h1>
<div className="admin-page-subtabs" role="tablist" aria-label="Katalogbereiche">
{[
{ id: 'focus-areas', label: 'Fokusbereiche' },
{ id: 'training-styles', label: 'Stilrichtungen' },
{ id: 'training-types', label: 'Trainingsstil' },
{ id: 'hierarchy', label: 'Hierarchie' },
{ id: 'target-groups', label: 'Zielgruppen' },
{ id: 'target-groups-matrix', label: 'Zuordnungen' },
{ id: 'training-characters', label: 'Trainingscharakter' },
{ id: 'skill-categories', label: 'Fähigkeitskategorien' },
{ id: 'trainer-assignments', label: 'Trainer-Zuordnungen' }
].map((tab) => (
<button
key={tab.id}
type="button"
role="tab"
aria-selected={activeTab === tab.id}
onClick={() => setActiveTab(tab.id)}
className={
'admin-page-subtabs__btn' +
(activeTab === tab.id ? ' admin-page-subtabs__btn--active' : '')
}
>
{tab.label}
</button>
))}
</div>
<PageSectionNav
ariaLabel="Katalogbereiche"
value={activeTab}
onChange={setActiveTab}
items={CATALOG_SUBTABS}
/>
{error && <div className="admin-matrix-alert">{error}</div>}
+14 -46
View File
@@ -6,6 +6,14 @@ import SkillsCatalogAdmin from '../components/admin/SkillsCatalogAdmin'
import MaturityModelsAdminPanel from '../components/admin/MaturityModelsAdminPanel'
import MaturityModelBindingsAdmin from '../components/admin/MaturityModelBindingsAdmin'
import MaturityMatrixToolsAdmin from '../components/admin/MaturityMatrixToolsAdmin'
import PageSectionNav from '../components/PageSectionNav'
const MATURITY_SECTION_TABS = [
{ id: 'catalog', label: 'Katalog und Hierarchie' },
{ id: 'models', label: 'Reifegradmodelle' },
{ id: 'bindings', label: 'Kontext-Zuordnung' },
{ id: 'matrixviz', label: 'Matrix-Ansicht und Export' },
]
export default function AdminMaturityModelsPage() {
const { user } = useAuth()
@@ -27,52 +35,12 @@ export default function AdminMaturityModelsPage() {
</p>
</header>
<div className="admin-page-subtabs" role="tablist" aria-label="Bereiche Fähigkeiten">
<button
type="button"
role="tab"
aria-selected={tab === 'catalog'}
className={
'admin-page-subtabs__btn' + (tab === 'catalog' ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setTab('catalog')}
>
Katalog und Hierarchie
</button>
<button
type="button"
role="tab"
aria-selected={tab === 'models'}
className={
'admin-page-subtabs__btn' + (tab === 'models' ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setTab('models')}
>
Reifegradmodelle
</button>
<button
type="button"
role="tab"
aria-selected={tab === 'bindings'}
className={
'admin-page-subtabs__btn' + (tab === 'bindings' ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setTab('bindings')}
>
Kontext-Zuordnung
</button>
<button
type="button"
role="tab"
aria-selected={tab === 'matrixviz'}
className={
'admin-page-subtabs__btn' + (tab === 'matrixviz' ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setTab('matrixviz')}
>
Matrix-Ansicht und Export
</button>
</div>
<PageSectionNav
ariaLabel="Bereiche Fähigkeiten"
value={tab}
onChange={setTab}
items={MATURITY_SECTION_TABS}
/>
<div className="admin-tabs__panel" role="tabpanel">
{tab === 'catalog' ? (
+22 -25
View File
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, useMemo } from 'react'
import api from '../utils/api'
import { useAuth } from '../context/AuthContext'
import PageSectionNav from '../components/PageSectionNav'
const CLUB_ROLE_OPTIONS = [
{ code: 'club_admin', label: 'Vereinsadmin' },
@@ -285,6 +286,19 @@ function ClubsPage() {
setFormData(prev => ({ ...prev, [field]: value }))
}
const clubTabItems = useMemo(() => {
const ids = canManageOrgSomewhere
? ['clubs', 'divisions', 'groups', 'members']
: ['clubs', 'divisions', 'groups']
const labels = {
clubs: 'Vereine',
divisions: 'Sparten',
groups: 'Trainingsgruppen',
members: 'Mitglieder',
}
return ids.map((id) => ({ id, label: labels[id] }))
}, [canManageOrgSomewhere])
if (loading) {
return (
<div className="skills-page__loading">
@@ -294,10 +308,6 @@ function ClubsPage() {
)
}
const clubTabIds = canManageOrgSomewhere
? ['clubs', 'divisions', 'groups', 'members']
: ['clubs', 'divisions', 'groups']
return (
<div className="app-page clubs-page">
<h1 className="page-title">Vereinsverwaltung</h1>
@@ -306,27 +316,14 @@ function ClubsPage() {
Sparten sind optional — typische Eckdaten einer Gruppe (Wochentag, Zeit, Ort) kannst du schrittweise eintragen.
</p>
<div className="admin-page-subtabs" role="tablist" aria-label="Vereinsverwaltung">
{clubTabIds.map((tab) => (
<button
key={tab}
type="button"
role="tab"
aria-selected={activeTab === tab}
className={
'admin-page-subtabs__btn' + (activeTab === tab ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setActiveTab(tab)}
>
{tab === 'clubs' && 'Vereine'}
{tab === 'divisions' && 'Sparten'}
{tab === 'groups' && 'Trainingsgruppen'}
{tab === 'members' && 'Mitglieder'}
</button>
))}
</div>
<PageSectionNav
ariaLabel="Vereinsverwaltung"
value={activeTab}
onChange={setActiveTab}
items={clubTabItems}
/>
{/* Clubs Tab */}
{/* Clubs Tab */}
{activeTab === 'clubs' && (
<>
<div style={{ display: 'flex', justifyContent: 'space-between', marginBottom: '1rem' }}>
+12 -25
View File
@@ -17,10 +17,15 @@ import { useAuth } from '../context/AuthContext'
import { SKILL_LEVEL_OPTIONS } from '../constants/skillLevels'
import MultiSelectCombo from '../components/MultiSelectCombo'
import ExerciseProgressionGraphPanel from '../components/ExerciseProgressionGraphPanel'
import PageSectionNav from '../components/PageSectionNav'
import { sanitizeExerciseRichText, coerceApiNameList } from '../utils/sanitizeHtml'
const PAGE_SIZE = 100
const BULK_MAX_IDS = 500
const EXERCISES_PAGE_TABS = [
{ id: 'list', label: 'Liste' },
{ id: 'progression', label: 'Progressionsgraphen' },
]
const LEVEL_FILTER_OPTS = SKILL_LEVEL_OPTIONS.filter((o) => o.level != null)
const INITIAL_FILTERS = {
@@ -646,31 +651,13 @@ function ExercisesListPage() {
)}
</div>
<div className="exercises-page-toolbar-tabs admin-page-subtabs" role="tablist" aria-label="Übungen Bereiche">
<button
type="button"
role="tab"
aria-selected={pageTab === 'list'}
className={
'admin-page-subtabs__btn' + (pageTab === 'list' ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setPageTab('list')}
>
Liste
</button>
<button
type="button"
role="tab"
aria-selected={pageTab === 'progression'}
className={
'admin-page-subtabs__btn' +
(pageTab === 'progression' ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setPageTab('progression')}
>
Progressionsgraphen
</button>
</div>
<PageSectionNav
ariaLabel="Übungen Bereiche"
value={pageTab}
onChange={setPageTab}
items={EXERCISES_PAGE_TABS}
className="exercises-page-toolbar-tabs"
/>
{pageTab === 'progression' ? (
<ExerciseProgressionGraphPanel />
+14 -26
View File
@@ -1,6 +1,14 @@
import React, { useState, useEffect } from 'react'
import { Eye, Play, History } from 'lucide-react'
import api from '../utils/api'
import AdminPageNav from '../components/AdminPageNav'
import PageSectionNav from '../components/PageSectionNav'
const WIKI_IMPORT_TABS = [
{ id: 'preview', label: 'Vorschau', icon: Eye },
{ id: 'execute', label: 'Ausführen', icon: Play },
{ id: 'history', label: 'Historie', icon: History },
]
export default function MediaWikiImportPage() {
const [activeTab, setActiveTab] = useState('preview')
@@ -111,32 +119,12 @@ export default function MediaWikiImportPage() {
Importiere Übungen, Fähigkeiten und Methoden aus karatetrainer.net
</p>
{/* Tabs */}
<div style={{ borderBottom: '2px solid var(--border)', marginBottom: '24px' }}>
<div style={{ display: 'flex', gap: '8px' }}>
{['preview', 'execute', 'history'].map(tab => (
<button
key={tab}
onClick={() => setActiveTab(tab)}
style={{
padding: '12px 24px',
background: activeTab === tab ? 'var(--accent)' : 'transparent',
color: activeTab === tab ? 'white' : 'var(--text1)',
border: 'none',
borderBottom: activeTab === tab ? '2px solid var(--accent)' : '2px solid transparent',
cursor: 'pointer',
fontSize: '16px',
fontWeight: activeTab === tab ? 'bold' : 'normal',
transition: 'all 0.2s'
}}
>
{tab === 'preview' && '👁️ Vorschau'}
{tab === 'execute' && '▶️ Ausführen'}
{tab === 'history' && '📜 Historie'}
</button>
))}
</div>
</div>
<PageSectionNav
ariaLabel="Import-Schritte"
value={activeTab}
onChange={setActiveTab}
items={WIKI_IMPORT_TABS}
/>
{/* Error Display */}
{error && (
+13 -24
View File
@@ -1,6 +1,12 @@
import React, { useState, useEffect } from 'react'
import api from '../utils/api'
import { useAuth } from '../context/AuthContext'
import PageSectionNav from '../components/PageSectionNav'
const SKILLS_SECTION_TABS = [
{ id: 'skills', label: 'Fähigkeiten' },
{ id: 'methods', label: 'Trainingsmethoden' },
]
function SkillsPage() {
const { user } = useAuth()
@@ -146,30 +152,13 @@ function SkillsPage() {
<div className="app-page skills-page">
<h1 className="page-title">Fähigkeiten & Methoden</h1>
<div className="skills-page__tabs-scroll admin-page-subtabs" role="tablist" aria-label="Bereich wählen">
<button
type="button"
role="tab"
aria-selected={activeTab === 'skills'}
className={
'admin-page-subtabs__btn' + (activeTab === 'skills' ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setActiveTab('skills')}
>
Fähigkeiten
</button>
<button
type="button"
role="tab"
aria-selected={activeTab === 'methods'}
className={
'admin-page-subtabs__btn' + (activeTab === 'methods' ? ' admin-page-subtabs__btn--active' : '')
}
onClick={() => setActiveTab('methods')}
>
Trainingsmethoden
</button>
</div>
<PageSectionNav
ariaLabel="Bereich wählen"
value={activeTab}
onChange={setActiveTab}
items={SKILLS_SECTION_TABS}
className="skills-page__tabs-scroll"
/>
{/* Skills Tab */}
{activeTab === 'skills' && (
@@ -4,6 +4,7 @@ import api from '../utils/api'
import ExercisePickerModal from '../components/ExercisePickerModal'
import ExercisePeekModal from '../components/ExercisePeekModal'
import TrainingUnitSectionsEditor from '../components/TrainingUnitSectionsEditor'
import PageSectionNav from '../components/PageSectionNav'
import {
defaultSection,
normalizeUnitToForm,
@@ -675,27 +676,17 @@ export default function TrainingFrameworkProgramEditPage() {
</div>
</details>
<div className="framework-edit__tabbar" role="tablist" aria-label="Bereiche">
<div className="planning-segment-group planning-segment-group--equal">
{[
<div className="framework-edit__tabbar">
<PageSectionNav
ariaLabel="Bereiche"
value={frameworkTab}
onChange={setFrameworkTab}
items={[
{ id: 'meta', label: 'Stammdaten' },
{ id: 'plan', label: 'Plan (Ziele & Sessions)' },
].map((t) => (
<button
key={t.id}
type="button"
role="tab"
aria-selected={frameworkTab === t.id}
className={
'planning-segment-group__btn' +
(frameworkTab === t.id ? ' planning-segment-group__btn--active' : '')
}
onClick={() => setFrameworkTab(t.id)}
>
{t.label}
</button>
))}
</div>
]}
className="page-section-nav--embedded framework-edit__section-nav"
/>
</div>
<div
+27 -54
View File
@@ -5,6 +5,7 @@ import { useAuth } from '../context/AuthContext'
import ExercisePickerModal from '../components/ExercisePickerModal'
import ExercisePeekModal from '../components/ExercisePeekModal'
import TrainingUnitSectionsEditor from '../components/TrainingUnitSectionsEditor'
import PageSectionNav from '../components/PageSectionNav'
import {
defaultSection,
normalizeUnitToForm,
@@ -864,41 +865,28 @@ function TrainingPlanningPage() {
>
Ansicht
</span>
<div
className="planning-segment-group planning-segment-group--comfort"
role="group"
aria-label="Darstellung Liste oder Kalender"
>
<button
type="button"
aria-pressed={planView === 'list'}
onClick={() => setPlanView('list')}
className={
'planning-segment-group__btn' +
(planView === 'list' ? ' planning-segment-group__btn--active' : '')
}
>
Liste
</button>
<button
type="button"
aria-pressed={planView === 'calendar'}
onClick={() => {
<PageSectionNav
semantics="toggle"
ariaLabel="Darstellung Liste oder Kalender"
value={planView}
onChange={(id) => {
if (id === 'calendar') {
setPlanView('calendar')
setCalendarMonthStr((prev) => {
const fromList = (startDate || '').slice(0, 7)
if (/^\d{4}-\d{2}$/.test(fromList)) return fromList
return prev || new Date().toISOString().slice(0, 7)
})
}}
className={
'planning-segment-group__btn' +
(planView === 'calendar' ? ' planning-segment-group__btn--active' : '')
} else {
setPlanView('list')
}
>
Kalender
</button>
</div>
}}
items={[
{ id: 'list', label: 'Liste' },
{ id: 'calendar', label: 'Kalender' },
]}
className="page-section-nav--inline planning-ansicht-nav"
/>
<span style={{ fontSize: '0.8rem', color: 'var(--text3)', lineHeight: 1.35, maxWidth: '22rem' }}>
{planView === 'list'
? 'Zeitraum unten mit Von/Bis filtern.'
@@ -1047,32 +1035,17 @@ function TrainingPlanningPage() {
<span className="form-label" style={{ marginBottom: 0, alignSelf: 'center' }}>
Einblenden
</span>
<div className="planning-segment-group" role="group" aria-label="Gruppe oder ganzer Verein">
<button
type="button"
className={
'planning-segment-group__btn' +
(planScope === 'group' ? ' planning-segment-group__btn--active' : '')
}
aria-pressed={planScope === 'group'}
disabled={!selectedGroupId}
onClick={() => setPlanScope('group')}
>
Nur diese Gruppe
</button>
<button
type="button"
className={
'planning-segment-group__btn' +
(planScope === 'club' ? ' planning-segment-group__btn--active' : '')
}
aria-pressed={planScope === 'club'}
disabled={!selectedGroupId}
onClick={() => setPlanScope('club')}
>
Ganzer Verein
</button>
</div>
<PageSectionNav
semantics="toggle"
ariaLabel="Gruppe oder ganzer Verein"
value={planScope}
onChange={setPlanScope}
items={[
{ id: 'group', label: 'Nur diese Gruppe', disabled: !selectedGroupId },
{ id: 'club', label: 'Ganzer Verein', disabled: !selectedGroupId },
]}
className="page-section-nav--inline"
/>
<label
style={{
display: 'inline-flex',