"use client"; import type { Dashboard } from "@dci/core"; import { AreaChart, ColumnChart } from "@/components/ui/charts"; import { EmptyState } from "@/components/ui/states"; import { fmtCompact, fmtMw } from "@/lib/format"; export function CapacityOverTime({ data }: { data: Dashboard["capacityOverTime"] }) { const pts = data.filter((d) => d.cumulativeMw !== null || d.knownMw !== null); if (pts.length < 2) return ; return ( ({ x: d.year, y: d.cumulativeMw })), color: "var(--ink)" }, ]} height={200} format={(v) => fmtMw(v)} ariaLabel="Cumulative known operational capacity by opening year" /> ); } export function PipelineByYear({ data }: { data: Dashboard["pipelineByYear"] }) { if (!data.length) return ; const hasMw = data.some((d) => d.mw !== null && d.mw > 0); return ( ({ label: d.year, value: hasMw ? d.mw : d.count }))} height={150} format={hasMw ? (v) => fmtMw(v) : (v) => fmtCompact(v, 0)} ariaLabel={hasMw ? "Pipeline MW by expected opening year" : "Pipeline projects by expected opening year"} /> ); }