SPB Git forge
28commits 1branches 0releases
7.7 MBsize
maindefault branch
10 days agolast push
Python 66.3% TypeScript 22.7% JavaScript 8.6% HTML 1.4% CSS 0.7%
3.1 KB · 51 lines tsx
Raw Blame History
1import type { Metadata } from 'next';2import { RankingTabs, RankingsTable } from '@/components/rankings/rankings-table';3import { Container, Note, PageHeader, Unavailable } from '@/components/ui/section';4import { api, safe } from '@/lib/api';5import { str, type SP } from '@/lib/params';6import { RANKING_KINDS } from '@/lib/site';78export const metadata: Metadata = { title: 'Rankings', description: 'Most active companies, fastest hiring growth and decline, product velocity, AI activity, geographic expansion, developer momentum, pricing changes and unusual activity — by window and region.' };9export const revalidate = 120;1011export default async function RankingsPage({ searchParams }: { searchParams: Promise<SP> }) {12  const sp = await searchParams;13  const kind = RANKING_KINDS.some((k) => k.id === str(sp.kind)) ? (str(sp.kind) as string) : 'most_active';14  const window = ['24h', '7d', '30d', '90d', '1y'].includes(str(sp.window) ?? '') ? (str(sp.window) as string) : '30d';15  const country = str(sp.country);16  const industry = str(sp.industry);17  const [data, countries, industries] = await Promise.all([safe(api.rankings({ kind, window, country, industry, limit: 50 })), safe(api.countries()), safe(api.industries())]);18  const k = RANKING_KINDS.find((x) => x.id === kind)!;19  return (20    <Container wide>21      <PageHeader eyebrow="Rankings" title={k.label} lede="Rankings are computed from monitored public surfaces and normalised by coverage. Windows compare the same company against its own baseline; deltas show the move since the previous window." />22      <RankingTabs kind={kind} window={window} country={country} industry={industry} />23      <form method="get" action="/rankings" className="mt-3 flex flex-wrap gap-2">24        <input type="hidden" name="kind" value={kind} />25        <input type="hidden" name="window" value={window} />26        <select name="country" defaultValue={country ?? ''} className="field h-9 text-xs" aria-label="Country">27          <option value="">All countries</option>28          {(countries?.items ?? []).map((c) => (29            <option key={c.code} value={c.code}>30              {c.name}31            </option>32          ))}33        </select>34        <select name="industry" defaultValue={industry ?? ''} className="field h-9 text-xs" aria-label="Industry">35          <option value="">All industries</option>36          {(industries?.items ?? []).map((i) => (37            <option key={i.slug} value={i.slug}>38              {i.name}39            </option>40          ))}41        </select>42        <button type="submit" className="btn btn-sm">43          Apply44        </button>45      </form>46      <div className="mt-4">{data ? <RankingsTable data={data} /> : <Unavailable what="Rankings" />}</div>47      <Note className="mt-4">{k.unit === 'pct' ? 'Hiring momentum is the percentage change in publicly listed open roles; a decline in listings is not evidence of layoffs.' : k.unit === 'count' ? 'Counts structured pricing events detected on public pricing pages in the window.' : 'Scores are 0–100 relative to the monitored population; see methodology for formula versions.'}</Note>48    </Container>49  );50}51