Fix QR Code
This commit is contained in:
@@ -2,7 +2,7 @@ import type React from "react";
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
import { fromByteArray } from "base64-js";
|
import { fromByteArray } from "base64-js";
|
||||||
import toast from "react-hot-toast";
|
import { toast } from "react-hot-toast";
|
||||||
import { QRCode } from "react-qrcode-logo";
|
import { QRCode } from "react-qrcode-logo";
|
||||||
|
|
||||||
import { Dialog } from "@headlessui/react";
|
import { Dialog } from "@headlessui/react";
|
||||||
@@ -26,7 +26,7 @@ export const QRDialog = ({
|
|||||||
loraConfig,
|
loraConfig,
|
||||||
channels,
|
channels,
|
||||||
}: QRDialogProps): JSX.Element => {
|
}: QRDialogProps): JSX.Element => {
|
||||||
const [selectedChannels, setSelectedChannels] = useState<number[]>([]);
|
const [selectedChannels, setSelectedChannels] = useState<number[]>([0]);
|
||||||
const [QRCodeURL, setQRCodeURL] = useState<string>("");
|
const [QRCodeURL, setQRCodeURL] = useState<string>("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -45,7 +45,7 @@ export const QRDialog = ({
|
|||||||
.replace(/\+/g, "-")
|
.replace(/\+/g, "-")
|
||||||
.replace(/\//g, "_");
|
.replace(/\//g, "_");
|
||||||
|
|
||||||
setQRCodeURL(`https://www.meshtastic.org/e/#${base64}`);
|
setQRCodeURL(`https://meshtastic.org/e/#${base64}`);
|
||||||
}, [channels, selectedChannels, loraConfig]);
|
}, [channels, selectedChannels, loraConfig]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -85,10 +85,7 @@ export const QRDialog = ({
|
|||||||
? "Primary"
|
? "Primary"
|
||||||
: `Channel: ${channel.index}`
|
: `Channel: ${channel.index}`
|
||||||
}
|
}
|
||||||
checked={
|
checked={selectedChannels.includes(channel.index)}
|
||||||
channel.index === 0 ||
|
|
||||||
selectedChannels.includes(channel.index)
|
|
||||||
}
|
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
if (selectedChannels.includes(channel.index)) {
|
if (selectedChannels.includes(channel.index)) {
|
||||||
setSelectedChannels(
|
setSelectedChannels(
|
||||||
|
|||||||
Reference in New Issue
Block a user