import { sortBy } from 'common/collections'; import { useBackend } from '../backend'; import { Button, Section, Table } from '../components'; import { Window } from '../layouts'; type Data = { shuttles: Shuttle[]; overmap_ships: OvermapShip[]; }; type Shuttle = { ref: string; name: string; current_location; status; }; type OvermapShip = { ref: string; name: string; }; export const AdminShuttleController = () => { return ( ); }; export const ShuttleList = (props, context) => { const { act, data } = useBackend(context); const { shuttles, overmap_ships } = data; return (
{sortBy((f: Shuttle) => f.name)(shuttles).map((shuttle) => (
{sortBy((f: OvermapShip) => f.name?.toLowerCase() || f.name || f.ref)( overmap_ships ).map((ship) => (
); }; /* Helpers */ const shuttleStatusToWords = (status) => { switch (status) { case 0: return 'Idle'; case 1: return 'Warmup'; case 2: return 'Transit'; default: return 'UNK'; } };