import { useEffect, useState } from "preact/hooks"; import type { HostingMode } from "../types.ts"; import { CFG } from "../app/config.ts"; import { changeHosting, isRemote, moveToLocal, resumeRemote } from "../app/hosting.ts"; import { store, ui, view } from "../app/store.ts"; export function HostingSettings() { const current = store.state.hosting.mode; const [mode, setMode] = useState(current); const [endpoint, setEndpoint] = useState(ui.remoteEndpoint || CFG.remoteEndpoint || ""); useEffect(() => setMode(current), [current]); useEffect(() => { if (ui.remoteEndpoint) setEndpoint(ui.remoteEndpoint); }, [ui.remoteEndpoint]); const busy = ui.hostingBusy || !!view.game; return (

Where your pet lives

Choose local or remote

{ui.hostingBusy ? "Moving your pet safely…" : ui.remoteError || (isRemote() ? "Your server is running the pet. This browser keeps a recovery copy." : "Your pet lives in this browser.")}

Switching preserves the same pet, including its memories, gifts, chat and diary. Moving local may need the {Math.round(CFG.size / 1e6)} MB brain download.

); }