"use client"; /** * Validation panel — surfaces every error and warning from * `validateFlowForActivation`. Lives once at the bottom of the * editor shell so it's visible in both views (canvas + list). * * Node-scoped issues are clickable: tapping one calls * `requestFlash(node_key)` on the editor context. List view's * useEffect on `flashKey` expands + scrolls + flashes the row; * canvas view's useEffect pans the viewport + flashes the card. * Both views read the same flashKey so the panel doesn't need * per-view plumbing. * * Trigger-scoped issues are NOT clickable from canvas — trigger * config is a list-only panel (it's a flat form, not a graph * concept). User can switch to List to address them. */ import { CircleAlert, CircleCheck } from "lucide-react"; import { cn } from "@/lib/utils"; import type { ValidationIssue } from "@/lib/flows/validate"; import { useFlowEditor } from "./flow-editor-state"; export function ValidationPanel() { const { issues, requestFlash } = useFlowEditor(); if (issues.length === 0) { // Slate-950 base + emerald accents so the panel stays readable when // sticky-positioned over scrolled-behind node cards (a translucent // bg-emerald-500/10 would bleed through ugly). return (
{issue.node_key}
)}
{issue.message}
>
);
// Only node-scoped issues can jump; trigger-scoped issues have no
// destination (the trigger panel is list-only and already at the
// top of that view).
if (issue.node_key && onJump) {
return (
);
}
return (