import { content } from "@deadhead/content"; import { realToGame } from "@deadhead/sim"; import { useClock } from "../clock/clock"; import { formatGameTime } from "../clock/GameClock"; import { Countdown } from "../components/Countdown"; import { GoalsCard } from "../components/GoalsCard"; import { LoanCard } from "../components/LoanCard"; import { formatCredits, locationName } from "../format"; import { useLoadedPlayer } from "../state/actions"; export function HQ() { const state = useLoadedPlayer(); const now = useClock((s) => s.now); const idle = state.ships.filter((s) => s.status === "idle").length; const flying = state.ships.filter((s) => s.status === "in-flight").length; const runsBeforeDeal = content.config.tutorialRunsBeforeDeal; const next = [...state.activeDispatches].sort((a, b) => a.arrivalAt - b.arrivalAt)[0]; return (

HQ

Next arrival

{next ? (

{locationName(next.originId)} → {locationName(next.destinationId)} in{" "}

) : (

Nothing in flight.

)}
{!state.tutorial && state.ships.length === 0 && (

No ships yet — buy one in the Market.

)} {state.tutorial && (

Flying for Halvorsen Lunar Freight

Company runs: {Math.min(state.tutorial.runsCompleted, runsBeforeDeal)} of{" "} {runsBeforeDeal}

Keep flying — the old man has an offer for you.

)} {!state.tutorial && } {!state.tutorial && state.company.loanBalance > 0 && }
); } function Stat({ label, value }: { label: string; value: string }) { return (
{label}
{value}
); }