import type { ReactNode } from 'react' import type { Issue, IssueColumn } from '../types' import { useDroppable } from '@dnd-kit/core' import { Plus } from 'lucide-react' import { cn } from '@/lib/utils' import { COLUMN_LABELS } from '../types' import { Badge } from './ui/badge' interface KanbanColumnProps { column: IssueColumn issues: Issue[] /** 该列未经筛选的卡片总数。与 `issues.length` 不等时角标显示「可见 / 总数」。 */ totalCount?: number children: ReactNode /** When provided, renders a + button in the header. Used for the todo column. */ onCreate?: () => void } export function KanbanColumn({ column, issues, totalCount, children, onCreate }: KanbanColumnProps) { const filtered = totalCount !== undefined && totalCount !== issues.length const { setNodeRef, isOver } = useDroppable({ id: column }) return (
{COLUMN_LABELS[column]}
{filtered ? `${issues.length} / ${totalCount}` : issues.length} {onCreate && ( )}
{issues.length === 0 ? (
{filtered ? '没有匹配的工单' : '拖到这里'}
) : ( children )}
) }