SPB Git forge
3commits 1branches 0releases
417.0 KBsize
maindefault branch
10 days agolast push
TypeScript 66.5% Python 30.9% JavaScript 1.4% CSS 0.7%
2.5 KB · 50 lines tsx
Raw Blame History
1import Link from 'next/link';2import { OrbitBadge, StatusBadge, TypeBadge } from '@/components/ui/badges';3import { fmtDate, fmtDeg, fmtInt } from '@/lib/format';4import { routes } from '@/lib/site';5import type { SatelliteRow } from '@/lib/types';67export function ResultsTable({ rows }: { rows: SatelliteRow[] }) {8  return (9    <div className="overflow-x-auto scrollbar-thin">10      <table className="data-table stack">11        <thead>12          <tr>13            <th>Name</th>14            <th>NORAD</th>15            <th>COSPAR</th>16            <th>Type</th>17            <th>Status</th>18            <th>Orbit</th>19            <th className="num">Perigee / apogee</th>20            <th className="num">Incl.</th>21            <th>Launched</th>22            <th>Operator</th>23            <th>Country</th>24          </tr>25        </thead>26        <tbody>27          {rows.map((s) => (28            <tr key={s.id}>29              <td data-label="Name" className="primary">30                <Link href={routes.satellite(s.slug)} prefetch={false} className="link font-medium">{s.name}</Link>31                {s.constellation_name && <span className="ml-2 text-2xs text-ink-3">{s.constellation_name}</span>}32              </td>33              <td data-label="NORAD" className="mono text-xs text-ink-2">{s.norad_id ?? '—'}</td>34              <td data-label="COSPAR" className="mono text-xs text-ink-2">{s.cospar_id ?? '—'}</td>35              <td data-label="Type"><TypeBadge type={s.object_type} /></td>36              <td data-label="Status"><StatusBadge status={s.status} /></td>37              <td data-label="Orbit"><OrbitBadge orbitClass={s.orbit_class} /></td>38              <td data-label="Perigee / apogee" className="num mono text-xs">{s.perigee_km !== null ? `${fmtInt(s.perigee_km)} / ${fmtInt(s.apogee_km)} km` : '—'}</td>39              <td data-label="Inclination" className="num mono text-xs">{fmtDeg(s.inclination_deg)}</td>40              <td data-label="Launched" className="mono text-xs">{fmtDate(s.launch_date)}{s.decay_date && <span className="block text-ink-3">↓ {fmtDate(s.decay_date)}</span>}</td>41              <td data-label="Operator" className="text-xs">{s.operator_slug ? <Link className="link" href={routes.operator(s.operator_slug)}>{s.operator_name}</Link> : s.owner_name ?? s.owner_code ?? '—'}</td>42              <td data-label="Country" className="text-xs">{s.country_slug ? <Link className="link" href={routes.country(s.country_slug)}>{s.country_name}</Link> : '—'}</td>43            </tr>44          ))}45        </tbody>46      </table>47    </div>48  );49}50