import React from 'react'; import { __ } from '@wordpress/i18n'; import { Progress, ScoreRing } from './ui'; /** * The screen before its first run — same hero as after it. * * A screen that has never run used to be one sentence in a card, and beside * the dashboard's hero it looked broken rather than new. This is the same * shape with the numbers still empty: the ring says "not yet", the sentence * says what the first run does, the button starts it, and the four tiles * name what will be measured. Below it, the steps that stand between now and * the first result, each with its state. * * @param {object} props * @param {string} props.badge Short state, e.g. "Not run yet". * @param {string} props.title What the first run does, in one sentence. * @param {string} props.why Why it matters. * @param {string} [props.action] Primary button label. * @param {Function} [props.onAction] * @param {boolean} [props.busy] * @param {boolean} [props.disabled] * @param {string} [props.ringLabel] * @param {Array<{label: string, hint?: string}>} props.stats The four measures. * @param {Array<{label: string, detail?: string, done: boolean, action?: string, onAction?: Function}>} [props.steps] * @param {Array<{title: string, text: string}>} [props.previews] What the screen will show. */ export default function FirstRun({ badge = __('Not run yet', 'ai-rank-suite'), title, why, action, onAction, busy = false, disabled = false, ringLabel = 'Score', stats = [], steps = [], previews = [], progress = null }) { const next = steps.find((s) => !s.done); return (
{badge}

{title}

{why}

{action && ( )} {next && next.action && ( )}
{/* * The run says where it is, right here. * * Pressing the button turned it into "Working…" and that was * the whole of it: no count, no bar, nothing that changed for * as long as the crawl lasted. Every other long job in the * plugin draws a bar; this screen is where the longest one * starts, and it drew nothing. */} {progress && progress.running && (
)}
{stats.slice(0, 4).map((st) => (
— {st.label}
))}
{steps.length > 0 && (
    {steps.map((s, i) => (
  1. {s.done ? '✓' : i + 1} {s.label} {s.detail && {s.detail}} {!s.done && s.action && ( )}
  2. ))}
)} {previews.length > 0 && (
{previews.map((p) => (
{p.title} {p.text}
))}
)}
); }