import React, { useEffect, useState } from 'react'; import { __, _n, sprintf } from '@wordpress/i18n'; import { api } from '../api'; import { Card, Badge, Notice } from './ui'; import Explain from './Explain'; import { EngineMark } from './brands'; /** * Readiness per answer engine. * * A single blended "AI score" hides the only thing worth knowing: which engine * you are invisible to. Six columns, each with its own open items, makes the * gap the first thing you see rather than something you have to derive. */ export default function EngineReadiness() { const [data, setData] = useState(null); const [open, setOpen] = useState(null); const [error, setError] = useState(null); useEffect(() => { api.get('/score/engines').then(setData).catch((e) => setError(e.message)); }, []); if (!data) return ( {error ? {error} :
} ); const tone = (n) => (n >= 85 ? 'green' : n >= 60 ? 'yellow' : 'red'); return ( = 85 ? 'good' : data.overall >= 60 ? 'warning' : 'serious'}>{sprintf(__('%d%% overall', 'ai-rank-suite'), data.overall)}} >
{/* * Six rows, not six sub-cards. The cards each carried a meter * and a sentence, which made this half of the screen taller * than the score it sits beside. A row per engine — name, * meter, number — is the reference density; the sentence * ("2 things to fix — OpenAI") moves to the hover and to the * drill-down the row already opens. */}
{data.engines.map((e) => { const t = tone(e.score); const isOpen = open === e.id; return ( ); })}
{open && (() => { const e = data.engines.find((x) => x.id === open); if (!e) return null; return (
{sprintf(__('How %s decides', 'ai-rank-suite'), e.label)}

{e.why}

{e.checks.map((c) => (
{c.label} {!c.pass && ( {c.fix} )}
))}
); })()}

{__('“Optimise for AI” is not one job. ChatGPT reads its own crawl and honours llms.txt. Google AI Overviews are built on the classic index, so ordinary technical SEO decides eligibility and nothing AI-specific does. Perplexity is search-grounded and rewards freshness. Copilot retrieves through Bing, so if Bing has not indexed the page nothing else matters.', 'ai-rank-suite')}

{__('A single blended number averages those away and hides the only thing worth knowing — which engine you are invisible to.', 'ai-rank-suite')}

); }