/** * The ten most recently solved problems — LeetCode's "Recent AC" list. Each * row is dated by the problem's first pass (an ET calendar date: the Worker * logs days, not times), read relative to today in ET with the full date on * hover. A row links to the problem's docs page when one exists: the * sync-generated short links (`redirects.ts`) are exactly the pages built. */ import { StatsPending } from "../components/progress/shared"; import { Card, CardContent, CardHeader, CardTitle } from "../components/ui/card"; import { useStats, utcDate } from "../lib/stats"; import redirects from "../redirects"; export const client = "load"; const PAGES = new Map(redirects.map((r) => [r.from, r.to])); const ET_TODAY = new Intl.DateTimeFormat("en-CA", { timeZone: "America/New_York" }); const RELATIVE = new Intl.RelativeTimeFormat("en", { numeric: "auto" }); const FULL = new Intl.DateTimeFormat("en-US", { dateStyle: "medium", timeZone: "UTC" }); const DAY_MS = 86_400_000; export default function RecentSolves() { const load = useStats(); if (load.phase !== "ready") { return ( Recently solved ); } const today = utcDate(ET_TODAY.format(new Date())).getTime(); return ( Recently solved {load.stats.recent.length === 0 ? (

Nothing solved yet.

) : (
    {load.stats.recent.map((p) => { const date = utcDate(p.date); const page = PAGES.get(`/${p.lc}`); const name = ( <> {p.lc}. {p.title} ); return (
  1. {page ? ( {name} ) : ( {name} )}
  2. ); })}
)}
); }