feat: enhance UI and functionality for Skills and Exercises pages
Deploy Development / deploy (push) Successful in 35s
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 29s
Deploy Development / deploy (push) Successful in 35s
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 29s
- Added new CSS styles for Skills and Exercises pages, improving layout and responsiveness. - Refactored components to utilize new styles, enhancing visual consistency and user experience. - Implemented horizontal scrollable navigation for exercises and skills tabs, improving usability on smaller screens. - Updated button styles and introduced new class names for better maintainability and accessibility. - Enhanced loading states and empty messages for improved user feedback during data fetching.
This commit is contained in:
1 parent
657f73d2c5
commit
68923b0364
5 files changed
+706
-312
No files matched your search
@@ -20,7 +20,7 @@ function DetailPanel({ item, onUpdate, focusAreas }) {
|
||||
return <TrainingTypeDetail item={item} onUpdate={onUpdate} focusAreas={focusAreas} />
|
||||
}
|
||||
|
||||
return <div style={{ padding: '20px', color: 'var(--text3)' }}>Unbekannter Typ: {type}</div>
|
||||
return <div className="detail-panel__unknown">Unbekannter Typ: {type}</div>
|
||||
}
|
||||
|
||||
function FocusAreaDetail({ item, onUpdate }) {
|
||||
@@ -57,7 +57,7 @@ function FocusAreaDetail({ item, onUpdate }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginTop: 0 }}>Fokusbereich bearbeiten</h2>
|
||||
<h2 className="detail-panel__title">Fokusbereich bearbeiten</h2>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Name *</label>
|
||||
<input className="form-input" value={form.name} onChange={e => setForm({ ...form, name: e.target.value })} />
|
||||
@@ -81,11 +81,11 @@ function FocusAreaDetail({ item, onUpdate }) {
|
||||
<option value="inactive">Inaktiv</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '8px', marginTop: '20px' }}>
|
||||
<div className="detail-panel__actions">
|
||||
<button className="btn btn-primary" onClick={handleSave} disabled={saving || !form.name}>
|
||||
{saving ? 'Speichert...' : 'Speichern'}
|
||||
</button>
|
||||
<button className="btn" onClick={handleDelete}>Löschen</button>
|
||||
<button type="button" className="btn btn-danger" onClick={handleDelete}>Löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -130,7 +130,7 @@ function StyleDirectionDetail({ item, onUpdate, focusAreas }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginTop: 0 }}>Stilrichtung bearbeiten</h2>
|
||||
<h2 className="detail-panel__title">Stilrichtung bearbeiten</h2>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Name *</label>
|
||||
<input className="form-input" value={form.name} onChange={e => setForm({ ...form, name: e.target.value })} />
|
||||
@@ -163,11 +163,11 @@ function StyleDirectionDetail({ item, onUpdate, focusAreas }) {
|
||||
<option value="inactive">Inaktiv</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '8px', marginTop: '20px' }}>
|
||||
<div className="detail-panel__actions">
|
||||
<button className="btn btn-primary" onClick={handleSave} disabled={saving || !form.name || !form.focus_area_id}>
|
||||
{saving ? 'Speichert...' : 'Speichern'}
|
||||
</button>
|
||||
<button className="btn" onClick={handleDelete}>Löschen</button>
|
||||
<button type="button" className="btn btn-danger" onClick={handleDelete}>Löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -212,7 +212,7 @@ function TrainingTypeDetail({ item, onUpdate, focusAreas }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginTop: 0 }}>Trainingstyp bearbeiten</h2>
|
||||
<h2 className="detail-panel__title">Trainingstyp bearbeiten</h2>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Name *</label>
|
||||
<input className="form-input" value={form.name} onChange={e => setForm({ ...form, name: e.target.value })} />
|
||||
@@ -245,11 +245,11 @@ function TrainingTypeDetail({ item, onUpdate, focusAreas }) {
|
||||
<option value="inactive">Inaktiv</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '8px', marginTop: '20px' }}>
|
||||
<div className="detail-panel__actions">
|
||||
<button className="btn btn-primary" onClick={handleSave} disabled={saving || !form.name || !form.focus_area_id}>
|
||||
{saving ? 'Speichert...' : 'Speichern'}
|
||||
</button>
|
||||
<button className="btn" onClick={handleDelete}>Löschen</button>
|
||||
<button type="button" className="btn btn-danger" onClick={handleDelete}>Löschen</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -284,8 +284,8 @@ function CreateStyleDirectionForm({ item, onUpdate }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginTop: 0 }}>Neue Stilrichtung erstellen</h2>
|
||||
<div style={{ padding: '12px', background: 'var(--surface2)', borderRadius: '8px', marginBottom: '20px', color: 'var(--text2)' }}>
|
||||
<h2 className="detail-panel__title">Neue Stilrichtung erstellen</h2>
|
||||
<div className="detail-panel__context">
|
||||
Fokusbereich: <strong>{item.focus_area_name}</strong>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
@@ -304,7 +304,7 @@ function CreateStyleDirectionForm({ item, onUpdate }) {
|
||||
<label className="form-label">Sortierung</label>
|
||||
<input className="form-input" type="number" value={form.sort_order} onChange={e => setForm({ ...form, sort_order: parseInt(e.target.value) || 0 })} />
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '8px', marginTop: '20px' }}>
|
||||
<div className="detail-panel__actions">
|
||||
<button className="btn btn-primary" onClick={handleCreate} disabled={saving || !form.name}>
|
||||
{saving ? 'Erstellt...' : 'Erstellen'}
|
||||
</button>
|
||||
@@ -342,8 +342,8 @@ function CreateTrainingTypeForm({ item, onUpdate }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h2 style={{ marginTop: 0 }}>Neuen Trainingstyp erstellen</h2>
|
||||
<div style={{ padding: '12px', background: 'var(--surface2)', borderRadius: '8px', marginBottom: '20px', color: 'var(--text2)' }}>
|
||||
<h2 className="detail-panel__title">Neuen Trainingstyp erstellen</h2>
|
||||
<div className="detail-panel__context">
|
||||
Fokusbereich: <strong>{item.focus_area_name}</strong>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
@@ -362,7 +362,7 @@ function CreateTrainingTypeForm({ item, onUpdate }) {
|
||||
<label className="form-label">Sortierung</label>
|
||||
<input className="form-input" type="number" value={form.sort_order} onChange={e => setForm({ ...form, sort_order: parseInt(e.target.value) || 0 })} />
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '8px', marginTop: '20px' }}>
|
||||
<div className="detail-panel__actions">
|
||||
<button className="btn btn-primary" onClick={handleCreate} disabled={saving || !form.name}>
|
||||
{saving ? 'Erstellt...' : 'Erstellen'}
|
||||
</button>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import React from 'react'
|
||||
import { ChevronDown, ChevronRight } from 'lucide-react'
|
||||
|
||||
function FocusAreaNode({ focusArea, expanded, onToggle, onSelect, selectedId, selectedType }) {
|
||||
const nodeId = `fa-${focusArea.id}`
|
||||
@@ -6,82 +7,94 @@ function FocusAreaNode({ focusArea, expanded, onToggle, onSelect, selectedId, se
|
||||
const isSelected = selectedType === 'focus_area' && selectedId === focusArea.id
|
||||
|
||||
return (
|
||||
<div style={{ marginBottom: '12px' }}>
|
||||
{/* Focus Area Header */}
|
||||
<div
|
||||
onClick={() => onSelect(focusArea, 'focus_area')}
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
padding: '8px 12px',
|
||||
borderRadius: '8px',
|
||||
cursor: 'pointer',
|
||||
background: isSelected ? 'var(--accent)' : 'transparent',
|
||||
color: isSelected ? 'white' : 'var(--text1)',
|
||||
fontWeight: 600
|
||||
}}
|
||||
>
|
||||
<span
|
||||
onClick={(e) => { e.stopPropagation(); onToggle(nodeId) }}
|
||||
style={{ marginRight: '8px', cursor: 'pointer', fontSize: '18px' }}
|
||||
<div className="focus-tree-root">
|
||||
<div className={'focus-tree-header' + (isSelected ? ' focus-tree-header--selected' : '')}>
|
||||
<button
|
||||
type="button"
|
||||
className="focus-tree-toggle"
|
||||
aria-expanded={isExpanded}
|
||||
aria-label={isExpanded ? 'Bereich einklappen' : 'Bereich aufklappen'}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
onToggle(nodeId)
|
||||
}}
|
||||
>
|
||||
{isExpanded ? '▼' : '▶'}
|
||||
</span>
|
||||
<span style={{ marginRight: '8px' }}>{focusArea.icon}</span>
|
||||
<span>{focusArea.name}</span>
|
||||
{isExpanded ? (
|
||||
<ChevronDown size={18} strokeWidth={2} aria-hidden />
|
||||
) : (
|
||||
<ChevronRight size={18} strokeWidth={2} aria-hidden />
|
||||
)}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="focus-tree-header__label"
|
||||
onClick={() => onSelect(focusArea, 'focus_area')}
|
||||
>
|
||||
{focusArea.icon ? (
|
||||
<span className="focus-tree-emoji" aria-hidden>
|
||||
{focusArea.icon}
|
||||
</span>
|
||||
) : null}
|
||||
<span>{focusArea.name}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Children: Style Directions + Training Types */}
|
||||
{isExpanded && (
|
||||
<div style={{ marginLeft: '28px', marginTop: '8px' }}>
|
||||
{/* Style Directions Section */}
|
||||
<div style={{ marginBottom: '12px' }}>
|
||||
<div style={{ fontSize: '12px', color: 'var(--text3)', marginBottom: '6px', textTransform: 'uppercase', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<div className="focus-tree-children">
|
||||
<div className="focus-tree-group">
|
||||
<div className="focus-tree-group__head">
|
||||
<span>Stilrichtungen</span>
|
||||
<button
|
||||
className="btn"
|
||||
style={{ fontSize: '11px', padding: '4px 8px' }}
|
||||
type="button"
|
||||
className="btn btn-secondary btn-tiny focus-tree-add-btn"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
onSelect({ _createType: 'style_direction', focus_area_id: focusArea.id, focus_area_name: focusArea.name }, 'create_style_direction')
|
||||
onSelect(
|
||||
{ _createType: 'style_direction', focus_area_id: focusArea.id, focus_area_name: focusArea.name },
|
||||
'create_style_direction'
|
||||
)
|
||||
}}
|
||||
>
|
||||
+ Neu
|
||||
</button>
|
||||
</div>
|
||||
{focusArea.style_directions && focusArea.style_directions.map(sd => (
|
||||
<StyleDirectionNode
|
||||
key={sd.id}
|
||||
styleDirection={sd}
|
||||
onSelect={onSelect}
|
||||
isSelected={selectedType === 'style_direction' && selectedId === sd.id}
|
||||
/>
|
||||
))}
|
||||
{focusArea.style_directions &&
|
||||
focusArea.style_directions.map((sd) => (
|
||||
<StyleDirectionNode
|
||||
key={sd.id}
|
||||
styleDirection={sd}
|
||||
onSelect={onSelect}
|
||||
isSelected={selectedType === 'style_direction' && selectedId === sd.id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Training Types Section */}
|
||||
<div>
|
||||
<div style={{ fontSize: '12px', color: 'var(--text3)', marginBottom: '6px', textTransform: 'uppercase', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<div className="focus-tree-group">
|
||||
<div className="focus-tree-group__head">
|
||||
<span>Trainingstypen</span>
|
||||
<button
|
||||
className="btn"
|
||||
style={{ fontSize: '11px', padding: '4px 8px' }}
|
||||
type="button"
|
||||
className="btn btn-secondary btn-tiny focus-tree-add-btn"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
onSelect({ _createType: 'training_type', focus_area_id: focusArea.id, focus_area_name: focusArea.name }, 'create_training_type')
|
||||
onSelect(
|
||||
{ _createType: 'training_type', focus_area_id: focusArea.id, focus_area_name: focusArea.name },
|
||||
'create_training_type'
|
||||
)
|
||||
}}
|
||||
>
|
||||
+ Neu
|
||||
</button>
|
||||
</div>
|
||||
{focusArea.training_types && focusArea.training_types.map(tt => (
|
||||
<TrainingTypeNode
|
||||
key={tt.id}
|
||||
trainingType={tt}
|
||||
onSelect={onSelect}
|
||||
isSelected={selectedType === 'training_type' && selectedId === tt.id}
|
||||
/>
|
||||
))}
|
||||
{focusArea.training_types &&
|
||||
focusArea.training_types.map((tt) => (
|
||||
<TrainingTypeNode
|
||||
key={tt.id}
|
||||
trainingType={tt}
|
||||
onSelect={onSelect}
|
||||
isSelected={selectedType === 'training_type' && selectedId === tt.id}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -92,28 +105,26 @@ function FocusAreaNode({ focusArea, expanded, onToggle, onSelect, selectedId, se
|
||||
function StyleDirectionNode({ styleDirection, onSelect, isSelected }) {
|
||||
return (
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
className={'focus-tree-item' + (isSelected ? ' focus-tree-item--selected' : '')}
|
||||
onClick={() => onSelect(styleDirection, 'style_direction')}
|
||||
style={{
|
||||
padding: '6px 12px',
|
||||
marginBottom: '4px',
|
||||
borderRadius: '6px',
|
||||
cursor: 'pointer',
|
||||
background: isSelected ? 'var(--accent)' : 'var(--surface2)',
|
||||
color: isSelected ? 'white' : 'var(--text1)',
|
||||
fontSize: '14px'
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault()
|
||||
onSelect(styleDirection, 'style_direction')
|
||||
}
|
||||
}}
|
||||
>
|
||||
{styleDirection.name}
|
||||
{styleDirection.abbreviation && (
|
||||
<span style={{ marginLeft: '8px', opacity: 0.7, fontSize: '12px' }}>
|
||||
({styleDirection.abbreviation})
|
||||
</span>
|
||||
)}
|
||||
{styleDirection.target_groups && styleDirection.target_groups.length > 0 && (
|
||||
<div style={{ fontSize: '11px', opacity: 0.8, marginTop: '4px' }}>
|
||||
Zielgruppen: {styleDirection.target_groups.map(tg => tg.name).join(', ')}
|
||||
{styleDirection.abbreviation ? (
|
||||
<span className="focus-tree-item__abbr">({styleDirection.abbreviation})</span>
|
||||
) : null}
|
||||
{styleDirection.target_groups && styleDirection.target_groups.length > 0 ? (
|
||||
<div className="focus-tree-item__meta">
|
||||
Zielgruppen: {styleDirection.target_groups.map((tg) => tg.name).join(', ')}
|
||||
</div>
|
||||
)}
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -121,25 +132,23 @@ function StyleDirectionNode({ styleDirection, onSelect, isSelected }) {
|
||||
function TrainingTypeNode({ trainingType, onSelect, isSelected }) {
|
||||
return (
|
||||
<div
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
className={'focus-tree-item' + (isSelected ? ' focus-tree-item--selected' : '')}
|
||||
onClick={() => onSelect(trainingType, 'training_type')}
|
||||
style={{
|
||||
padding: '6px 12px',
|
||||
marginBottom: '4px',
|
||||
borderRadius: '6px',
|
||||
cursor: 'pointer',
|
||||
background: isSelected ? 'var(--accent)' : 'var(--surface2)',
|
||||
color: isSelected ? 'white' : 'var(--text1)',
|
||||
fontSize: '14px'
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault()
|
||||
onSelect(trainingType, 'training_type')
|
||||
}
|
||||
}}
|
||||
>
|
||||
{trainingType.name}
|
||||
{trainingType.abbreviation && (
|
||||
<span style={{ marginLeft: '8px', opacity: 0.7, fontSize: '12px' }}>
|
||||
({trainingType.abbreviation})
|
||||
</span>
|
||||
)}
|
||||
{trainingType.abbreviation ? (
|
||||
<span className="focus-tree-item__abbr">({trainingType.abbreviation})</span>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default FocusAreaNode
|
||||
export default FocusAreaNode
|
||||
Reference in new issue
Block a user