import React from 'react'; import { Link } from 'react-router-dom'; interface AiReadinessBannerProps { score: number; grade: string; fixCount?: number; fixesTo?: string; } const ZONE_TEXT: Record = { A: { label: 'Green zone', tone: 'On the AI shelf and converting.' }, B: { label: 'Almost green', tone: 'A couple of fixes will push you to A.' }, C: { label: 'Mid-zone', tone: 'Two fixes below will move you to green.' }, D: { label: 'Red zone', tone: 'Critical gaps stopping AI traffic.' }, F: { label: 'Red zone', tone: 'Critical gaps stopping AI traffic.' }, }; const DOT_BY_GRADE: Record = { A: 'bg-emerald-500', B: 'bg-lime-500', C: 'bg-amber-500', D: 'bg-orange-500', F: 'bg-red-500', }; const SCORE_COLOR_BY_GRADE: Record = { A: 'text-emerald-600', B: 'text-lime-600', C: 'text-amber-600', D: 'text-orange-600', F: 'text-red-600', }; export function AiReadinessBanner({ score, grade, fixCount, fixesTo = '/agent-analytics?tab=gaps', }: AiReadinessBannerProps) { const clamped: number = Math.max(0, Math.min(100, Math.round(score))); const zone = ZONE_TEXT[grade] ?? ZONE_TEXT.C; const dotColor: string = DOT_BY_GRADE[grade] ?? 'bg-amber-500'; const scoreColor: string = SCORE_COLOR_BY_GRADE[grade] ?? 'text-amber-600'; const fixesLabel: string = typeof fixCount === 'number' && fixCount > 0 ? `${fixCount} fix${fixCount === 1 ? '' : 'es'} below will move you to green.` : zone.tone; return (
AI Readiness:{' '} {clamped}/100 · {zone.label}. {fixesLabel}
See fixes
); }