48 lines
2.0 KiB
TypeScript
48 lines
2.0 KiB
TypeScript
import Link from 'next/link'
|
|
import { Avatar } from '@/components/ui/avatar'
|
|
import { PriorityTag, StatusTag } from '@/components/ui/status-tag'
|
|
import { STATUS_ORDER, type CapaRow } from '@/lib/capa/list'
|
|
|
|
export function CapaBoardView({ capas }: { capas: CapaRow[] }) {
|
|
return (
|
|
<div className="flex gap-3 overflow-x-auto pb-2">
|
|
{STATUS_ORDER.map(status => {
|
|
const items = capas.filter(c => c.status === status)
|
|
return (
|
|
<section
|
|
key={status}
|
|
aria-label={`${status.replace(/_/g, ' ')} column`}
|
|
className="w-72 shrink-0 rounded-xl bg-surface-2 p-2"
|
|
>
|
|
<header className="flex items-center gap-2 px-1.5 pb-2">
|
|
<StatusTag status={status} />
|
|
<span className="text-xs text-faint">{items.length}</span>
|
|
</header>
|
|
<div className="space-y-2 max-h-[70vh] overflow-y-auto">
|
|
{items.map(c => (
|
|
<Link
|
|
key={c.id}
|
|
href={`/hse/capa/${c.id}`}
|
|
className="block rounded-md bg-surface p-3 shadow-card transition-shadow hover:shadow-float"
|
|
>
|
|
<p className="text-[13px] font-medium line-clamp-2">{c.description}</p>
|
|
<p className="mt-1 font-mono text-[12px] text-accent">{c.incident_ref ?? '—'}</p>
|
|
<div className="mt-2 flex items-center justify-between gap-2">
|
|
<span className="flex min-w-0 items-center gap-1.5 text-xs text-muted">
|
|
{c.owner_name && <Avatar name={c.owner_name} />}
|
|
<span className="truncate">{c.owner_name ?? '—'}</span>
|
|
</span>
|
|
<PriorityTag priority={c.priority} />
|
|
</div>
|
|
<p className="mt-1.5 text-xs text-faint">Due {c.due_date}</p>
|
|
</Link>
|
|
))}
|
|
{items.length === 0 && <p className="px-1.5 py-3 text-xs text-faint">Empty</p>}
|
|
</div>
|
|
</section>
|
|
)
|
|
})}
|
|
</div>
|
|
)
|
|
}
|