import { Bars, StackedBars } from '@/components/charts/charts'; import { fmtInt, num } from '@/lib/format'; import type { LaunchTimeline } from '@/lib/types'; const REGION_LABELS = { us: 'United States', russia_cis: 'Russia / Kazakhstan', china: 'China', other: 'Other / unknown site' }; /** Launches per year by launch-site region + monthly cadence for the last 36 months. Server-rendered SVG. */ export function LaunchTimelineCharts({ timeline }: { timeline: LaunchTimeline }) { const years = timeline.years.map((y) => ({ x: String(y.year), us: num(y.us) ?? 0, russia_cis: num(y.russia_cis) ?? 0, china: num(y.china) ?? 0, other: num(y.other) ?? 0 })); const months = timeline.months.map((m) => ({ x: m.month.slice(0, 7), y: num(m.launches) ?? 0 })); const lastYear = timeline.years[timeline.years.length - 1]; const totalLaunches = timeline.years.reduce((s, y) => s + (num(y.launches) ?? 0), 0); const totalPayloads = timeline.years.reduce((s, y) => s + (num(y.payloads) ?? 0), 0); return (
Launches per year by launch-site region
{fmtInt(totalLaunches)} launches · {fmtInt(totalPayloads)} payloads since {timeline.years[0]?.year ?? '—'}
Monthly cadence · last 36 months
{lastYear &&{fmtInt(lastYear.launches)} launches in {lastYear.year}
}The last bar is the current month (partial).