import type { ReactNode } from 'react'; import { cn } from '../../lib/cn'; import type { Lead, Tone } from '../../types'; import { Avatar } from '../core/Avatar'; import { SegmentBadge } from './SegmentBadge'; import { ChannelBadge } from './ChannelBadge'; export interface LeadRowProps { lead: Lead; onClick?: () => void; className?: string; /** When set, replaces the "last action" cell (e.g. a worklist action button). * Clicks inside it don't trigger the row's onClick. */ action?: ReactNode; } /** Shared grid template for the leads table — keep header + rows in sync. */ export const LEAD_GRID = 'grid-cols-[2fr_64px_96px_120px_1.4fr_2fr]'; const DOT: Record = { neutral: 'bg-muted', success: 'bg-emerald-600', warning: 'bg-amber-600', accent: 'bg-sunrise-600', info: 'bg-sky-600', }; function scoreColor(score: number): string { if (score >= 75) return 'var(--sunrise-600)'; if (score >= 50) return 'var(--amber-600)'; return 'var(--slate-500)'; } /** Leads-list table row — name, score, segment, channel, owner, last AI action * (or a custom `action` cell). */ export function LeadRow({ lead, onClick, className, action }: LeadRowProps) { return (
{/* name */}
{lead.name}
{lead.city}
{/* score */}
{lead.score}
{/* segment */}
{/* channel */}
{/* owner */}
{lead.owner}
{/* last AI action — or a custom action cell */} {action !== undefined ? (
e.stopPropagation()}> {action}
) : (
{lead.lastAction}
)}
); }