import { keepPreviousData } from "@tanstack/react-query"; import { lrmStateMap } from "@thorium/cards/LongRangeComm/shared"; import { q } from "@thorium/context/AppContext"; import { SelectStarmapEntityEvent } from "@thorium/cores/StarmapCore"; import { pickStarmapShip } from "@thorium/cores/StarmapCore/pickShip"; import { useStation } from "@thorium/routes/station/useStation"; import Button from "@thorium/ui/Button"; import { InputField, OutputField, TypingField } from "@thorium/ui/Core"; import InfoTip from "@thorium/ui/InfoTip"; import Select from "@thorium/ui/Select"; import { cn } from "@thorium/utils/cn"; import { Suspense, startTransition, useState } from "react"; export function LongRangeCommMessagesCore() { const { shipId } = useStation(); const [outgoingMessages] = q.longRangeComm.outgoingMessages.useNetRequest({ shipId, filter: "all", }); const [selectedMessageId, setSelectedMessageId] = useState(null); const selectedMessage = outgoingMessages.find((o) => o.id === selectedMessageId); return (
{selectedMessage && ( <>
Sender:{" "} {selectedMessage.senderStation}
State: {lrmStateMap[selectedMessage.state]}
Destination: {selectedMessage.destinationShipName}
Message:
{selectedMessage.message} )}
); } export function LongRangeCommComposerCore() { const { shipId } = useStation(); const [senderId, setSenderId] = useState(); const [senderStation, setSenderStation] = useState(""); const [addressBookName, setAddressBookName] = useState(""); const [destinationId, setDestinationId] = useState(); const [message, setMessage] = useState(""); const [encoding, setEncoding] = useState<"decoded" | "waves" | "replacement" | "rotation">( "decoded", ); return (
{senderId === shipId && ( <>

Sender Station

setSenderStation(val)} prompt="Which station or person on the ship is sending the message out?" > {senderStation} )} setMessage(e.currentTarget.value)} />
{" "}