disclosure-bureau/web/app/search/page.tsx
Luiz Gustavo babffda882
Some checks failed
CI / Web — typecheck + lint + build (push) Failing after 36s
CI / Scripts — Python smoke (push) Failing after 6s
CI / Web — npm audit (push) Failing after 44s
CI / Retrieval — golden set (Recall@5 + MRR) (push) Failing after 13s
ux(search): redesign /search from dev-tool to magazine
The audit's most ostensive gap: /search rendered as a green-on-black
terminal panel with a tech-jargon eyebrow ("HYBRID SEARCH · BM25 + BGE-M3
DENSE + CROSS-ENCODER RERANK"), no global navbar, and a floating locale
toggle disconnected from the rest of the site. Readers landing here saw
a different product.

Page (app/search/page.tsx):
- Render SiteHeader at the top (same primary nav as home; "Search" now
  picks up the gold active-page indicator).
- Magazine hero: eyebrow + serif headline ("Find a passage, a witness, a
  date." / "Encontre uma passagem, uma testemunha, uma data.") + lead.
- generateMetadata() reads getLocale() so the tab title localises too.

Panel (search-panel.tsx):
- Drop matrix-green palette; switch to magazine gold/cream.
- Rounded input with magnifier icon, gold solid submit pill.
- Plain-language placeholder, no developer terms.
- "Advanced filters" toggle: passage-type + exact doc-id behind a
  collapsible — default state is one clean search box.
- Localise passage-type labels (paragraph → parágrafo, heading → título,
  classification_marking → marcação de classificação, etc).
- Result card palette switched to gold/cream + clearer page · type ·
  classification line; raw retrieval score removed from the UI (debug
  noise for users).
- Locale toggle inside the form gone — the navbar carries it now.

Follow-ups noted (not in this commit):
- SearchAutocomplete dropdown still uses the old terminal palette.
- Navbar wraps on narrow mobile widths and the rightmost links overflow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-28 17:58:41 -03:00

77 lines
3.2 KiB
TypeScript

/**
* /search?q=...&type=...&doc_id=... — bookmarkable hybrid search.
*
* Magazine-style page: same global SiteHeader as the rest of the site, an
* editorial hero that says in plain language what this page is, and a
* SearchPanel below. No tech jargon ("BM25", "BGE-M3", "rerank") visible to
* the reader — that detail is for engineers, not enthusiasts.
*/
import type { Metadata } from "next";
import { SearchPanel } from "@/components/search-panel";
import { SiteHeader } from "@/components/site-header";
import { getLocale } from "@/components/locale-toggle";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://disclosure.top";
export async function generateMetadata(): Promise<Metadata> {
const locale = await getLocale();
const title = locale === "en" ? "Search the archive" : "Buscar no arquivo";
const desc = locale === "en"
? "Search 28,000+ passages from declassified UAP/UFO documents. Verbatim quotes, page-level citations, bbox crops."
: "Busque em mais de 28 mil passagens dos documentos UAP/UFO desclassificados. Citações verbatim, referências por página, recortes em bbox.";
return {
title,
description: desc,
alternates: { canonical: `${SITE_URL}/search` },
openGraph: { title, description: desc, url: `${SITE_URL}/search` },
};
}
export default async function SearchPage({
searchParams,
}: {
searchParams: Promise<{ q?: string; lang?: string; type?: string; doc_id?: string }>;
}) {
const sp = await searchParams;
const locale = (await getLocale()) === "en" ? "en" : "pt-br";
const lang: "pt" | "en" =
(sp.lang as "pt" | "en") ?? (locale === "en" ? "en" : "pt");
const heroEyebrow = locale === "en" ? "Search the archive" : "Buscar no arquivo";
const heroTitle = locale === "en"
? "Find a passage, a witness, a date."
: "Encontre uma passagem, uma testemunha, uma data.";
const heroLead = locale === "en"
? "Search across every declassified page in the bureau. Results link straight to the source — page, chunk, and the original bounding box around the passage."
: "Busque em todas as páginas desclassificadas do bureau. Cada resultado leva direto à fonte — página, trecho e o recorte original ao redor da passagem.";
return (
<div className="min-h-screen bg-[#0a0e1a] text-[#e7ecf3]">
<SiteHeader locale={locale} />
<main id="main" className="mx-auto max-w-5xl px-4 md:px-8 py-10 md:py-14">
<header className="mb-8 md:mb-10">
<div className="text-[10px] font-mono uppercase tracking-[0.18em] text-[#e0c080] mb-3">
{heroEyebrow}
</div>
<h1 className="font-display text-3xl md:text-5xl font-semibold leading-[1.05] tracking-tight text-[#e7ecf3] mb-4">
{heroTitle}
</h1>
<p className="text-[16px] md:text-[17px] text-[#cbd2dd] leading-relaxed font-light max-w-2xl">
{heroLead}
</p>
</header>
<SearchPanel
locale={locale}
initialQ={sp.q ?? ""}
initialLang={lang}
initialType={sp.type ?? ""}
initialDocId={sp.doc_id ?? ""}
/>
</main>
</div>
);
}