update deps & lint

This commit is contained in:
Sacha Weatherstone
2024-01-06 10:15:49 +10:00
parent 079bbed620
commit 7fb2da396f
37 changed files with 261 additions and 267 deletions
+12 -12
View File
@@ -26,14 +26,14 @@ export const ImportDialog = ({
open,
onOpenChange,
}: ImportDialogProps): JSX.Element => {
const [QRCodeURL, setQRCodeURL] = useState<string>("");
const [qrCodeUrl, setQrCodeUrl] = useState<string>("");
const [channelSet, setChannelSet] = useState<Protobuf.AppOnly.ChannelSet>();
const [validURL, setValidURL] = useState<boolean>(false);
const [validUrl, setValidUrl] = useState<boolean>(false);
const { connection } = useDevice();
useEffect(() => {
const base64String = QRCodeURL.split("e/#")[1];
const base64String = qrCodeUrl.split("e/#")[1];
const paddedString = base64String
?.padEnd(base64String.length + ((4 - (base64String.length % 4)) % 4), "=")
.replace(/-/g, "+")
@@ -42,12 +42,12 @@ export const ImportDialog = ({
setChannelSet(
Protobuf.AppOnly.ChannelSet.fromBinary(toByteArray(paddedString)),
);
setValidURL(true);
setValidUrl(true);
} catch (error) {
setValidURL(false);
setValidUrl(false);
setChannelSet(undefined);
}
}, [QRCodeURL]);
}, [qrCodeUrl]);
const apply = () => {
channelSet?.settings.map((ch, index) => {
@@ -87,19 +87,19 @@ export const ImportDialog = ({
<div className="flex flex-col gap-3">
<Label>Channel Set/QR Code URL</Label>
<Input
value={QRCodeURL}
suffix={validURL ? "✅" : "❌"}
value={qrCodeUrl}
suffix={validUrl ? "✅" : "❌"}
onChange={(e) => {
setQRCodeURL(e.target.value);
setQrCodeUrl(e.target.value);
}}
/>
{validURL && (
{validUrl && (
<div className="flex flex-col gap-3">
<div className="flex w-full gap-2">
<div className="w-36">
<Label>Use Preset?</Label>
<Switch
disabled
disabled={true}
checked={channelSet?.loraConfig?.usePreset ?? true}
/>
</div>
@@ -138,7 +138,7 @@ export const ImportDialog = ({
)}
</div>
<DialogFooter>
<Button onClick={apply} disabled={!validURL}>
<Button onClick={apply} disabled={!validUrl}>
Apply
</Button>
</DialogFooter>
@@ -4,7 +4,6 @@ import { Serial } from "@components/PageComponents/Connect/Serial.js";
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from "@components/UI/Dialog.js";
+6 -6
View File
@@ -29,7 +29,7 @@ export const QRDialog = ({
channels,
}: QRDialogProps): JSX.Element => {
const [selectedChannels, setSelectedChannels] = useState<number[]>([0]);
const [QRCodeURL, setQRCodeURL] = useState<string>("");
const [qrCodeUrl, setQrCodeUrl] = useState<string>("");
const allChannels = Array.from(channels.values());
@@ -49,7 +49,7 @@ export const QRDialog = ({
.replace(/\+/g, "-")
.replace(/\//g, "_");
setQRCodeURL(`https://meshtastic.org/e/#${base64}`);
setQrCodeUrl(`https://meshtastic.org/e/#${base64}`);
}, [channels, selectedChannels, loraConfig]);
return (
@@ -92,18 +92,18 @@ export const QRDialog = ({
</div>
))}
</div>
<QRCode value={QRCodeURL} size={200} qrStyle="dots" />
<QRCode value={qrCodeUrl} size={200} qrStyle="dots" />
</div>
</div>
<DialogFooter>
<Label>Sharable URL</Label>
<Input
value={QRCodeURL}
disabled
value={qrCodeUrl}
disabled={true}
action={{
icon: ClipboardIcon,
onClick() {
void navigator.clipboard.writeText(QRCodeURL);
void navigator.clipboard.writeText(qrCodeUrl);
},
}}
/>
-1
View File
@@ -3,7 +3,6 @@ import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
} from "@components/UI/Dialog.js";