import React from 'react'
import { ChevronDown, ChevronRight } from 'lucide-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 (
{isExpanded && (
Stilrichtungen
{focusArea.style_directions &&
focusArea.style_directions.map((sd) => (
))}
Trainingstypen
{focusArea.training_types &&
focusArea.training_types.map((tt) => (
))}
)}
)
}
function StyleDirectionNode({ styleDirection, onSelect, isSelected }) {
return (
onSelect(styleDirection, 'style_direction')}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
onSelect(styleDirection, 'style_direction')
}
}}
>
{styleDirection.name}
{styleDirection.abbreviation ? (
({styleDirection.abbreviation})
) : null}
{styleDirection.target_groups && styleDirection.target_groups.length > 0 ? (
Zielgruppen: {styleDirection.target_groups.map((tg) => tg.name).join(', ')}
) : null}
)
}
function TrainingTypeNode({ trainingType, onSelect, isSelected }) {
return (
onSelect(trainingType, 'training_type')}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault()
onSelect(trainingType, 'training_type')
}
}}
>
{trainingType.name}
{trainingType.abbreviation ? (
({trainingType.abbreviation})
) : null}
)
}
export default FocusAreaNode