import type { EnergyContext } from "@dci/core";
import { ExternalLink } from "lucide-react";
import { ApiNote } from "@/components/intelligence/shared";
import { fmtInt, fmtPct } from "@/lib/format";
function Cell({ label, value, note }: { label: string; value: string; note?: string }) {
return (
{value}
{label}
{note &&
{note}
}
);
}
/**
* POWER / ENERGY CONTEXT for a country — national grid indicators as published (World Bank), the year they
* describe, and the API note reminding that a national mix is not a facility's contracted electricity.
* `gridCarbonIntensity` reads "not available" when the API has no reliable public source.
*/
export function EnergyContextPanel({ e, knownMw }: { e: EnergyContext; knownMw: number | null }) {
const year = e.statsYear ? String(e.statsYear) : null;
const load = knownMw && e.electricityTwh ? (knownMw * 8.76) / 1000 / e.electricityTwh : null;
return (
|
|
|
|
Source: {e.sourceName ?? "not recorded"}
{e.sourceUrl && (
<>
{" "}
dataset
>
)}
{year && <> · statistics year {year}>} · World Bank indicators are CC BY 4.0.
);
}