papertrail/components/console/StateBanners.tsx
caelum0x 4f7ba29383 feat: production hardening — real Python engines, no-stub verify guard, console UI kit
Backend (make everything real, no stubs):
- Implement all 10 Python engine scripts (scispacy, pymare, pytrials, minicheck,
  indra, openalex, paperqa, pykeen, storm, asreview) behind the existing lib/engines
  bridges. openalex + pytrials are zero-dep (stdlib urllib, work out of the box); the
  8 heavy engines run the real library when installed and emit an honest structured
  error envelope when absent — no phantom capability, no faked outputs.
- /api/verify: hard production guard so the offline fixture path can NEVER activate in
  production (MOCK_MODE gated to NODE_ENV!=production); prod always runs the real
  retrieve→extract→verify pipeline.
- /api/auth/google: wrap the OAuth entrypoint in try/catch — fail closed to /login.
- MoA: wire the previously-dangling design_priors artifact into the multivers
  cross-source verifier as a mean-preserving, clamped (+/-25%) design-credibility
  weight; exact no-op when absent, so the benchmark verdict mix is protected.

Frontend (enterprise-grade polish):
- New shared console UI kit (components/console/ui.tsx): Skeleton, Card, Badge,
  Button, StatCard, EmptyState — one source for the house tokens.
- Skeleton shimmer keyframe; LoadingBanner now renders shimmer instead of plain text
  (propagates to ~29 tool pages, signature unchanged).
- Real workspace overview landing page: live stats (fixes a phantom 'claims' field
  the old page always rendered as 0), recent verifications with permalinks, quick
  actions, skeleton loading + empty + error states.

Verified: tsc clean, 10/10 verify integration tests pass, production build compiles
all 417 pages.
2026-07-11 21:46:23 +03:00

39 lines
1.3 KiB
TypeScript

// Shared page-level state banners for console tool pages (error / loading).
// These use the house Tailwind tokens (bg-paper, text-ink, accent, red-700 for
// errors) so every tool page renders identical error and loading states.
//
// Presentational only — no data flow, no API calls. Pages own their state and
// simply render these when appropriate.
import { SkeletonText } from "./ui";
// Full-width error banner. Uses the house error color (red-700) and is announced
// to assistive tech via role="alert".
export function ErrorBanner({ message }: { message: string }) {
return (
<div
role="alert"
className="rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700"
>
{message}
</div>
);
}
// Full-width loading banner shown while a request is in flight. Accepts a short
// status message describing what the tool is doing. Renders animated skeleton
// shimmer bars above the message so an in-flight request reads as "working",
// not "stuck". Signature is unchanged so every existing caller keeps working.
export function LoadingBanner({ message }: { message: string }) {
return (
<div
role="status"
aria-live="polite"
className="rounded-lg border border-ink/15 bg-white p-6"
>
<SkeletonText lines={3} />
<p className="mt-4 text-sm text-ink/50">{message}</p>
</div>
);
}