User: "quero que o usuário possa escolher o idioma na navbar, e então leia
o site todo em seu idioma."
The locale infrastructure already existed (cookie + getLocale() + every
page renders bilingual). The toggle only lived as a subtle floating
control bottom-left. This surfaces it in the navbars where users expect
it, and confirms whole-site language switching.
locale-toggle-client.tsx
- New variant="navbar": gold-amber pill matching the magazine theme
(PT | EN, active = solid gold). Retro green variant kept for the
floating fallback.
- Guard: clicking the already-active language is a no-op.
- aria-pressed on each button for a11y.
locale-toggle.tsx: LocaleToggle gains variant passthrough.
site-header.tsx: <LocaleToggle variant="navbar"> added to the main nav
(homepage + /sightings /witnesses /objects /locations /operations
/documents).
bureau-nav.tsx: optional `locale` prop renders the same toggle pushed
to the right (ml-auto) on /bureau, /c/[slug], /h/[id], /jobs/[id].
All four callers now pass locale (getLocale added to h + jobs pages).
Cookie-based: switching sets `locale` cookie + router.refresh(); the
server re-renders every component through getLocale(), so the entire
page — headers, hero, summaries, case narratives, entity cards — flips
language in one click. The floating bottom-left toggle stays as a global
fallback for pages without a navbar (/d, /e, /search, /graph).
Also this session: Sun-Tzu smoke succeeded on the refreshed
CLAUDE_CODE_OAUTH_TOKEN — brief B-0001 written for the green fireballs
("bolas de fogo verdes confinadas ao corredor nuclear... cor espectral
e trajetória quase horizontal que os próprios analistas consideraram
irreconciliáveis com meteoros naturais", 3 pillars). Bulk entity
enrichment resumed in the background.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
66 lines
2.8 KiB
TypeScript
66 lines
2.8 KiB
TypeScript
import type { Metadata } from "next";
|
|
import Link from "next/link";
|
|
import { listDocuments, readDocument } from "@/lib/wiki";
|
|
import { getLocale } from "@/components/locale-toggle";
|
|
import { SiteHeader } from "@/components/site-header";
|
|
import { BureauNav } from "@/components/bureau-nav";
|
|
import { summarize, pickPitch } from "@/lib/doc-summary";
|
|
import { DocListFilters } from "@/components/doc-list-filters";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Documentos desclassificados — Arquivo UAP/UFO",
|
|
description:
|
|
"Cada memorando, telegrama e relatório desclassificado do Departamento de Guerra dos EUA sobre UAP/UFO. " +
|
|
"Páginas indexadas, citações vinculadas, busca por texto.",
|
|
};
|
|
|
|
export default async function DocumentsPage() {
|
|
const locale = (await getLocale()) === "en" ? "en" : "pt-br";
|
|
const ids = await listDocuments();
|
|
const summaryLang: "pt" | "en" = locale === "en" ? "en" : "pt";
|
|
|
|
const docs = await Promise.all(
|
|
ids.map(async (id) => {
|
|
const f = await readDocument(id);
|
|
return {
|
|
id,
|
|
title: (f?.fm.canonical_title as string) ?? id,
|
|
pages: (f?.fm.page_count as number) ?? 0,
|
|
collection: (f?.fm.collection as string) ?? "uncategorized",
|
|
classification: (f?.fm.highest_classification as string) ?? "—",
|
|
summary: pickPitch(f?.fm as Record<string, unknown> | undefined, summaryLang) ?? (f?.body ? summarize(f.body, summaryLang) : ""),
|
|
};
|
|
}),
|
|
);
|
|
const totalPages = docs.reduce((s, d) => s + d.pages, 0);
|
|
|
|
return (
|
|
<div className="min-h-screen">
|
|
<SiteHeader locale={locale} />
|
|
<BureauNav locale={locale} crumbs={[{ label: locale === "en" ? "documents" : "documentos" }]} />
|
|
|
|
<div className="mx-auto max-w-7xl px-4 md:px-8 py-10 md:py-14">
|
|
<header className="mb-10">
|
|
<div className="text-[10px] font-mono uppercase tracking-[0.18em] text-[#5a6678] mb-3">
|
|
{locale === "en" ? "// The primary record" : "// O registro primário"}
|
|
</div>
|
|
<h1 className="font-display text-4xl md:text-6xl font-semibold text-[#e7ecf3] leading-tight mb-3">
|
|
{locale === "en" ? "Documents" : "Documentos"}
|
|
</h1>
|
|
<p className="text-lg text-[#9aa6b8] max-w-2xl">
|
|
{locale === "en"
|
|
? `${ids.length} declassified files · ${totalPages.toLocaleString("pt-BR")} pages · every memo, telegram and report.`
|
|
: `${ids.length} arquivos desclassificados · ${totalPages.toLocaleString("pt-BR")} páginas · cada memorando, telegrama e relatório.`}
|
|
</p>
|
|
</header>
|
|
|
|
<DocListFilters docs={docs} />
|
|
</div>
|
|
<noscript>
|
|
<Link href="/" className="hidden">{locale === "en" ? "Home" : "Início"}</Link>
|
|
</noscript>
|
|
</div>
|
|
);
|
|
}
|