import { createSignal, type JSX, Show } from "solid-js"; import { CONFIG } from "../config"; import { runTrigger, triggerStatus } from "../state"; import { GlassCard } from "./GlassCard"; const STATUS_TONE = { idle: "text-ink-400", pending: "text-ink-200", ok: "text-ok", err: "text-err", } as const; export interface TriggerProps { /** * `bar` — slim one-line command row for the Operations landing view. * `panel` — fuller form (current look) for the Triage view. * Both gate on CONFIG.replayEnabled; read-only degrades to a slim inline * chip (bar) or the first-run explainer panel (panel, handled by Triage). */ variant?: "bar" | "panel"; } export function Trigger(props: TriggerProps): JSX.Element { const variant = (): "bar" | "panel" => props.variant ?? "panel"; const [issue, setIssue] = createSignal(""); const validate = (): string | null => { const value = issue().trim(); if (!value) return "enter owner/repo#NN or github issue url"; return null; }; const handleTriage = (): void => { const value = issue().trim(); if (!value) return; void runTrigger({ mode: "triage", issue: value }); }; const handleRetry = (): void => { const value = issue().trim(); if (!value) return; void runTrigger({ mode: "retry", issue: value }); }; // ── bar variant: slim command row (Operations). Read-only → inline chip. ── return ( }> trigger disabled · read-only set ROBOMP_REPLAY_TOKEN to enable } >
setIssue(ev.currentTarget.value)} onKeyDown={(ev) => { if (ev.key === "Enter") handleTriage(); }} class="flex-1 min-w-[200px] font-mono" /> {triggerStatus().text}
); } interface PanelBodyProps { issue: () => string; setIssue: (v: string) => void; handleTriage: () => void; handleRetry: () => void; validate: () => string | null; } // ── panel variant: fuller form (Triage). Read-only handled by the Triage // view's first-run panel; if replay is on, this is the active form. ── function PanelBody(p: PanelBodyProps): JSX.Element { return ( trigger disabled. set ROBOMP_REPLAY_TOKEN in the server env to enable manual triage and retry actions. } >
p.setIssue(ev.currentTarget.value)} onKeyDown={(ev) => { if (ev.key === "Enter") p.handleTriage(); }} class="flex-1 min-w-[220px] font-mono" />
{p.validate() ?? "ready"} } > {triggerStatus().text}
); }