diff --git a/src/components/Dialog/DialogManager.tsx b/src/components/Dialog/DialogManager.tsx index 8576dff2..3417da8c 100644 --- a/src/components/Dialog/DialogManager.tsx +++ b/src/components/Dialog/DialogManager.tsx @@ -22,7 +22,6 @@ export const DialogManager = (): JSX.Element => { onOpenChange={(open) => { setDialogOpen("import", open); }} - channels={channels} loraConfig={config.lora} /> void; loraConfig?: Protobuf.Config_LoRaConfig; - channels: Protobuf.Channel[]; } export const ImportDialog = ({ diff --git a/src/components/Dialog/QRDialog.tsx b/src/components/Dialog/QRDialog.tsx index f26d2012..45843268 100644 --- a/src/components/Dialog/QRDialog.tsx +++ b/src/components/Dialog/QRDialog.tsx @@ -12,14 +12,14 @@ import { DialogTitle } from "@components/UI/Dialog.js"; import { ClipboardIcon } from "lucide-react"; -import { Protobuf } from "@meshtastic/meshtasticjs"; +import { Protobuf, Types } from "@meshtastic/meshtasticjs"; import { Label } from "@components/UI/Label.js"; export interface QRDialogProps { open: boolean; onOpenChange: (open: boolean) => void; loraConfig?: Protobuf.Config_LoRaConfig; - channels: Protobuf.Channel[]; + channels: Map; } export const QRDialog = ({ @@ -31,9 +31,12 @@ export const QRDialog = ({ const [selectedChannels, setSelectedChannels] = useState([0]); const [QRCodeURL, setQRCodeURL] = useState(""); + const filteredChannels = Array.from(channels.values()).filter((channel) => + selectedChannels.includes(channel.index) + ); + useEffect(() => { - const channelsToEncode = channels - .filter((channel) => selectedChannels.includes(channel.index)) + const channelsToEncode = filteredChannels .map((channel) => channel.settings) .filter((ch): ch is Protobuf.ChannelSettings => !!ch); const encoded = new Protobuf.ChannelSet( @@ -62,7 +65,7 @@ export const QRDialog = ({
- {channels.map((channel) => ( + {filteredChannels.map((channel) => (