import React from 'react'
function FocusAreaNode({ focusArea, expanded, onToggle, onSelect, selectedId, selectedType }) {
const nodeId = `fa-${focusArea.id}`
const isExpanded = expanded.has(nodeId)
const isSelected = selectedType === 'focus_area' && selectedId === focusArea.id
return (
{/* Focus Area Header */}
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
}}
>
{ e.stopPropagation(); onToggle(nodeId) }}
style={{ marginRight: '8px', cursor: 'pointer', fontSize: '18px' }}
>
{isExpanded ? '▼' : '▶'}
{focusArea.icon}
{focusArea.name}
{/* Children: Style Directions + Training Types */}
{isExpanded && (
{/* Style Directions Section */}
Stilrichtungen
{focusArea.style_directions && focusArea.style_directions.map(sd => (
))}
{/* Training Types Section */}
Trainingstypen
{focusArea.training_types && focusArea.training_types.map(tt => (
))}
)}
)
}
function StyleDirectionNode({ styleDirection, onSelect, isSelected }) {
return (
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'
}}
>
{styleDirection.name}
{styleDirection.abbreviation && (
({styleDirection.abbreviation})
)}
{styleDirection.target_groups && styleDirection.target_groups.length > 0 && (
Zielgruppen: {styleDirection.target_groups.map(tg => tg.name).join(', ')}
)}
)
}
function TrainingTypeNode({ trainingType, onSelect, isSelected }) {
return (
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'
}}
>
{trainingType.name}
{trainingType.abbreviation && (
({trainingType.abbreviation})
)}
)
}
export default FocusAreaNode