jacquardSnapshot

← snapshot

2935 bytes
import type { VerdictDto } from "@/lib/types";
import { IdChip } from "./id-chip";

/**
 * The gate's answer, rendered exhaustively. The default arm renders as
 * blocked: a variant this UI does not recognise is not an admission. And
 * the honest zero — admitted with nothing checked — is amber, never green:
 * it means the blast radius was ungoverned, not that anything was verified.
 */
export function VerdictPanel({
  verdict,
  repo,
}: {
  verdict: VerdictDto;
  repo: string;
}) {
  if (verdict.verdict === "admitted") {
    if (verdict.ungoverned || verdict.decisions_checked === 0) {
      return (
        <div className="jac-verdict jac-verdict--ungoverned">
          <div className="jac-verdict-title">⚠ Admitted — ungoverned blast radius</div>
          <p>
            Zero decisions govern these paths. Nothing was verified; there was
            nothing declared to verify. The gate binds declared scopes only —
            this is not a green light, it is an absence of governance, said
            plainly.
          </p>
        </div>
      );
    }
    return (
      <div className="jac-verdict jac-verdict--admitted">
        <div className="jac-verdict-title">
          Admitted — {verdict.decisions_checked} settled decision
          {verdict.decisions_checked === 1 ? "" : "s"} checked
        </div>
        <p>
          The gate proves a human attested every governing decision. It does not
          prove the decisions are good — that stays a human question.
        </p>
      </div>
    );
  }

  if (verdict.verdict === "blocked") {
    return (
      <div className="jac-verdict jac-verdict--blocked">
        <div className="jac-verdict-title">
          Blocked — the work parks, nobody is punished
        </div>
        <p>
          {verdict.unsettled.length > 0
            ? `${verdict.unsettled.length} unsettled decision${
                verdict.unsettled.length === 1 ? "" : "s"
              } govern${verdict.unsettled.length === 1 ? "s" : ""} the blast radius. Attestation — recognised, never policed — reopens the way:`
            : `Reason: ${verdict.reason}.`}
        </p>
        {verdict.unsettled.length > 0 ? (
          <ul>
            {verdict.unsettled.map((id) => (
              <li key={id}>
                <IdChip id={id} kind="dec" href={`/repos/${repo}/decisions/${id}`} />{" "}
                <a href={`/repos/${repo}/decisions/${id}`}>
                  read it and sign in your own words →
                </a>
              </li>
            ))}
          </ul>
        ) : null}
      </div>
    );
  }

  // A verdict this UI does not recognise is not an admission.
  return (
    <div className="jac-verdict jac-verdict--blocked">
      <div className="jac-verdict-title">Blocked — unrecognised verdict</div>
      <p>The server answered with a verdict this interface does not know. Unproven is not passed.</p>
    </div>
  );
}