SPB Git forge
15commits 1branches 0releases
29.7 MBsize
maindefault branch
10 days agolast push
TypeScript 36.3% Python 31.8% Go 18% JavaScript 9.8% Shell 1.9% SQL 1.4% CSS 0.5%
4.4 KB · 99 lines tsx
Raw Blame History
1import Link from 'next/link';2import { HistoryChart } from '@/components/charts/HistoryChart';3import { Gauge } from '@/components/gauge/Gauge';4import { Clock } from '@/components/home/Clock';5import { ComponentRows } from '@/components/home/ComponentRows';6import { Fronts } from '@/components/home/Fronts';7import { IncidentsList } from '@/components/home/IncidentsList';8import { ProbeStrip } from '@/components/home/ProbeStrip';9import { RegionsTable } from '@/components/home/RegionsTable';10import { Ticker } from '@/components/home/Ticker';11import { MapIsland } from '@/components/map/MapIsland';12import { Section } from '@/components/ui/primitives';13import { apiTry } from '@/lib/api';14import { TAGLINE } from '@/lib/site';15import type { Country, Front, GlobalPressure, History, IncidentList, Latency, Probe, Region, Ticker as TickerT } from '@/lib/types';1617export const dynamic = 'force-dynamic';1819export default async function HomePage() {20  const [global, ticker, regions, countries, fronts, incidents, probes, history, latency] = await Promise.all([21    apiTry<GlobalPressure>('/api/v1/pressure/global'),22    apiTry<TickerT>('/api/v1/ticker'),23    apiTry<{ regions: Region[] }>('/api/v1/pressure/regions'),24    apiTry<{ countries: Country[] }>('/api/v1/pressure/countries'),25    apiTry<{ fronts: Front[] }>('/api/v1/fronts'),26    apiTry<IncidentList>('/api/v1/incidents?status=active&limit=20'),27    apiTry<{ probes: Probe[] }>('/api/v1/probes'),28    apiTry<History>('/api/v1/pressure/history?scope_type=global&range=24h'),29    apiTry<Latency>('/api/v1/latency'),30  ]);3132  return (33    <div className="pb-8">34      {/* ---- above the fold */}35      <div className="grid-texture absolute inset-x-0 top-[var(--header-h)] -z-10 h-[520px]" aria-hidden="true" />36      <section className="grid grid-cols-[minmax(0,1fr)] gap-8 pt-6 lg:grid-cols-[minmax(0,7fr)_minmax(0,5fr)] lg:gap-12 lg:pt-8">37        <div className="min-w-0">38          <p className="mb-6 text-[12.5px] text-ink-2">39            <span className="text-ink">InternetPressure.io</span> — {TAGLINE}.40          </p>41          <Gauge initial={global} />42        </div>43        <div className="min-w-0 lg:pt-8">44          <p className="label mb-2">Components</p>45          <ComponentRows initial={global} />46          <p className="mt-2 text-[11px] text-ink-3">47            Score 0–100 per component, weighted into the index. Every row decomposes into signals in the{' '}48            <Link href="/methodology" className="text-accent hover:underline">49              methodology50            </Link>51            .52          </p>53        </div>54      </section>5556      <Section57        label="Live map"58        right={59          <>60            {countries?.countries.length ?? 0} countries observed · {probes?.probes.length ?? 0} probes · {fronts?.fronts.length ?? 0} fronts61          </>62        }63        className="mt-6"64      >65        <MapIsland initial={{ regions: regions?.regions ?? null, countries: countries?.countries ?? null, probes: probes?.probes ?? null, fronts: fronts?.fronts ?? null, incidents: incidents?.incidents ?? null, matrix: latency?.matrix ?? null }} />66      </Section>6768      <div className="grid grid-cols-[minmax(0,1fr)] gap-x-10 lg:grid-cols-2">69        <Section label="Active Pressure Fronts" right={<Link href="/methodology#fronts" className="hover:text-ink">what is a front?</Link>} className="min-w-0">70          <Fronts initial={fronts?.fronts ?? null} />71        </Section>72        <Section label="Active incidents" right={<Link href="/incidents" className="hover:text-ink">all incidents →</Link>} className="min-w-0">73          <IncidentsList initial={incidents?.incidents ?? null} />74        </Section>75      </div>7677      <Section label="Live ticker">78        <Ticker initial={ticker} />79      </Section>8081      <Section label="Global Internet Clock">82        <Clock initial={ticker} />83      </Section>8485      <Section label="Regions" right={<span>source view (from probes) blended with destination view (toward anchored targets)</span>}>86        <RegionsTable initial={regions?.regions ?? null} />87      </Section>8889      <Section label="24 h history" right={<Link href="/history" className="hover:text-ink">history explorer →</Link>}>90        <HistoryChart initial={history} scopeType="global" height={300} />91      </Section>9293      <Section label="Probe network" right={<Link href="/probes" className="hover:text-ink">all probes →</Link>}>94        <ProbeStrip probes={probes?.probes ?? null} />95      </Section>96    </div>97  );98}99