'use client'
import type { BacklogItem, BacklogCategory } from './types'
import { statusLabels, priorityLabels } from './types'
export function BacklogItemCard({
item,
category,
isExpanded,
onToggleExpand,
onUpdateStatus,
onToggleSubtask,
}: {
item: BacklogItem
category: BacklogCategory | undefined
isExpanded: boolean
onToggleExpand: () => void
onUpdateStatus: (status: BacklogItem['status']) => void
onToggleSubtask: (subtaskId: string) => void
}) {
const completedSubtasks = item.subtasks?.filter((st) => st.completed).length || 0
const totalSubtasks = item.subtasks?.length || 0
return (
{/* Expand Icon */}
{/* Content */}
{item.title}
{priorityLabels[item.priority].label}
{item.description}
{category?.name}
{totalSubtasks > 0 && (
{completedSubtasks}/{totalSubtasks} Teilaufgaben
)}
{/* Status */}
{/* Progress Bar for subtasks */}
{totalSubtasks > 0 && (
)}
{/* Expanded Subtasks */}
{isExpanded && item.subtasks && item.subtasks.length > 0 && (
)}
)
}