import type { PowerOverview } from "@dci/core"; import { ExternalLink } from "lucide-react"; import type { Metadata } from "next"; import Link from "next/link"; import { Breadcrumbs } from "@/components/entity/breadcrumbs"; import { SectionNav } from "@/components/entity/section-nav"; import { SourcesFooter } from "@/components/entity/sources-footer"; import { EventList } from "@/components/event-list"; import { CountryEnergyTable } from "@/components/intelligence/power/country-energy-table"; import { ApiNote, GRID_KIND_LABEL, GridConstraintList, GridKindBadge, HonestEmpty, PillLink } from "@/components/intelligence/shared"; import { Badge } from "@/components/ui/badge"; import { Page, PageHeader, Section } from "@/components/ui/card"; import { cn } from "@/components/ui/cn"; import { CountryFlag } from "@/components/ui/country-flag"; import { Metric, MetricCell, MetricRow } from "@/components/ui/metric"; import { ErrorState, OfflineNotice } from "@/components/ui/states"; import { RowLink, TBody, THead, Table, Td, Th, Tr } from "@/components/ui/table"; import { api } from "@/lib/api"; import { fmtInt, fmtMw } from "@/lib/format"; import { OPERATOR_KIND_LABEL } from "@/lib/labels"; import { routes } from "@/lib/routes"; import { pageMetadata } from "@/lib/seo"; import { hrefWith, spGet, type SearchParams } from "@/lib/sort"; export const revalidate = 120; export const metadata: Metadata = pageMetadata({ title: "Power & grid", description: "Grid constraints (moratoria, grid delays, load caps, new transmission), power agreements, the largest published utility and grid-connection loads, and national electricity context — observed facts, no inference.", path: routes.power(), }); /** The eight constraint kinds of the spec, always listed (0 → “none recorded”). */ const SPEC_KINDS = ["moratorium", "grid_delay", "capacity_restriction", "load_cap", "new_transmission", "new_substation", "regulation", "large_load_queue"] as const; const LOAD_KIND_LABEL: Record = { utility_capacity: "Utility capacity", grid_connection: "Grid connection", planned_load: "Planned load" }; export default async function PowerPage({ searchParams }: { searchParams: Promise }) { const sp = await searchParams; const r = await api.power(); if (!r.ok) { return ( ); } const d = r.data; const kindCounts = new Map(); for (const g of d.gridConstraints) kindCounts.set(g.kind, (kindCounts.get(g.kind) ?? 0) + 1); const kinds = Array.from(kindCounts.keys()).sort(); const kindFilter = spGet(sp, "kind"); const activeKind = kindFilter && kindCounts.has(kindFilter) ? kindFilter : null; const constraints = activeKind ? d.gridConstraints.filter((g) => g.kind === activeKind) : d.gridConstraints; const specWithCounts = SPEC_KINDS.map((k) => ({ kind: k, count: kindCounts.get(k) ?? 0 })); const extraKinds = kinds.filter((k) => !(SPEC_KINDS as readonly string[]).includes(k)); const sections = [ { id: "constraints", label: "Grid constraints", count: d.gridConstraints.length }, { id: "events", label: "Power events", count: d.powerEvents.length }, { id: "loads", label: "Large loads", count: d.largeLoads.length }, { id: "energy", label: "Country energy", count: d.countryEnergy.length }, { id: "utilities", label: "Utilities", count: d.utilities.length }, ]; return ( Power layer on the map →} />
Observed fact

Everything on this page is observed: published utility-capacity and grid-connection MW on facilities and projects, curated public constraint reports (moratoria, grid delays, load caps, new transmission) and detected grid, utility and power-agreement events — each with a link to the page it was read from.

Analytical inference

None. We do not infer available capacity, constraint severity, queue position or supply adequacy from these facts, and a national grid average is never applied to a facility. Absence of a constraint here means none was published — not that the grid is unconstrained.

{specWithCounts.map(({ kind, count }) => ( ))} {extraKinds.map((kind) => ( ))} {activeKind && ( Reset )}
Live feed →}>
{d.largeLoads.length === 0 ? ( ) : ( {d.largeLoads.map((l, i) => { const site = l.facility ?? l.project; const href = l.facility ? routes.facility(l.facility.slug) : l.project ? routes.project(l.project.slug) : null; return ( ); })}
Site Kind MW Country Market Source
{href && site ? {site.name} : unlinked site}
{l.facility ? "facility" : l.project ? "project" : ""}
{LOAD_KIND_LABEL[l.kind]} {l.kind === "planned_load" && ≈} {fmtMw(l.mw)} {l.metro ? ( {l.metro.name} ) : ( "—" )} {l.url ? ( {l.sourceName ?? "source"} ) : ( {l.sourceName ?? "—"} )}
)}
{d.utilities.length === 0 ? ( ) : (
    {d.utilities.map((u) => (
  • {u.name} {u.kind && {OPERATOR_KIND_LABEL[u.kind as keyof typeof OPERATOR_KIND_LABEL] ?? u.kind}} {fmtInt(u.facilityCount)}
  • ))}
)}
); } function KindChip({ kind, count, active, sp }: { kind: string; count: number; active: boolean; sp: SearchParams }) { const label = GRID_KIND_LABEL[kind] ?? kind.replace(/_/g, " "); const inner = ( <> {count ? fmtInt(count) : "none recorded"} ); const cls = cn("inline-flex h-10 items-center gap-1.5 rounded-sm border px-2 text-[12px] sm:h-8", active ? "border-ink bg-surface-2" : "border-hair bg-surface", count ? "hover:border-hair-2" : "cursor-default"); if (!count) return {inner}; return ( {inner} ); }