import Link from 'next/link'; import { fmtDate, fmtInt, num } from '@/lib/format'; import { routes } from '@/lib/site'; import type { LaunchRow } from '@/lib/types'; /** Launch rows (list page, site detail, launch detail siblings). `ownerHref` lets the caller scope owner chips to its context. */ export function LaunchesTable({ rows, ownerHref = (code) => routes.launches(`owner=${encodeURIComponent(code)}`), showSite = true }: { rows: LaunchRow[]; ownerHref?: (code: string) => string; showSite?: boolean }) { return (
{showSite && } {rows.map((l) => { const owners = l.owner_codes ?? []; const onOrbit = num(l.on_orbit_count); const objects = num(l.object_count); return ( {showSite && } ); })}
Date COSPAR Primary payload Payloads Objects On orbitSiteOwners
{fmtDate(l.launch_date)} {l.cospar_launch_id} {l.primary_name ?? unnamed} {fmtInt(l.payload_count)} {fmtInt(l.object_count)} {fmtInt(l.on_orbit_count)}{l.site_slug ? {l.site_name} : l.site_name ?? '—'} {owners.length ? ( {owners.slice(0, 4).map((c) => ( {c} ))} {owners.length > 4 && +{owners.length - 4}} ) : ( '—' )}
); }