import Printable from "@thorium/components/printable"; import { q } from "@thorium/context/AppContext"; import { useLocalStorage } from "@thorium/hooks/useLocalStorage"; import { useStation } from "@thorium/routes/station/useStation"; import { usePrompt } from "@thorium/ui/AlertDialog"; import Button from "@thorium/ui/Button"; import Checkbox from "@thorium/ui/Checkbox"; import { InputField, TypingField } from "@thorium/ui/Core"; import Select from "@thorium/ui/Select"; import { Tooltip } from "@thorium/ui/Tooltip"; import { cn } from "@thorium/utils/cn"; import { Fragment } from "react"; import { flushSync } from "react-dom"; import { CodeList } from "./CodeList"; export function CodeCyphersCore() { const { shipId } = useStation(); const [{ page }, setPage] = useLocalStorage<{ page: "codes" | "compose" }>( "codeCypher-selectedPage", { page: "codes" }, ); const [cyphers] = q.codeCyphers.availableCyphers.useNetRequest({ shipId, isCore: true, }); const prompt = usePrompt(); const [{ selectedCypher }, setSelectedCypher] = useLocalStorage<{ selectedCypher: string | null; }>("codeCypher-selectedCypher", { selectedCypher: null }); const [{ heading }, setHeading] = useLocalStorage("codeCypher-heading", { heading: "== Intercepted Message ==", }); const [{ message }, setMessage] = useLocalStorage("codeCypher-message", { message: "", }); return (
{page === "codes" ? (
{cyphers.map((c) => ( {c.name} the quick fox jumps over the lazy dog. } > {c.code} q.codeCyphers.setCypherAvailable.netSend({ shipId, cypherFont: c.font, active: event.currentTarget.checked, }) } /> ))}

=== Code Cypher ===

) : ( <> setHeading({ heading: value })} > {heading} setMessage({ message: event.currentTarget.value })} />