import Link from "next/link";
import type { Metadata } from "next";
import { Chip, Empty, ExtLink, PageHeader, Panel, Table, Td } from "@/components/ui";
import { api } from "@/lib/api";
import { fmtBytes, shortHash, utcDateTime } from "@/lib/format";
import { CompareForm } from "./compare-form";
export const dynamic = "force-dynamic";
export const metadata: Metadata = { title: "URL history", robots: { index: false } };
export default async function UrlPage({ searchParams }: { searchParams: Promise<{ u?: string }> }) {
const { u } = await searchParams;
if (!u) {
return (
<>
>
);
}
const d = await api.urlHistory(u);
const info = d?.url;
return (
<>
{info?.domain}} title={{u}} actions={<>Open ↗{info?.status && {info.status}}>} />
{d?.history.length ? (
{d.history.map((h) => (
| {utcDateTime(h.at)} |
{h.kind} |
{h.event_slug ? {h.event_title} : h.change_id ? {h.change_kind} change · signal {h.signal?.toFixed(2)} : h.note ?? snapshot {h.snapshot_id}}
|
))}
) : (
No history for this URL.
)}
({ id: s.id, label: `${utcDateTime(s.captured_at)} · ${shortHash(s.canonical_hash, 8)}` }))} />
{d?.snapshots.length ? (
{d.snapshots.map((s) => (
| {utcDateTime(s.captured_at)} |
{s.http_status ?? "—"} |
{fmtBytes(s.content_length)} |
{shortHash(s.canonical_hash)} |
raw |
))}
) : (
No snapshots.
)}
>
);
}