mirror of
https://github.com/meshtastic/web.git
synced 2026-08-01 23:47:23 -04:00
Mirrors Meshtastic-Android's `regionUnset` flow. A freshly-flashed device boots with `Config.LoRa.region == UNSET` and won't transmit at all until the user picks one. Web now surfaces this: - `ConfigClient.isRegionUnset: ReadonlySignal<boolean>` — computed from the radio config signal, false until the first LoRa packet arrives so consumers don't flash the prompt during the connect handshake. - `useIsRegionUnset()` hook in sdk-react, re-exported from the package's public surface. - `RegionSetupReminder` mounts inside the connected-device branch of App.tsx. While the SDK reports `isRegionUnset == true`, a persistent toast offers a "Set region" CTA that deep-links into the LoRa tab (`/settings/radio`). Toast auto-dismisses the moment a real region is committed. Predicate matches Android exactly (single check, no owner/name/setupComplete heuristics). Lives in the SDK config slice — UI is a thin consumer. 3 new SDK tests; SDK 64 / sdk-react 8 / web 236.
@meshtastic/sdk-react
React hooks and provider for @meshtastic/sdk.
Install
pnpm add @meshtastic/sdk @meshtastic/sdk-react @meshtastic/transport-web-serial
Quickstart
import { MeshClient } from "@meshtastic/sdk";
import { MeshProvider, useDevice, useChat } from "@meshtastic/sdk-react";
import { TransportWebSerial } from "@meshtastic/transport-web-serial";
import { ChannelNumber } from "@meshtastic/sdk";
const transport = await TransportWebSerial.create({ baudRate: 115200 });
const client = new MeshClient({ transport });
await client.connect();
function App() {
return (
<MeshProvider client={client}>
<Status />
</MeshProvider>
);
}
function Status() {
const { status, myNodeNum } = useDevice();
const { messages, send } = useChat(ChannelNumber.Primary);
return <div>{status} / {myNodeNum} / {messages.length} msgs</div>;
}
All hooks are read-only against a single MeshClient instance supplied through context. Commands are returned as stable functions.
License
GPL-3.0-only.