import { ArrowRight, Building2, Globe2, MapPin, Orbit, Rocket, Satellite } from 'lucide-react'; import Link from 'next/link'; import { fmtInt } from '@/lib/format'; import type { SearchPayload, SearchResult } from '@/lib/types'; type EntityType = SearchResult['entity_type']; const GROUPS: { type: EntityType; label: string; Icon: typeof Satellite }[] = [ { type: 'satellite', label: 'Satellites', Icon: Satellite }, { type: 'constellation', label: 'Constellations', Icon: Orbit }, { type: 'operator', label: 'Operators', Icon: Building2 }, { type: 'country', label: 'Countries', Icon: Globe2 }, { type: 'launch', label: 'Launches', Icon: Rocket }, { type: 'launch_site', label: 'Launch sites', Icon: MapPin }, ]; export function Shortcuts({ items }: { items: SearchPayload['shortcuts'] }) { if (!items.length) return null; return (

Filters matching your query

); } /** Results grouped by entity type in a fixed order; every row links to `result.href` from the API. */ export function GroupedResults({ results }: { results: SearchResult[] }) { const byType = new Map(); for (const r of results) byType.set(r.entity_type, [...(byType.get(r.entity_type) ?? []), r]); const groups = GROUPS.filter((g) => byType.has(g.type)); return (
{groups.map(({ type, label, Icon }) => { const rows = byType.get(type) ?? []; return (

{label}

{fmtInt(rows.length)}
    {rows.map((r) => (
  • {r.title} {r.subtitle && {r.subtitle}}
  • ))}
); })}
); } export const EXAMPLE_QUERIES = ['ISS', 'Starlink', '25544', '1998-067A', 'SpaceX', 'Canada', 'GPS', 'Falcon 9'];