disclosure-bureau/web/app/layout.tsx
Luiz Gustavo 2ea350e283
Some checks failed
CI / Web — typecheck + lint + build (push) Failing after 36s
CI / Scripts — Python smoke (push) Failing after 5s
CI / Web — npm audit (push) Failing after 37s
CI / Retrieval — golden set (Recall@5 + MRR) (push) Failing after 5s
ux(nav): unify navbar palette, localize, fix locale-aware metadata
Visual audit found several issues in the navbar / header layer; this pass
addresses the cluster.

- AuthBar: localize sign in/out + dev-disabled message; switch matrix-green
  (#00ff9c) to gold (#e0c080) to match the magazine palette.
- NavLink (new): client component reading usePathname to mark the active
  section with aria-current="page" and a gold underline+fill, so the user
  knows where they are inside the entity hub.
- Locale toggle: bump font to 12px, widen the pill, lift the active state's
  contrast. Hard reload on switch (window.location.reload) instead of
  router.refresh — that is what makes the <title>, <html lang> and og:locale
  actually update on toggle (router.refresh kept stale layout metadata).
- Root layout: convert static `export const metadata` to generateMetadata()
  so title/description/OG/twitter all read the cookie per request. Drop the
  duplicate floating LocaleToggle at bottom-left; the navbar carries it now.
- BureauNav: drop the cyan-on-home / gold-on-bureau split (palette mismatch
  with SiteHeader); single gold tone; localize "home"/"case files" + aria
  labels; mount AuthBar inside the bar so sub-pages get a sign-in surface.
- Pages using BureauNav: drop the standalone <AuthBar /> below it (now
  duplicated). Affected: /bureau, /c/[slug], /h/[hypothesisId], /jobs/[id].
- Lift nav-link rest text from #9aa6b8 to #cbd2dd for WCAG-AA on near-black.

Verified live: title/lang/og:locale switch with cookie; active link gold
indicator on /sightings; "Entrar"/"Sign in" localizes; no double AuthBar.

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

134 lines
5.3 KiB
TypeScript

import type { Metadata } from "next";
import { JetBrains_Mono, Inter, Fraunces } from "next/font/google";
import "./globals.css";
import { CommandPalette } from "@/components/command-palette";
import { getLocale } from "@/components/locale-toggle";
const inter = Inter({ subsets: ["latin"], variable: "--font-sans" });
const mono = JetBrains_Mono({ subsets: ["latin"], variable: "--font-mono" });
const fraunces = Fraunces({
subsets: ["latin"],
variable: "--font-display",
// No explicit `weight` → next/font treats this as a variable font and
// exposes the full weight range via CSS. `axes` requires variable mode.
axes: ["SOFT", "WONK"],
});
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://disclosure.top";
// Site-wide metadata is locale-aware: title, description, OG, twitter, html
// lang and openGraph.locale must all switch when the cookie toggles. Static
// `export const metadata` is resolved without cookies, so the title would
// stay pinned to whichever language built the page. generateMetadata() runs
// per request and can read the cookie via getLocale().
export async function generateMetadata(): Promise<Metadata> {
const locale = await getLocale();
const t = locale === "en"
? {
title: "The Disclosure Bureau — declassified UAP/UFO",
template: "%s · The Disclosure Bureau",
desc: "122 declassified US Department of War documents on UAP/UFO. " +
"Pilots, officers and physicists describe what they saw. Sightings, " +
"witnesses, catalogued craft — the open files of disclosure.",
og_desc: "122 declassified documents. Pilots, officers, physicists describe what they saw.",
tw_desc: "Declassified UAP/UFO files, narrated from the public record.",
ogLocale: "en_US",
altLocale: "pt_BR",
}
: {
title: "The Disclosure Bureau — UAP/UFO desclassificado",
template: "%s · The Disclosure Bureau",
desc: "122 documentos desclassificados do Departamento de Guerra dos EUA sobre UAP/UFO. " +
"Pilotos, oficiais e físicos relatam o que viram. Avistamentos, testemunhas, " +
"objetos catalogados — arquivos abertos da divulgação.",
og_desc: "122 documentos desclassificados. Pilotos, oficiais, físicos relatam o que viram.",
tw_desc: "Arquivos UAP/UFO desclassificados, narrados a partir do registro público.",
ogLocale: "pt_BR",
altLocale: "en_US",
};
return {
metadataBase: new URL(SITE_URL),
title: { default: t.title, template: t.template },
description: t.desc,
keywords: [
"UAP", "UFO", "ovni", "desclassificado", "war.gov", "Pentagon",
"Kenneth Arnold", "Mantell", "green fireballs", "Sandia",
"Project Blue Book", "Robertson Panel", "AATIP",
"documentos desclassificados", "avistamento", "testemunha",
"disclosure", "divulgação UFO",
],
authors: [{ name: "The Disclosure Bureau" }],
openGraph: {
type: "website",
siteName: "The Disclosure Bureau",
title: t.title,
description: t.og_desc,
locale: t.ogLocale,
alternateLocale: [t.altLocale],
url: SITE_URL,
images: [{
url: `${SITE_URL}/api/static/processing/case-art/green-fireballs-narrative.png`,
width: 2000, height: 1125,
alt: t.title,
}],
},
twitter: {
card: "summary_large_image",
title: "The Disclosure Bureau",
description: t.tw_desc,
images: [`${SITE_URL}/api/static/processing/case-art/green-fireballs-narrative.png`],
},
alternates: {
canonical: "/",
languages: { "pt-BR": "/", "en-US": "/" },
},
robots: {
index: true,
follow: true,
googleBot: {
index: true,
follow: true,
"max-image-preview": "large",
"max-snippet": -1,
},
},
other: {
"ai:purpose":
"Public, citation-linked archive of declassified UAP/UFO documents from the US Department of War. Each case file is grounded in primary-source memos with verbatim quotes and bbox-cropped imagery.",
"ai:license": "Documents are US Government works in the public domain; site narrative © Disclosure Bureau, CC-BY 4.0.",
},
};
}
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const locale = await getLocale();
return (
<html lang={locale === "en" ? "en" : "pt-BR"} className="dark" data-locale={locale}>
<head>
{/* JSON-LD: organization-level schema. Per-page Article/Event schemas
are added in their own routes. */}
<script
type="application/ld+json"
dangerouslySetInnerHTML={{ __html: JSON.stringify({
"@context": "https://schema.org",
"@type": "Organization",
name: "The Disclosure Bureau",
url: SITE_URL,
description:
"Public archive of declassified UAP/UFO documents from the US Department of War, " +
"with narrated case files grounded in primary sources.",
sameAs: [],
}) }}
/>
</head>
<body className={`${inter.variable} ${mono.variable} ${fraunces.variable}`}>
<a href="#main" className="skip-link">
{locale === "en" ? "Skip to content" : "Pular para o conteúdo"}
</a>
{children}
<CommandPalette />
</body>
</html>
);
}