SPB Git forge

spb/websensor

Public
33commits 1branches 0releases
3.4 MBsize
maindefault branch
10 days agolast push
TypeScript 55.4% Python 43.2% SQL 1.2%
2.7 KB · 56 lines tsx
Raw Blame History
1import Link from "next/link";2import { LiveFeed } from "@/components/live-feed";3import { LiveStrip } from "@/components/live-strip";4import { CoverageRail } from "@/components/coverage-rail";5import { AnomalyRail, BreakingRail, ClustersPanel, SilentRail, TrendingPanel } from "@/components/rail";6import { EventRow } from "@/components/event-row";7import { Empty, Panel } from "@/components/ui";8import { api } from "@/lib/api";9import { agoIso } from "@/lib/format";1011export const dynamic = "force-dynamic";1213/**14 * Homepage (spec §64, §94): hero line · live system strip · live feed · right rail (breaking now,15 * trending, anomalous) · lower area (clusters, silent changes, infrastructure pulse). One coherent16 * data surface; the product sells the product.17 */18export default async function HomePage() {19  const [stats, events, trending, clusters, breaking, explore, infra] = await Promise.all([20    api.stats(),21    api.events({ limit: 60 }),22    api.trending(24, 10),23    api.clusters(30, 48),24    api.breakingDesk(),25    api.explore(),26    api.events({ limit: 8, group: "reliability", after: agoIso(12 * 3600e3) }),27  ]);28  return (29    <>30      <div className="mb-3 flex flex-wrap items-baseline justify-between gap-2">31        <h1 className="text-[16px] font-semibold tracking-tight">32          The Web is changing. <span className="text-fg-muted">We are watching.</span>33        </h1>34        <p className="text-[12px] text-fg-subtle">WebSensor continuously watches the public web for meaningful changes, preserving evidence and connecting signals into real-world events.</p>35      </div>36      <LiveStrip initial={stats} />37      <div className="grid grid-cols-1 gap-4 xl:grid-cols-[1fr_340px] [&>*]:min-w-0">38        <LiveFeed initial={events.items} initialCursor={events.nextCursor} />39        <aside className="flex flex-col gap-4">40          <BreakingRail items={breaking?.breaking_now ?? []} developing={breaking?.developing ?? []} />41          <TrendingPanel items={trending.items} />42          <AnomalyRail items={explore?.unusual_activity ?? []} />43          <CoverageRail />44        </aside>45      </div>46      <div className="mt-4 grid grid-cols-1 gap-4 lg:grid-cols-3 [&>*]:min-w-0">47        <ClustersPanel items={clusters.items} title="Event clusters · 48 h" />48        <SilentRail items={explore?.silent_changes ?? []} />49        <Panel title="Infrastructure pulse · 12 h" dense action={<Link href="/live?group=reliability" className="text-[11px] text-fg-subtle hover:text-fg">live →</Link>}>50          {infra.items.length ? infra.items.slice(0, 6).map((e) => <EventRow key={e.id} ev={e} />) : <Empty>No outage, incident or maintenance signal in the last 12 h.</Empty>}51        </Panel>52      </div>53    </>54  );55}56