/**
 * /timeline — chronological view of declassified events / sightings / operations.
 *
 * Pure filesystem read (wiki/entities/events/*.md frontmatter date_start).
 * Client component fetches /api/timeline and renders bands by decade.
 */
import Link from "next/link";
import { AuthBar } from "@/components/auth-bar";
import { TimelineView } from "@/components/timeline-view";

export const dynamic = "force-dynamic";

export default function TimelinePage({ searchParams }: { searchParams?: Promise<{ q?: string; from?: string; to?: string }> }) {
  return (
    <main className="min-h-screen p-6 md:p-10 max-w-5xl mx-auto">
      <div className="flex items-start justify-between gap-4 mb-6">
        <Link href="/" className="font-mono text-xs text-[#7fdbff] hover:text-[#00ff9c]">
          ← home
        </Link>
        <AuthBar />
      </div>

      <header className="mb-6">
        <div className="font-mono text-[10px] text-[#5a6678] tracking-widest uppercase mb-2">
          timeline · UAP events chronology
        </div>
        <h1 className="font-mono text-2xl text-[#00ff9c] mb-1">▍ Cronologia</h1>
        <p className="text-[#8896aa] text-sm">
          Eventos extraídos do corpus declassificado, ordenados por <code>date_start</code>.
          Filtros: faixa de datas (1940-2026), busca por nome/narrativa.
        </p>
      </header>

      <TimelineView initialSearch={searchParams ? undefined : undefined} />
    </main>
  );
}
