Use rome and initial format

This commit is contained in:
Sacha Weatherstone
2023-07-09 13:59:31 +10:00
parent a65bc37be5
commit 20ac657b51
90 changed files with 3350 additions and 3092 deletions
+6 -6
View File
@@ -5,7 +5,7 @@ import {
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle
DialogTitle,
} from "@components/UI/Dialog.js";
import { Button } from "@components/UI/Button.js";
import { useDevice } from "@app/core/stores/deviceStore.js";
@@ -25,7 +25,7 @@ export interface DeviceNameDialogProps {
export const DeviceNameDialog = ({
open,
onOpenChange
onOpenChange,
}: DeviceNameDialogProps): JSX.Element => {
const { hardware, nodes, connection } = useDevice();
@@ -34,16 +34,16 @@ export const DeviceNameDialog = ({
const { register, handleSubmit } = useForm<User>({
values: {
longName: myNode?.user?.longName ?? "Unknown",
shortName: myNode?.user?.shortName ?? "Unknown"
}
shortName: myNode?.user?.shortName ?? "Unknown",
},
});
const onSubmit = handleSubmit((data) => {
connection?.setOwner(
new Protobuf.User({
...myNode?.user,
...data
})
...data,
}),
);
onOpenChange(false);
});
+7 -7
View File
@@ -8,7 +8,7 @@ import {
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle
DialogTitle,
} from "@components/UI/Dialog.js";
import { Protobuf } from "@meshtastic/meshtasticjs";
import { Switch } from "@components/UI/Switch.js";
@@ -24,7 +24,7 @@ export interface ImportDialogProps {
export const ImportDialog = ({
open,
onOpenChange
onOpenChange,
}: ImportDialogProps): JSX.Element => {
const [QRCodeURL, setQRCodeURL] = useState<string>("");
const [channelSet, setChannelSet] = useState<Protobuf.ChannelSet>();
@@ -55,8 +55,8 @@ export const ImportDialog = ({
index === 0
? Protobuf.Channel_Role.PRIMARY
: Protobuf.Channel_Role.SECONDARY,
settings: ch
})
settings: ch,
}),
);
});
@@ -65,9 +65,9 @@ export const ImportDialog = ({
new Protobuf.Config({
payloadVariant: {
case: "lora",
value: channelSet.loraConfig
}
})
value: channelSet.loraConfig,
},
}),
);
}
};
+7 -7
View File
@@ -3,13 +3,13 @@ import {
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle
DialogTitle,
} from "@components/UI/Dialog.js";
import {
Tabs,
TabsContent,
TabsList,
TabsTrigger
TabsTrigger,
} from "@components/UI/Tabs.js";
import { Subtle } from "@components/UI/Typography/Subtle.js";
import { Link } from "@components/UI/Typography/Link.js";
@@ -22,7 +22,7 @@ const tabs = [
label: "HTTP",
element: HTTP,
disabled: false,
disabledMessage: "Unsuported connection method"
disabledMessage: "Unsuported connection method",
},
{
label: "Bluetooth",
@@ -31,15 +31,15 @@ const tabs = [
disabledMessage:
"Web Bluetooth is currently only supported by Chromium-based browsers",
disabledLink:
"https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API#browser_compatibility"
"https://developer.mozilla.org/en-US/docs/Web/API/Web_Serial_API#browser_compatibility",
},
{
label: "Serial",
element: Serial,
disabled: !navigator.serial,
disabledMessage:
"WebSerial is currently only supported by Chromium based browsers: https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API#browser_compatibility"
}
"WebSerial is currently only supported by Chromium based browsers: https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API#browser_compatibility",
},
];
export interface NewDeviceProps {
open: boolean;
@@ -48,7 +48,7 @@ export interface NewDeviceProps {
export const NewDeviceDialog = ({
open,
onOpenChange
onOpenChange,
}: NewDeviceProps): JSX.Element => {
return (
<Dialog open={open} onOpenChange={onOpenChange}>
+7 -7
View File
@@ -9,7 +9,7 @@ import {
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle
DialogTitle,
} from "@components/UI/Dialog.js";
import { ClipboardIcon } from "lucide-react";
import { Protobuf, Types } from "@meshtastic/meshtasticjs";
@@ -26,7 +26,7 @@ export const QRDialog = ({
open,
onOpenChange,
loraConfig,
channels
channels,
}: QRDialogProps): JSX.Element => {
const [selectedChannels, setSelectedChannels] = useState<number[]>([0]);
const [QRCodeURL, setQRCodeURL] = useState<string>("");
@@ -41,8 +41,8 @@ export const QRDialog = ({
const encoded = new Protobuf.ChannelSet(
new Protobuf.ChannelSet({
loraConfig,
settings: channelsToEncode
})
settings: channelsToEncode,
}),
);
const base64 = fromByteArray(encoded.toBinary())
.replace(/=/g, "")
@@ -79,12 +79,12 @@ export const QRDialog = ({
onCheckedChange={() => {
if (selectedChannels.includes(channel.index)) {
setSelectedChannels(
selectedChannels.filter((c) => c !== channel.index)
selectedChannels.filter((c) => c !== channel.index),
);
} else {
setSelectedChannels([
...selectedChannels,
channel.index
channel.index,
]);
}
}}
@@ -104,7 +104,7 @@ export const QRDialog = ({
icon: ClipboardIcon,
onClick() {
void navigator.clipboard.writeText(QRCodeURL);
}
},
}}
/>
</DialogFooter>
+3 -3
View File
@@ -6,7 +6,7 @@ import {
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle
DialogTitle,
} from "@components/UI/Dialog.js";
import { ClockIcon, RefreshCwIcon } from "lucide-react";
import { Button } from "@components/UI/Button.js";
@@ -19,7 +19,7 @@ export interface RebootDialogProps {
export const RebootDialog = ({
open,
onOpenChange
onOpenChange,
}: RebootDialogProps): JSX.Element => {
const { connection } = useDevice();
@@ -43,7 +43,7 @@ export const RebootDialog = ({
icon: ClockIcon,
onClick() {
connection?.reboot(time * 60).then(() => onOpenChange(false));
}
},
}}
/>
<Button
+2 -2
View File
@@ -5,7 +5,7 @@ import {
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle
DialogTitle,
} from "@components/UI/Dialog.js";
import { ClockIcon, PowerIcon } from "lucide-react";
import { Button } from "@components/UI/Button.js";
@@ -18,7 +18,7 @@ export interface ShutdownDialogProps {
export const ShutdownDialog = ({
open,
onOpenChange
onOpenChange,
}: ShutdownDialogProps): JSX.Element => {
const { connection } = useDevice();