// frontend/src/components/tickets/TicketListRow.tsx import { cn } from '@/lib/utils' import type { PSATicketSearchResult } from '@/types/integrations' interface TicketListRowProps { ticket: PSATicketSearchResult selected: boolean onClick: () => void } const PRIORITY_STYLES: Record = { Critical: 'text-danger', High: 'text-danger', Medium: 'text-warning', Low: 'text-muted-foreground', } const STATUS_STYLES: Record = { New: { bg: 'bg-accent/10', text: 'text-accent' }, 'In Progress': { bg: 'bg-warning/10', text: 'text-warning' }, Waiting: { bg: 'bg-success/10', text: 'text-success' }, Resolved: { bg: 'bg-elevated/50', text: 'text-muted-foreground' }, } function statusStyle(name: string | null) { if (!name) return { bg: 'bg-elevated', text: 'text-muted-foreground' } return STATUS_STYLES[name] ?? { bg: 'bg-elevated', text: 'text-muted-foreground' } } export function TicketListRow({ ticket, selected, onClick }: TicketListRowProps) { const { bg, text } = statusStyle(ticket.status_name) const priorityClass = PRIORITY_STYLES[ticket.priority_name ?? ''] ?? 'text-muted-foreground' return (
e.key === 'Enter' && onClick()} className={cn( 'flex items-center gap-3 px-4 py-2.5 cursor-pointer transition-colors border-b border-default text-sm', selected ? 'bg-accent/5' : 'hover:bg-elevated' )} > {/* ID */} #{ticket.id} {/* Summary */} {ticket.summary} {/* Company */} {ticket.company_name ?? '—'} {/* Board */} {ticket.board_name ?? '—'} {/* Status badge */} {ticket.status_name ?? '—'} {/* Priority */} {ticket.priority_name ?? '—'}
) }