import avatarUrl from '@/assets/avatar.png' import { avatarSrc } from '@/lib/avatar' import { CaretDownIcon } from '@/features/tasks/icons' import { TaskActions } from '@/features/tasks/TaskActions' import { dueInfo, POINTS, TAG_META, tagToneClasses, type DueTone, } from '@/features/tasks/task-display' import type { ApiTask, BoardColumn } from '@/features/tasks/types' const toneBorder: Record = { primary: 'border-l-primary-4', tertiary: 'border-l-tertiary-4', secondary: 'border-l-secondary-4', } const toneText: Record = { primary: 'text-primary-3', tertiary: 'text-tertiary-4', secondary: 'text-secondary-4', } const cellBase = 'flex h-14 items-center border border-neutral-3 bg-neutral-4 py-1' const nameWidth = 'min-w-60 flex-1' const tagsWidth = 'w-42 shrink-0' const estimateWidth = 'w-35 shrink-0' const assigneeWidth = 'w-42 shrink-0' const dueWidth = 'w-33 shrink-0' const actionsWidth = 'w-14 shrink-0' const HEADERS = [ { label: '# Task Name', className: `${nameWidth} rounded-l px-4` }, { label: 'Task Tags', className: `${tagsWidth} pr-4 pl-4` }, { label: 'Estimate', className: `${estimateWidth} pr-4 pl-4` }, { label: 'Task Assign Name', className: `${assigneeWidth} pr-4 pl-4` }, { label: 'Due Date', className: `${dueWidth} pr-4 pl-4` }, { label: '', className: `${actionsWidth} rounded-r` }, ] const titleCase = (label: string) => label.toLowerCase().replace(/\b\w/g, (c) => c.toUpperCase()) function TaskRow({ task, index }: { task: ApiTask; index: number }) { const due = dueInfo(task.dueDate) const firstTag = task.tags.at(0) return (
{String(index + 1).padStart(2, '0')} {task.name}
{firstTag !== undefined && ( {TAG_META[firstTag].label} )} {task.tags.length > 1 && ( +{task.tags.length - 1} )}
{String(POINTS[task.pointEstimate])} Points
{task.assignee?.fullName ?? 'Unassigned'}
{titleCase(due.label)}
) } export function TaskList({ columns }: { columns: BoardColumn[] }) { return (
{HEADERS.map((header, index) => (
{header.label}
))}
{columns.map((column) => (

{column.title}{' '} ({String(column.tasks.length).padStart(2, '0')})

{column.tasks.map((task, index) => ( ))}
))}
) }