TypeScript 55.4%
Python 43.2%
SQL 1.2%
1import Link from "next/link";2import type { Metadata } from "next";3import { DiffViewer } from "@/components/diff-viewer";4import { Empty, PageHeader, Panel } from "@/components/ui";5import { api } from "@/lib/api";6import { utcDateTime } from "@/lib/format";78export const dynamic = "force-dynamic";9export const metadata: Metadata = { title: "Compare snapshots", robots: { index: false } };1011export default async function ComparePage({ searchParams }: { searchParams: Promise<{ a?: string; b?: string }> }) {12 const { a, b } = await searchParams;13 const d = a && b ? await api.compare(a, b) : null;14 return (15 <>16 <PageHeader kicker="Snapshot comparison" title={d ? <span className="font-mono text-base">{utcDateTime(d.a.captured_at)} → {utcDateTime(d.b.captured_at)}</span> : "Compare"} description={d?.a.url ? <Link href={`/url?u=${encodeURIComponent(d.a.url)}`} className="font-mono text-[12px] hover:underline">{d.a.url}</Link> : "Provide two snapshot ids (?a=&b=)."} />17 {d ? (18 <DiffViewer unified={d.diff.unified} summary={{ kind: "text", added: d.diff.added, removed: d.diff.removed, modified: d.diff.modified, stats: d.diff.stats }} defaultTab="split" />19 ) : (20 <Panel dense><Empty>Snapshots not found.</Empty></Panel>21 )}22 </>23 );24}25