← back to Govarbitrage

src/app/deals/page.tsx

105 lines

import type { Metadata } from "next";
import Link from "next/link";
import { listDigestEditions } from "@/lib/digest-snapshot";
import { publicBaseUrl } from "@/lib/site";

export const dynamic = "force-dynamic";

const base = publicBaseUrl();

export const metadata: Metadata = {
  title: "Deal Archive — Top-10 Gov-Surplus Deals Digest | GovArbitrage",
  description:
    "Every edition of the twice-daily Top-10 government-surplus deals digest — honesty-gated, confidence-labeled, conservative numbers only.",
  alternates: { canonical: `${base}/deals` },
  openGraph: {
    title: "GovArbitrage Deal Archive — Top-10 Gov-Surplus Deals",
    description:
      "Browse past editions of the twice-daily Top-10 government-surplus arbitrage digest. Every figure is confidence-discounted and capped, never inflated.",
    url: `${base}/deals`,
    type: "website",
  },
};

const fmtDate = (iso: string) =>
  new Date(`${iso}T12:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC",
  });

export default async function DealsArchivePage() {
  const editions = await listDigestEditions(60);

  return (
    <main className="mx-auto max-w-2xl space-y-6 p-5 pt-14 text-foreground">
      <header className="space-y-3 text-center">
        <h1 className="text-3xl font-semibold tracking-tight">The Deal Archive</h1>
        <p className="text-base text-muted-foreground leading-relaxed">
          Every edition of our twice-daily Top-10 government-surplus deals digest,
          frozen exactly as it went out. Every figure passes the Honesty Gate:
          confidence-discounted, capped, and disclaimed — we publish the
          conservative low band, never the hype number.
        </p>
        <Link
          href="/newsletter"
          className="inline-flex items-center justify-center rounded-md bg-primary px-5 py-2.5 text-sm font-medium text-primary-foreground transition-colors hover:opacity-90"
        >
          Subscribe free — get the next edition by email →
        </Link>
      </header>

      {editions.length === 0 ? (
        <div className="rounded-xl border border-dashed p-10 text-center text-muted-foreground">
          <p className="m-0 font-semibold text-foreground">First edition coming at launch.</p>
          <p className="mt-2 text-sm">
            The digest publishes twice daily (6am &amp; 5pm PT) once we go live.{" "}
            <Link href="/newsletter" className="text-primary hover:underline">Subscribe now</Link>{" "}
            and you&apos;ll get edition #1.
          </p>
        </div>
      ) : (
        <ul className="space-y-3 p-0 list-none">
          {editions.map((e) => (
            <li
              key={`${e.date}-${e.slot}`}
              className="rounded-xl border bg-card text-card-foreground px-4 py-3"
            >
              <Link href={`/deals/${e.date}`} className="no-underline text-inherit block">
                <div className="flex items-baseline justify-between gap-3">
                  <span className="font-bold text-base">
                    {fmtDate(e.date)}{" "}
                    <span className="text-muted-foreground font-medium">
                      · {e.slot === "AM" ? "Morning" : "Evening"} edition
                    </span>
                  </span>
                  <span className="text-muted-foreground text-xs whitespace-nowrap">
                    {e.dealCount} deal{e.dealCount === 1 ? "" : "s"}
                  </span>
                </div>
                <div className="text-muted-foreground text-sm mt-1">
                  {e.deals.length > 0 ? (
                    <>Top pick: {e.deals[0].title}</>
                  ) : (
                    <>No deals cleared the hot-deal gate this run — we&apos;d rather send nothing than pad the list.</>
                  )}
                </div>
              </Link>
            </li>
          ))}
        </ul>
      )}

      <p className="text-center text-muted-foreground text-xs leading-relaxed">
        Archive editions show deal teasers. Exact recommended max bids and the
        full cost math go to{" "}
        <Link href="/newsletter" className="text-muted-foreground hover:text-foreground underline">
          free subscribers
        </Link>
        . Estimates are heuristic — always verify comps before bidding.
      </p>
    </main>
  );
}