'use client' import { useRouter } from 'next/navigation' import { Badge } from '@/components/ui/badge' import { Button } from '@/components/ui/button' import { PanelNavBar } from '@/components/shared/panel-nav-bar' import { DemoTooltip } from '@/components/shared/demo-tooltip' import { useShallow } from 'zustand/react/shallow' import { useProductWorkspaceStore } from '@/stores/product-workspace/store' import { selectTasksForActiveStory } from '@/stores/product-workspace/selectors' import type { BacklogTask, TaskDetail, } from '@/stores/product-workspace/types' import { BacklogCard } from './backlog-card' import { debugProps } from '@/lib/debug' import { EmptyPanel } from './empty-panel' import { cn } from '@/lib/utils' const STATUS_COLORS: Record = { TO_DO: 'bg-status-todo/15 text-status-todo border-status-todo/30', IN_PROGRESS: 'bg-status-in-progress/15 text-status-in-progress border-status-in-progress/30', REVIEW: 'bg-status-review/15 text-status-review border-status-review/30', DONE: 'bg-status-done/15 text-status-done border-status-done/30', } const STATUS_LABELS: Record = { TO_DO: 'To Do', IN_PROGRESS: 'Bezig', REVIEW: 'Review', DONE: 'Klaar', } function TaskCard({ task, onClick, }: { task: BacklogTask | TaskDetail onClick: () => void }) { return ( {STATUS_LABELS[task.status] ?? task.status} } /> ) } interface TaskPanelProps { productId: string isDemo: boolean closePath: string } // PBI-74 / T-851: leest tasks voor active story via selectTasksForActiveStory. export function TaskPanel({ isDemo, closePath }: TaskPanelProps) { const router = useRouter() const selectedStoryId = useProductWorkspaceStore((s) => s.context.activeStoryId) const rawTasks = useProductWorkspaceStore(useShallow(selectTasksForActiveStory)) as | (BacklogTask | TaskDetail)[] const tasks: (BacklogTask | TaskDetail)[] | null = selectedStoryId ? rawTasks : null const navActions = ( ) const dp = debugProps('task-panel', 'TaskPanel', 'components/backlog/task-panel.tsx') if (tasks === null) { return (
) } if (tasks.length === 0) { return (
router.push(`${closePath}?newTask=1&storyId=${selectedStoryId}`), disabled: isDemo, }} />
) } return (
{tasks.map((task) => ( router.push(`${closePath}?editTask=${task.id}`)} /> ))}
) }