import type { TalentTemplate } from '../types/visual' interface TalentCardProps { template: TalentTemplate hiringId?: string | null onHire: (templateId: string) => void onClick: (template: TalentTemplate) => void } /** Derive a 2-letter monogram from a name. "Creative Director" → "CD". */ function monogram(name: string): string { const words = name.trim().split(/\s+/).filter(Boolean) if (words.length === 0) return '?' if (words.length === 1) return words[0].slice(0, 2).toUpperCase() return (words[0][0] + words[words.length - 1][0]).toUpperCase() } export function TalentCard({ template: t, hiringId, onHire, onClick }: TalentCardProps) { const isHiring = hiringId === t.template_id const avatarStyle = t.color ? { background: `color-mix(in srgb, ${t.color} 18%, transparent)`, color: t.color, boxShadow: `inset 0 0 0 1px color-mix(in srgb, ${t.color} 28%, transparent)`, } : undefined const chipPool: string[] = [] const seen = new Set() for (const c of [...t.tags, ...t.domains]) { if (!seen.has(c)) { seen.add(c); chipPool.push(c) } } const visibleChips = chipPool.slice(0, 3) const overflow = chipPool.length - visibleChips.length return (
onClick(t)}>
{t.emoji ? ( {t.emoji} ) : ( {monogram(t.name)} )}
{t.name} {t.preferred_external_agent && ( {t.preferred_external_agent} )}
{t.category && {t.category}}
{t.vibe &&
"{t.vibe}"
} {t.description &&
{t.description}
}
{visibleChips.length > 0 && (
{visibleChips.map(c => ( {c} ))} {overflow > 0 && ( +{overflow} )}
)}
) }