papertrail/components/views/QuerySummary.tsx
caelum0x 695a365ae4 feat: PaperTrail — enterprise evidence-verification platform
Multi-tenant platform (182 pages, 228 API routes, ~30 modules) built on a
deterministic verification core: clinical-trial claims checked against
ClinicalTrials.gov registered results and raw event counts (ARR/NNT/RR+CI
recomputed in code, oracle-tested), code-enforced exact-span grounding, and
multi-source cross-verification. Auth/RBAC/multi-tenancy, document processing
at scale (unpdf + Docling), agentic workflows, Claude Science connector,
compliance/audit, billing, public API, and more.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 07:21:22 +03:00

50 lines
1.5 KiB
TypeScript

import { operatorLabel, type ViewQuery } from "./api";
interface QuerySummaryProps {
query: ViewQuery;
className?: string;
}
// Compact, read-only rendering of a view's query: search term, filter chips, and
// sort chips. Shown in list rows and on the detail page so users can eyeball a
// view without opening it.
export function QuerySummary({ query, className }: QuerySummaryProps) {
const hasSearch = Boolean(query.search && query.search.trim());
const hasFilters = query.filters.length > 0;
const hasSort = query.sort.length > 0;
if (!hasSearch && !hasFilters && !hasSort) {
return (
<span className={`text-sm text-ink/40 ${className ?? ""}`}>
No filters — matches everything.
</span>
);
}
return (
<div className={`flex flex-wrap items-center gap-1.5 ${className ?? ""}`}>
{hasSearch ? (
<span className="rounded bg-paper border border-ink/10 px-2 py-0.5 text-xs text-ink/60">
search: “{query.search}”
</span>
) : null}
{query.filters.map((f, i) => (
<span
key={`f-${i}`}
className="rounded bg-paper border border-ink/10 px-2 py-0.5 text-xs text-ink/60"
>
{f.field} {operatorLabel(f.operator)} {f.value || "—"}
</span>
))}
{query.sort.map((s, i) => (
<span
key={`s-${i}`}
className="rounded border border-accent/30 px-2 py-0.5 text-xs text-accent"
>
↕ {s.field} {s.direction}
</span>
))}
</div>
);
}