From 50eb2a827f08c076a521a8b718f14118fa9eea46 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Sun, 2 Mar 2025 14:46:02 -0500 Subject: [PATCH] chore: fixes from deno linting/formatting --- deno.json | 36 +++ package.json | 14 +- src/App.tsx | 37 +-- src/components/CommandPalette.tsx | 14 +- src/components/DeviceSelector.tsx | 21 +- src/components/DeviceSelectorButton.tsx | 7 +- src/components/Dialog/DialogManager.tsx | 8 +- src/components/Dialog/ImportDialog.tsx | 27 +- .../Dialog/LocationResponseDialog.tsx | 13 +- src/components/Dialog/NewDeviceDialog.tsx | 30 +- src/components/Dialog/NodeDetailsDialog.tsx | 287 ++++++++++-------- src/components/Dialog/NodeOptionsDialog.tsx | 24 +- src/components/Dialog/PKIBackupDialog.tsx | 10 +- src/components/Dialog/PkiRegenerateDialog.tsx | 2 +- src/components/Dialog/QRDialog.tsx | 12 +- src/components/Dialog/RebootDialog.tsx | 2 +- src/components/Dialog/RemoveNodeDialog.tsx | 4 +- src/components/Dialog/ShutdownDialog.tsx | 2 +- .../Dialog/TracerouteResponseDialog.tsx | 16 +- src/components/Form/DynamicForm.tsx | 17 +- src/components/Form/DynamicFormField.tsx | 14 +- src/components/Form/FormInput.tsx | 20 +- src/components/Form/FormMultiSelect.tsx | 6 +- src/components/Form/FormPasswordGenerator.tsx | 18 +- src/components/Form/FormSelect.tsx | 16 +- src/components/KeyBackupReminder.tsx | 7 +- src/components/PageComponents/Channel.tsx | 71 +++-- .../PageComponents/Config/Bluetooth.tsx | 7 +- .../PageComponents/Config/Device.tsx | 2 +- .../PageComponents/Config/Display.tsx | 2 +- src/components/PageComponents/Config/LoRa.tsx | 2 +- .../PageComponents/Config/Network.tsx | 2 +- .../PageComponents/Config/Position.tsx | 2 +- .../PageComponents/Config/Power.tsx | 2 +- .../Config/Security/Security.tsx | 11 +- .../Config/Security/securityReducer.tsx | 2 +- .../PageComponents/Config/Security/types.ts | 6 +- src/components/PageComponents/Connect/BLE.tsx | 4 +- .../PageComponents/Connect/HTTP.tsx | 23 +- .../PageComponents/Connect/Serial.tsx | 4 +- .../PageComponents/Map/NodeDetail.tsx | 54 ++-- .../PageComponents/Messages/ChannelChat.tsx | 11 +- .../PageComponents/Messages/Message.tsx | 28 +- .../PageComponents/Messages/MessageInput.tsx | 22 +- .../PageComponents/Messages/TraceRoute.tsx | 39 +-- .../ModuleConfig/AmbientLighting.tsx | 2 +- .../PageComponents/ModuleConfig/Audio.tsx | 2 +- .../ModuleConfig/CannedMessage.tsx | 17 +- .../ModuleConfig/DetectionSensor.tsx | 2 +- .../ModuleConfig/ExternalNotification.tsx | 2 +- .../PageComponents/ModuleConfig/MQTT.tsx | 53 ++-- .../ModuleConfig/NeighborInfo.tsx | 2 +- .../ModuleConfig/Paxcounter.tsx | 2 +- .../PageComponents/ModuleConfig/RangeTest.tsx | 2 +- .../PageComponents/ModuleConfig/Serial.tsx | 2 +- .../ModuleConfig/StoreForward.tsx | 2 +- .../PageComponents/ModuleConfig/Telemetry.tsx | 2 +- src/components/PageLayout.tsx | 8 +- src/components/Sidebar.tsx | 128 ++++---- src/components/ThemeSwitcher.tsx | 12 +- src/components/Toaster.tsx | 4 +- src/components/UI/Avatar.tsx | 2 +- src/components/UI/Button.tsx | 8 +- src/components/UI/Command.tsx | 6 +- src/components/UI/Dialog.tsx | 8 +- src/components/UI/DropdownMenu.tsx | 12 +- src/components/UI/Footer.tsx | 9 +- src/components/UI/Generator.tsx | 1 - src/components/UI/Input.tsx | 5 +- src/components/UI/Menubar.tsx | 16 +- src/components/UI/Modal.tsx | 25 -- src/components/UI/MultiSelect.tsx | 7 +- src/components/UI/Popover.tsx | 2 +- src/components/UI/Select.tsx | 8 +- src/components/UI/Sidebar/sidebarButton.tsx | 5 +- src/components/UI/Spinner.tsx | 2 +- src/components/UI/Tabs.tsx | 2 +- src/components/UI/Toast.tsx | 20 +- src/components/UI/Tooltip.tsx | 4 +- src/components/UI/Typography/Blockquote.tsx | 2 +- src/components/UI/Typography/Code.tsx | 2 +- src/components/UI/Typography/H1.tsx | 2 +- src/components/UI/Typography/H2.tsx | 2 +- src/components/UI/Typography/H3.tsx | 2 +- src/components/UI/Typography/H4.tsx | 2 +- src/components/UI/Typography/H5.tsx | 2 +- src/components/UI/Typography/Link.tsx | 6 +- src/components/UI/Typography/P.tsx | 2 +- src/components/UI/Typography/Subtle.tsx | 2 +- src/components/generic/Blur.tsx | 2 +- src/components/generic/Mono.tsx | 2 +- src/components/generic/Table/index.tsx | 14 +- src/components/generic/ThemeProvider.tsx | 67 ---- src/components/generic/TimeAgo.tsx | 3 +- src/components/generic/Uptime.tsx | 4 +- src/core/hooks/useBrowserFeatureDetection.ts | 4 +- src/core/hooks/useKeyBackupReminder.tsx | 13 +- src/core/hooks/useTheme.ts | 6 +- src/core/hooks/useToast.ts | 34 +-- src/core/stores/appStore.ts | 4 +- src/core/stores/deviceStore.ts | 32 +- src/core/subscriptions.ts | 4 +- src/core/utils/debounce.test.ts | 2 +- src/core/utils/ip.test.ts | 2 +- src/core/utils/ip.ts | 4 +- src/core/utils/randId.test.ts | 2 +- src/index.css | 10 +- src/pages/Channels.tsx | 6 +- src/pages/Config/DeviceConfig.tsx | 2 +- src/pages/Config/ModuleConfig.tsx | 2 +- src/pages/Config/index.tsx | 24 +- src/pages/Dashboard/index.tsx | 139 +++++---- src/pages/Map/index.tsx | 45 +-- src/pages/Messages.tsx | 72 ++--- src/pages/Nodes.tsx | 44 +-- src/validation/channel.ts | 6 +- src/validation/config/bluetooth.ts | 12 +- src/validation/config/device.ts | 3 +- src/validation/config/display.ts | 3 +- src/validation/config/lora.ts | 3 +- src/validation/config/network.ts | 15 +- src/validation/config/position.ts | 14 +- src/validation/config/power.ts | 9 +- src/validation/config/security.ts | 12 +- .../moduleConfig/ambientLighting.ts | 12 +- src/validation/moduleConfig/audio.ts | 4 +- src/validation/moduleConfig/cannedMessage.ts | 18 +- .../moduleConfig/detectionSensor.ts | 12 +- .../moduleConfig/externalNotification.ts | 12 +- src/validation/moduleConfig/mqtt.ts | 15 +- src/validation/moduleConfig/neighborInfo.ts | 3 +- src/validation/moduleConfig/paxcounter.ts | 3 +- src/validation/moduleConfig/rangeTest.ts | 3 +- src/validation/moduleConfig/serial.ts | 3 +- src/validation/moduleConfig/storeForward.ts | 12 +- src/validation/moduleConfig/telemetry.ts | 3 +- 136 files changed, 1011 insertions(+), 1075 deletions(-) create mode 100644 deno.json delete mode 100644 src/components/UI/Modal.tsx delete mode 100644 src/components/generic/ThemeProvider.tsx diff --git a/deno.json b/deno.json new file mode 100644 index 00000000..4fd0c9ba --- /dev/null +++ b/deno.json @@ -0,0 +1,36 @@ +{ + "imports": { + "@meshtastic/core": "jsr:@meshtastic/core@^2.6.0", + "@meshtastic/js": "jsr:@meshtastic/js@^2.3.4", + "@meshtastic/transport-http": "jsr:@meshtastic/transport-http@^0.2.1", + "@meshtastic/transport-web-serial": "jsr:@meshtastic/transport-web-serial@^0.2.1", + "@app/": "./src/", + "@pages/": "./src/pages/", + "@components/": "./src/components/", + "@core/": "./src/core/", + "@layouts/": "./src/layouts/" + }, + "compilerOptions": { + "lib": [ + "DOM", + "DOM.Iterable", + "ESNext" + ], + "jsx": "react-jsx", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "strictNullChecks": true, + "types": [ + "vite/client", + "node", + "@types/web-bluetooth", + "@types/w3c-web-serial" + ], + "strictPropertyInitialization": false + }, + "unstable": [ + "sloppy-imports" + ] +} diff --git a/package.json b/package.json index b7179487..4765b90c 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "build": "deno run -A npm:vite build", "build:analyze": "BUNDLE_ANALYZE=true deno task build", "lint": "deno lint src/", - "lint:fix": "deno lint --write src/", - "format": "deno fmt --write src/", + "lint:fix": "deno lint --fix src/", + "format": "deno fmt src/", "dev": "deno task dev:ui", "dev:ui": "deno run -A npm:vite dev", "dev:scan": "VITE_DEBUG_SCAN=true deno task dev:ui", @@ -18,7 +18,6 @@ "preview": "deno run --allow-net npm:vite preview", "package": "deno run -A npm:gzipper c -i html,js,css,png,ico,svg,webmanifest,txt dist dist/output && deno run -A --allow-run tar -cvf dist/build.tar -C ./dist/output/ ." }, - "repository": { "type": "git", "url": "git+https://github.com/meshtastic/web.git" @@ -26,6 +25,15 @@ "bugs": { "url": "https://github.com/meshtastic/web/issues" }, + "simple-git-hooks": { + "pre-commit": "deno task lint:fix && deno task format" + }, + "lint-staged": { + "*.{ts,tsx}": [ + "deno task lint:fix", + "deno task format" + ] + }, "homepage": "https://meshtastic.org", "dependencies": { "@bufbuild/protobuf": "^2.2.3", diff --git a/src/App.tsx b/src/App.tsx index 2d02ab5b..a86b50f1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,20 +1,19 @@ import { DeviceWrapper } from "@app/DeviceWrapper.tsx"; import { PageRouter } from "@app/PageRouter.tsx"; -import { ThemeProvider } from "@app/components/generic/ThemeProvider"; import { CommandPalette } from "@components/CommandPalette.tsx"; import { DeviceSelector } from "@components/DeviceSelector.tsx"; -import { DialogManager } from "@components/Dialog/DialogManager"; +import { DialogManager } from "@components/Dialog/DialogManager.tsx"; import { NewDeviceDialog } from "@components/Dialog/NewDeviceDialog.tsx"; -import { KeyBackupReminder } from "@components/KeyBackupReminder"; +import { KeyBackupReminder } from "@components/KeyBackupReminder.tsx"; import { Toaster } from "@components/Toaster.tsx"; import Footer from "@components/UI/Footer.tsx"; import { useAppStore } from "@core/stores/appStore.ts"; import { useDeviceStore } from "@core/stores/deviceStore.ts"; import { Dashboard } from "@pages/Dashboard/index.tsx"; -import type { JSX } from "react"; + import { MapProvider } from "react-map-gl/maplibre"; -export const App = (): JSX.Element => { +export const App = () => { const { getDevice } = useDeviceStore(); const { selectedDevice, setConnectDialogOpen, connectDialogOpen } = useAppStore(); @@ -36,19 +35,21 @@ export const App = (): JSX.Element => {
- {device ? ( -
- - - - -
- ) : ( - <> - -
- - )} + {device + ? ( +
+ + + + +
+ ) + : ( + <> + +
+ + )}
diff --git a/src/components/CommandPalette.tsx b/src/components/CommandPalette.tsx index c0f0a94d..54659fcb 100644 --- a/src/components/CommandPalette.tsx +++ b/src/components/CommandPalette.tsx @@ -1,4 +1,4 @@ -import { Avatar } from "@components/UI/Avatar"; +import { Avatar } from "./UI/Avatar.tsx"; import { CommandDialog, CommandEmpty, @@ -117,13 +117,11 @@ export const CommandPalette = () => { return { label: device.nodes.get(device.hardware.myNodeNum)?.user?.longName ?? - device.hardware.myNodeNum.toString(), + device.hardware.myNodeNum.toString(), icon: ( ), action() { @@ -241,8 +239,8 @@ export const CommandPalette = () => { } }; - window.addEventListener("keydown", handleKeydown); - return () => window.removeEventListener("keydown", handleKeydown); + globalThis.addEventListener("keydown", handleKeydown); + return () => globalThis.removeEventListener("keydown", handleKeydown); }, [setCommandPaletteOpen]); return ( diff --git a/src/components/DeviceSelector.tsx b/src/components/DeviceSelector.tsx index 08c6dedb..76751900 100644 --- a/src/components/DeviceSelector.tsx +++ b/src/components/DeviceSelector.tsx @@ -5,10 +5,11 @@ import { Code } from "@components/UI/Typography/Code.tsx"; import { useAppStore } from "@core/stores/appStore.ts"; import { useDeviceStore } from "@core/stores/deviceStore.ts"; import { HomeIcon, PlusIcon, SearchIcon } from "lucide-react"; -import type { JSX } from "react"; -import { Avatar } from "./UI/Avatar"; -export const DeviceSelector = (): JSX.Element => { +import { Avatar } from "./UI/Avatar.tsx"; +import process from "node:process"; + +export const DeviceSelector = () => { const { getDevices } = useDeviceStore(); const { selectedDevice, @@ -38,11 +39,9 @@ export const DeviceSelector = (): JSX.Element => { active={selectedDevice === device.id} > ))} @@ -66,9 +65,11 @@ export const DeviceSelector = (): JSX.Element => { {/* TODO: This is being commented out until its fixed */} - {/* */} + */ + } {process.env.COMMIT_HASH} diff --git a/src/components/DeviceSelectorButton.tsx b/src/components/DeviceSelectorButton.tsx index 8c50df8e..62c2bc2a 100644 --- a/src/components/DeviceSelectorButton.tsx +++ b/src/components/DeviceSelectorButton.tsx @@ -5,7 +5,6 @@ export interface DeviceSelectorButtonProps { } export const DeviceSelectorButton = ({ - active, onClick, children, }: DeviceSelectorButtonProps) => ( @@ -14,9 +13,11 @@ export const DeviceSelectorButton = ({ onClick={onClick} onKeyDown={onClick} > - {/* {active && ( + { + /* {active && (
- )} */} + )} */ + }
{children}
diff --git a/src/components/Dialog/DialogManager.tsx b/src/components/Dialog/DialogManager.tsx index d571ffcb..f0ac96d6 100644 --- a/src/components/Dialog/DialogManager.tsx +++ b/src/components/Dialog/DialogManager.tsx @@ -1,15 +1,15 @@ import { RemoveNodeDialog } from "@app/components/Dialog/RemoveNodeDialog.tsx"; import { DeviceNameDialog } from "@components/Dialog/DeviceNameDialog.tsx"; import { ImportDialog } from "@components/Dialog/ImportDialog.tsx"; -import { PkiBackupDialog } from "@components/Dialog/PKIBackupDialog"; +import { PkiBackupDialog } from "./PKIBackupDialog.tsx"; import { QRDialog } from "@components/Dialog/QRDialog.tsx"; import { RebootDialog } from "@components/Dialog/RebootDialog.tsx"; import { ShutdownDialog } from "@components/Dialog/ShutdownDialog.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; -import type { JSX } from "react"; -import { NodeDetailsDialog } from "./NodeDetailsDialog"; -export const DialogManager = (): JSX.Element => { +import { NodeDetailsDialog } from "./NodeDetailsDialog.tsx"; + +export const DialogManager = () => { const { channels, config, dialog, setDialogOpen } = useDevice(); return ( <> diff --git a/src/components/Dialog/ImportDialog.tsx b/src/components/Dialog/ImportDialog.tsx index ed37351e..9a5ac133 100644 --- a/src/components/Dialog/ImportDialog.tsx +++ b/src/components/Dialog/ImportDialog.tsx @@ -15,7 +15,7 @@ import { Switch } from "@components/UI/Switch.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; import { toByteArray } from "base64-js"; -import { type JSX, useEffect, useState } from "react"; +import { useEffect, useState } from "react"; export interface ImportDialogProps { open: boolean; @@ -26,7 +26,7 @@ export interface ImportDialogProps { export const ImportDialog = ({ open, onOpenChange, -}: ImportDialogProps): JSX.Element => { +}: ImportDialogProps) => { const [importDialogInput, setImportDialogInput] = useState(""); const [channelSet, setChannelSet] = useState(); const [validUrl, setValidUrl] = useState(false); @@ -62,7 +62,7 @@ export const ImportDialog = ({ ), ); setValidUrl(true); - } catch (error) { + } catch (_error) { setValidUrl(false); setChannelSet(undefined); } @@ -73,10 +73,9 @@ export const ImportDialog = ({ connection?.setChannel( create(Protobuf.Channel.ChannelSchema, { index, - role: - index === 0 - ? Protobuf.Channel.Channel_Role.PRIMARY - : Protobuf.Channel.Channel_Role.SECONDARY, + role: index === 0 + ? Protobuf.Channel.Channel_Role.PRIMARY + : Protobuf.Channel.Channel_Role.SECONDARY, settings: ch, }), ); @@ -119,25 +118,29 @@ export const ImportDialog = ({
- {/* */} + */ + }
- {/* */} + */ + } Channels: diff --git a/src/components/Dialog/LocationResponseDialog.tsx b/src/components/Dialog/LocationResponseDialog.tsx index b885667c..ce6766ca 100644 --- a/src/components/Dialog/LocationResponseDialog.tsx +++ b/src/components/Dialog/LocationResponseDialog.tsx @@ -1,14 +1,13 @@ -import { useDevice } from "@app/core/stores/deviceStore"; +import { useDevice } from "../../core/stores/deviceStore.ts"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, -} from "@components/UI/Dialog"; +} from "../UI/Dialog.tsx"; import type { Protobuf, Types } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; -import type { JSX } from "react"; export interface LocationResponseDialogProps { location: Types.PacketMetadata | undefined; @@ -20,15 +19,13 @@ export const LocationResponseDialog = ({ location, open, onOpenChange, -}: LocationResponseDialogProps): JSX.Element => { +}: LocationResponseDialogProps) => { const { nodes } = useDevice(); const from = nodes.get(location?.from ?? 0); - const longName = - from?.user?.longName ?? + const longName = from?.user?.longName ?? (from ? `!${numberToHexUnpadded(from?.num)}` : "Unknown"); - const shortName = - from?.user?.shortName ?? + const shortName = from?.user?.shortName ?? (from ? `${numberToHexUnpadded(from?.num).substring(0, 4)}` : "UNK"); return ( diff --git a/src/components/Dialog/NewDeviceDialog.tsx b/src/components/Dialog/NewDeviceDialog.tsx index 6be6d58d..192c51a6 100644 --- a/src/components/Dialog/NewDeviceDialog.tsx +++ b/src/components/Dialog/NewDeviceDialog.tsx @@ -1,7 +1,7 @@ import { type BrowserFeature, useBrowserFeatureDetection, -} from "@app/core/hooks/useBrowserFeatureDetection"; +} from "../../core/hooks/useBrowserFeatureDetection.ts"; import { BLE } from "@components/PageComponents/Connect/BLE.tsx"; import { HTTP } from "@components/PageComponents/Connect/HTTP.tsx"; import { Serial } from "@components/PageComponents/Connect/Serial.tsx"; @@ -18,9 +18,9 @@ import { TabsTrigger, } from "@components/UI/Tabs.tsx"; import { Subtle } from "@components/UI/Typography/Subtle.tsx"; -import { AlertCircle, InfoIcon } from "lucide-react"; -import { Fragment, type JSX } from "react/jsx-runtime"; -import { Link } from "../UI/Typography/Link"; +import { AlertCircle } from "lucide-react"; +import { Link } from "../UI/Typography/Link.tsx"; +import { Fragment } from "react/jsx-runtime"; export interface TabElementProps { closeDialog: () => void; @@ -85,14 +85,16 @@ const ErrorMessage = ({ missingFeatures }: FeatureErrorProps) => {

{browserFeatures.length > 0 && ( <> - This application requires {formatFeatureList(browserFeatures)}. - Please use a Chromium-based browser like Chrome or Edge. + This application requires{" "} + {formatFeatureList(browserFeatures)}. Please use a + Chromium-based browser like Chrome or Edge. )} {needsSecureContext && ( <> {browserFeatures.length > 0 && " Additionally, it"} - {browserFeatures.length === 0 && "This application"} requires a{" "} + {browserFeatures.length === 0 && "This application"} requires a + {" "} secure context. Please connect using HTTPS or localhost. @@ -107,7 +109,7 @@ const ErrorMessage = ({ missingFeatures }: FeatureErrorProps) => { export const NewDeviceDialog = ({ open, onOpenChange, -}: NewDeviceProps): JSX.Element => { +}: NewDeviceProps) => { const { unsupported } = useBrowserFeatureDetection(); const tabs: TabManifest[] = [ @@ -119,15 +121,13 @@ export const NewDeviceDialog = ({ { label: "Bluetooth", element: BLE, - isDisabled: - unsupported.includes("Web Bluetooth") || + isDisabled: unsupported.includes("Web Bluetooth") || unsupported.includes("Secure Context"), }, { label: "Serial", element: Serial, - isDisabled: - unsupported.includes("Web Serial") || + isDisabled: unsupported.includes("Web Serial") || unsupported.includes("Secure Context"), }, ]; @@ -149,9 +149,9 @@ export const NewDeviceDialog = ({ {tabs.map((tab) => (

- {tab.isDisabled ? ( - - ) : null} + {tab.isDisabled + ? + : null} onOpenChange(false)} />
diff --git a/src/components/Dialog/NodeDetailsDialog.tsx b/src/components/Dialog/NodeDetailsDialog.tsx index ab76aa2f..c84af0b2 100644 --- a/src/components/Dialog/NodeDetailsDialog.tsx +++ b/src/components/Dialog/NodeDetailsDialog.tsx @@ -1,23 +1,23 @@ -import { useAppStore } from "@app/core/stores/appStore"; -import { useDevice } from "@app/core/stores/deviceStore"; +import { useAppStore } from "../../core/stores/appStore.ts"; +import { useDevice } from "../../core/stores/deviceStore.ts"; import { Accordion, AccordionContent, AccordionItem, AccordionTrigger, -} from "@components/UI/Accordion"; +} from "../UI/Accordion.tsx"; import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, -} from "@components/UI/Dialog"; +} from "../UI/Dialog.tsx"; import { Protobuf } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; -import { DeviceImage } from "../generic/DeviceImage"; -import { TimeAgo } from "../generic/TimeAgo"; -import { Uptime } from "../generic/Uptime"; +import { DeviceImage } from "../generic/DeviceImage.tsx"; +import { TimeAgo } from "../generic/TimeAgo.tsx"; +import { Uptime } from "../generic/Uptime.tsx"; export interface NodeDetailsDialogProps { open: boolean; @@ -32,134 +32,159 @@ export const NodeDetailsDialog = ({ const { nodeNumDetails } = useAppStore(); const device: Protobuf.Mesh.NodeInfo = nodes.get(nodeNumDetails); - return device ? ( - - - - - Node Details for {device.user?.longName ?? "UNKNOWN"} ( - {device.user?.shortName ?? "UNK"}) - - - -
- -
-

- Details: -

-

- Hardware:{" "} - {Protobuf.Mesh.HardwareModel[device.user?.hwModel ?? 0]} -

-

Node Number: {device.num}

-

Node HEX: !{numberToHexUnpadded(device.num)}

-

- Role:{" "} - { - Protobuf.Config.Config_DeviceConfig_Role[ - device.user?.role ?? 0 - ] - } -

-

- Last Heard:{" "} - {device.lastHeard === 0 ? ( - "Never" - ) : ( - - )} -

-
- - {device.position ? ( -
+ return device + ? ( + + + + + Node Details for {device.user?.longName ?? "UNKNOWN"} ( + {device.user?.shortName ?? "UNK"}) + + + +
+ +

- Position: + Details:

- {device.position.latitudeI && device.position.longitudeI ? ( -

- Coordinates:{" "} - - {device.position.latitudeI / 1e7},{" "} - {device.position.longitudeI / 1e7} - -

- ) : null} - {device.position.altitude ? ( -

Altitude: {device.position.altitude}m

- ) : null} -
- ) : null} - - {device.deviceMetrics ? ( -
-

- Device Metrics: +

+ Hardware:{" "} + {Protobuf.Mesh.HardwareModel[device.user?.hwModel ?? 0]} +

+

Node Number: {device.num}

+

Node HEX: !{numberToHexUnpadded(device.num)}

+

+ Role: {Protobuf.Config.Config_DeviceConfig_Role[ + device.user?.role ?? 0 + ]} +

+

+ Last Heard: {device.lastHeard === 0 + ? ( + "Never" + ) + : }

- {device.deviceMetrics.airUtilTx ? ( -

- Air TX utilization:{" "} - {device.deviceMetrics.airUtilTx.toFixed(2)}% -

- ) : null} - {device.deviceMetrics.channelUtilization ? ( -

- Channel utilization:{" "} - {device.deviceMetrics.channelUtilization.toFixed(2)}% -

- ) : null} - {device.deviceMetrics.batteryLevel ? ( -

- Battery level:{" "} - {device.deviceMetrics.batteryLevel.toFixed(2)}% -

- ) : null} - {device.deviceMetrics.voltage ? ( -

Voltage: {device.deviceMetrics.voltage.toFixed(2)}V

- ) : null} - {device.deviceMetrics.uptimeSeconds ? ( -

- Uptime:{" "} - -

- ) : null}
- ) : null} - {device ? ( -
- - - -

- All Raw Metrics: -

-
- -
+              {device.position
+                ? (
+                  
+

+ Position: +

+ {device.position.latitudeI && device.position.longitudeI + ? ( +

+ Coordinates:{" "} + + {device.position.latitudeI / 1e7},{" "} + {device.position.longitudeI / 1e7} + +

+ ) + : null} + {device.position.altitude + ?

Altitude: {device.position.altitude}m

+ : null} +
+ ) + : null} + + {device.deviceMetrics + ? ( +
+

+ Device Metrics: +

+ {device.deviceMetrics.airUtilTx + ? ( +

+ Air TX utilization:{" "} + {device.deviceMetrics.airUtilTx.toFixed(2)}% +

+ ) + : null} + {device.deviceMetrics.channelUtilization + ? ( +

+ Channel utilization:{" "} + {device.deviceMetrics.channelUtilization.toFixed(2)}% +

+ ) + : null} + {device.deviceMetrics.batteryLevel + ? ( +

+ Battery level:{" "} + {device.deviceMetrics.batteryLevel.toFixed(2)}% +

+ ) + : null} + {device.deviceMetrics.voltage + ? ( +

+ Voltage: {device.deviceMetrics.voltage.toFixed(2)}V +

+ ) + : null} + {device.deviceMetrics.uptimeSeconds + ? ( +

+ Uptime:{" "} + +

+ ) + : null} +
+ ) + : null} + + {device + ? ( +
+ + + +

+ All Raw Metrics: +

+
+ +
                         {JSON.stringify(device, null, 2)}
-                      
-
-
-
-
- ) : null} -
- - -
- ) : null; + + + + +
+ ) + : null} +
+
+
+
+ ) + : null; }; diff --git a/src/components/Dialog/NodeOptionsDialog.tsx b/src/components/Dialog/NodeOptionsDialog.tsx index 0161bb22..34603f6f 100644 --- a/src/components/Dialog/NodeOptionsDialog.tsx +++ b/src/components/Dialog/NodeOptionsDialog.tsx @@ -1,17 +1,17 @@ -import { toast } from "@app/core/hooks/useToast"; -import { useAppStore } from "@app/core/stores/appStore"; -import { useDevice } from "@app/core/stores/deviceStore"; +import { toast } from "../../core/hooks/useToast.ts"; +import { useAppStore } from "../../core/stores/appStore.ts"; +import { useDevice } from "../../core/stores/deviceStore.ts"; import { Dialog, DialogContent, DialogHeader, DialogTitle, -} from "@components/UI/Dialog"; +} from "../UI/Dialog.tsx"; import type { Protobuf } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; import { TrashIcon } from "lucide-react"; -import type { JSX } from "react"; -import { Button } from "../UI/Button"; + +import { Button } from "../UI/Button.tsx"; export interface NodeOptionsDialogProps { node: Protobuf.Mesh.NodeInfo | undefined; @@ -23,7 +23,7 @@ export const NodeOptionsDialog = ({ node, open, onOpenChange, -}: NodeOptionsDialogProps): JSX.Element => { +}: NodeOptionsDialogProps) => { const { setDialogOpen, connection, setActivePage } = useDevice(); const { setNodeNumToBeRemoved, @@ -31,11 +31,9 @@ export const NodeOptionsDialog = ({ setChatType, setActiveChat, } = useAppStore(); - const longName = - node?.user?.longName ?? + const longName = node?.user?.longName ?? (node ? `!${numberToHexUnpadded(node?.num)}` : "Unknown"); - const shortName = - node?.user?.shortName ?? + const shortName = node?.user?.shortName ?? (node ? `${numberToHexUnpadded(node?.num).substring(0, 4)}` : "UNK"); function handleDirectMessage() { @@ -53,7 +51,7 @@ export const NodeOptionsDialog = ({ connection?.requestPosition(node.num).then(() => toast({ title: "Position request sent.", - }), + }) ); onOpenChange(); } @@ -66,7 +64,7 @@ export const NodeOptionsDialog = ({ connection?.traceRoute(node.num).then(() => toast({ title: "Traceroute sent.", - }), + }) ); onOpenChange(); } diff --git a/src/components/Dialog/PKIBackupDialog.tsx b/src/components/Dialog/PKIBackupDialog.tsx index 9b6c18d8..7304ba03 100644 --- a/src/components/Dialog/PKIBackupDialog.tsx +++ b/src/components/Dialog/PKIBackupDialog.tsx @@ -1,5 +1,5 @@ -import { useDevice } from "@app/core/stores/deviceStore"; -import { Button } from "@components/UI/Button"; +import { useDevice } from "../../core/stores/deviceStore.ts"; +import { Button } from "../UI/Button.tsx"; import { Dialog, DialogContent, @@ -40,7 +40,7 @@ export const PkiBackupDialog = ({ const renderPrintWindow = React.useCallback(() => { if (!privateKey || !publicKey) return; - const printWindow = window.open("", "_blank"); + const printWindow = globalThis.open("", "_blank"); if (printWindow) { printWindow.document.write(` @@ -116,14 +116,14 @@ export const PkiBackupDialog = ({ - diff --git a/src/components/Dialog/PkiRegenerateDialog.tsx b/src/components/Dialog/PkiRegenerateDialog.tsx index 818e7207..e36b2048 100644 --- a/src/components/Dialog/PkiRegenerateDialog.tsx +++ b/src/components/Dialog/PkiRegenerateDialog.tsx @@ -18,7 +18,7 @@ export const PkiRegenerateDialog = ({ open, onOpenChange, onSubmit, -}: PkiRegenerateDialogProps): JSX.Element => { +}: PkiRegenerateDialogProps) => { return ( diff --git a/src/components/Dialog/QRDialog.tsx b/src/components/Dialog/QRDialog.tsx index 54e7aec8..f6b542cb 100644 --- a/src/components/Dialog/QRDialog.tsx +++ b/src/components/Dialog/QRDialog.tsx @@ -28,7 +28,7 @@ export const QRDialog = ({ onOpenChange, loraConfig, channels, -}: QRDialogProps): JSX.Element => { +}: QRDialogProps) => { const [selectedChannels, setSelectedChannels] = useState([0]); const [qrCodeUrl, setQrCodeUrl] = useState(""); const [qrCodeAdd, setQrCodeAdd] = useState(); @@ -77,8 +77,8 @@ export const QRDialog = ({ {channel.settings?.name.length ? channel.settings.name : channel.role === Protobuf.Channel.Channel_Role.PRIMARY - ? "Primary" - : `Channel: ${channel.index}`} + ? "Primary" + : `Channel: ${channel.index}`} { if (selectedChannels.includes(channel.index)) { setSelectedChannels( - selectedChannels.filter((c) => c !== channel.index), + selectedChannels.filter((c) => + c !== channel.index + ), ); } else { setSelectedChannels([ @@ -130,7 +132,7 @@ export const QRDialog = ({ { +}: RebootDialogProps) => { const { connection } = useDevice(); const [time, setTime] = useState(5); diff --git a/src/components/Dialog/RemoveNodeDialog.tsx b/src/components/Dialog/RemoveNodeDialog.tsx index 81bfcd04..a0b2db83 100644 --- a/src/components/Dialog/RemoveNodeDialog.tsx +++ b/src/components/Dialog/RemoveNodeDialog.tsx @@ -1,4 +1,4 @@ -import { useAppStore } from "@app/core/stores/appStore"; +import { useAppStore } from "../../core/stores/appStore.ts"; import { useDevice } from "@app/core/stores/deviceStore.ts"; import { Button } from "@components/UI/Button.tsx"; import { @@ -19,7 +19,7 @@ export interface RemoveNodeDialogProps { export const RemoveNodeDialog = ({ open, onOpenChange, -}: RemoveNodeDialogProps): JSX.Element => { +}: RemoveNodeDialogProps) => { const { connection, nodes, removeNode } = useDevice(); const { nodeNumToBeRemoved } = useAppStore(); diff --git a/src/components/Dialog/ShutdownDialog.tsx b/src/components/Dialog/ShutdownDialog.tsx index 398896e5..ef7b87ac 100644 --- a/src/components/Dialog/ShutdownDialog.tsx +++ b/src/components/Dialog/ShutdownDialog.tsx @@ -19,7 +19,7 @@ export interface ShutdownDialogProps { export const ShutdownDialog = ({ open, onOpenChange, -}: ShutdownDialogProps): JSX.Element => { +}: ShutdownDialogProps) => { const { connection } = useDevice(); const [time, setTime] = useState(5); diff --git a/src/components/Dialog/TracerouteResponseDialog.tsx b/src/components/Dialog/TracerouteResponseDialog.tsx index 0427a299..6c7ad17e 100644 --- a/src/components/Dialog/TracerouteResponseDialog.tsx +++ b/src/components/Dialog/TracerouteResponseDialog.tsx @@ -1,15 +1,15 @@ -import { useDevice } from "@app/core/stores/deviceStore"; +import { useDevice } from "../../core/stores/deviceStore.ts"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, -} from "@components/UI/Dialog"; +} from "../UI/Dialog.tsx"; import type { Protobuf, Types } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; -import type { JSX } from "react"; -import { TraceRoute } from "../PageComponents/Messages/TraceRoute"; + +import { TraceRoute } from "../PageComponents/Messages/TraceRoute.tsx"; export interface TracerouteResponseDialogProps { traceroute: Types.PacketMetadata | undefined; @@ -21,18 +21,16 @@ export const TracerouteResponseDialog = ({ traceroute, open, onOpenChange, -}: TracerouteResponseDialogProps): JSX.Element => { +}: TracerouteResponseDialogProps) => { const { nodes } = useDevice(); const route: number[] = traceroute?.data.route ?? []; const routeBack: number[] = traceroute?.data.routeBack ?? []; const snrTowards = traceroute?.data.snrTowards ?? []; const snrBack = traceroute?.data.snrBack ?? []; const from = nodes.get(traceroute?.from ?? 0); - const longName = - from?.user?.longName ?? + const longName = from?.user?.longName ?? (from ? `!${numberToHexUnpadded(from?.num)}` : "Unknown"); - const shortName = - from?.user?.shortName ?? + const shortName = from?.user?.shortName ?? (from ? `${numberToHexUnpadded(from?.num).substring(0, 4)}` : "UNK"); const to = nodes.get(traceroute?.to ?? 0); return ( diff --git a/src/components/Form/DynamicForm.tsx b/src/components/Form/DynamicForm.tsx index e883b004..3dd4d5eb 100644 --- a/src/components/Form/DynamicForm.tsx +++ b/src/components/Form/DynamicForm.tsx @@ -74,10 +74,11 @@ export function DynamicForm({ const value = getValues(field.fieldName); if (value === "always") return true; if (typeof value === "boolean") return field.invert ? value : !value; - if (typeof value === "number") + if (typeof value === "number") { return field.invert ? field.selector !== value : field.selector === value; + } return false; }); }; @@ -85,11 +86,9 @@ export function DynamicForm({ return (
{fieldGroups.map((fieldGroup) => (
@@ -105,10 +104,8 @@ export function DynamicForm({ label={field.label} fieldName={field.name} description={field.description} - valid={ - field.validationText === undefined || - field.validationText === "" - } + valid={field.validationText === undefined || + field.validationText === ""} validationText={field.validationText} > ({ case "toggle": return ( - + ); case "select": return ( - + ); case "passwordGenerator": return ( diff --git a/src/components/Form/FormInput.tsx b/src/components/Form/FormInput.tsx index d50af067..a9398bc8 100644 --- a/src/components/Form/FormInput.tsx +++ b/src/components/Form/FormInput.tsx @@ -40,17 +40,15 @@ export function GenericInput({ control={control} render={({ field: { value, onChange, ...rest } }) => ( extends BaseFormBuilderProps { type: "multiSelect"; @@ -28,8 +28,8 @@ export function MultiSelectInput({ // Make sure to filter out the UNSET value, as it shouldn't be shown in the UI const optionsEnumValues = enumValue ? Object.entries(enumValue) - .filter((value) => typeof value[1] === "number") - .filter((value) => value[0] !== "UNSET") + .filter((value) => typeof value[1] === "number") + .filter((value) => value[0] !== "UNSET") : []; const formatName = (name: string) => { diff --git a/src/components/Form/FormPasswordGenerator.tsx b/src/components/Form/FormPasswordGenerator.tsx index 6fc4aac7..f4b8fbcb 100644 --- a/src/components/Form/FormPasswordGenerator.tsx +++ b/src/components/Form/FormPasswordGenerator.tsx @@ -2,10 +2,10 @@ import type { BaseFormBuilderProps, GenericFormElementProps, } from "@components/Form/DynamicForm.tsx"; -import type { ButtonVariant } from "@components/UI/Button"; +import type { ButtonVariant } from "../UI/Button.tsx"; import { Generator } from "@components/UI/Generator.tsx"; import { Eye, EyeOff } from "lucide-react"; -import type { ChangeEventHandler, MouseEventHandler } from "react"; +import type { ChangeEventHandler } from "react"; import { useState } from "react"; import { Controller, type FieldValues } from "react-hook-form"; @@ -43,14 +43,12 @@ export function PasswordGenerator({ ({ field.properties; const optionsEnumValues = enumValue ? Object.entries(enumValue).filter( - (value) => typeof value[1] === "number", - ) + (value) => typeof value[1] === "number", + ) : []; return ( { +}: TraceRouteProps) => { const { nodes } = useDevice(); return ( @@ -38,23 +37,25 @@ export const TraceRoute = ({ ))} {from?.user?.longName} - {routeBack ? ( - -

Route back:

-

{from?.user?.longName}

-

↓ {snrBack?.[0] ? snrBack[0] : "??"}dB

- {routeBack.map((hop, i) => ( - -

- {nodes.get(hop)?.user?.longName ?? - `!${numberToHexUnpadded(hop)}`} -

-

↓ {snrBack?.[i + 1] ? snrBack[i + 1] : "??"}dB

-
- ))} - {to?.user?.longName} -
- ) : null} + {routeBack + ? ( + +

Route back:

+

{from?.user?.longName}

+

↓ {snrBack?.[0] ? snrBack[0] : "??"}dB

+ {routeBack.map((hop, i) => ( + +

+ {nodes.get(hop)?.user?.longName ?? + `!${numberToHexUnpadded(hop)}`} +

+

↓ {snrBack?.[i + 1] ? snrBack[i + 1] : "??"}dB

+
+ ))} + {to?.user?.longName} +
+ ) + : null}
); }; diff --git a/src/components/PageComponents/ModuleConfig/AmbientLighting.tsx b/src/components/PageComponents/ModuleConfig/AmbientLighting.tsx index effe7471..6ea06354 100644 --- a/src/components/PageComponents/ModuleConfig/AmbientLighting.tsx +++ b/src/components/PageComponents/ModuleConfig/AmbientLighting.tsx @@ -4,7 +4,7 @@ import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { Protobuf } from "@meshtastic/core"; -export const AmbientLighting = (): JSX.Element => { +export const AmbientLighting = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: AmbientLightingValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/Audio.tsx b/src/components/PageComponents/ModuleConfig/Audio.tsx index 08960704..4297f09f 100644 --- a/src/components/PageComponents/ModuleConfig/Audio.tsx +++ b/src/components/PageComponents/ModuleConfig/Audio.tsx @@ -4,7 +4,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; -export const Audio = (): JSX.Element => { +export const Audio = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: AudioValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/CannedMessage.tsx b/src/components/PageComponents/ModuleConfig/CannedMessage.tsx index b800035d..661a9f01 100644 --- a/src/components/PageComponents/ModuleConfig/CannedMessage.tsx +++ b/src/components/PageComponents/ModuleConfig/CannedMessage.tsx @@ -4,7 +4,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; -export const CannedMessage = (): JSX.Element => { +export const CannedMessage = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: CannedMessageValidation) => { @@ -63,9 +63,8 @@ export const CannedMessage = (): JSX.Element => { label: "Clockwise event", description: "Select input event.", properties: { - enumValue: - Protobuf.ModuleConfig - .ModuleConfig_CannedMessageConfig_InputEventChar, + enumValue: Protobuf.ModuleConfig + .ModuleConfig_CannedMessageConfig_InputEventChar, }, }, { @@ -74,9 +73,8 @@ export const CannedMessage = (): JSX.Element => { label: "Counter Clockwise event", description: "Select input event.", properties: { - enumValue: - Protobuf.ModuleConfig - .ModuleConfig_CannedMessageConfig_InputEventChar, + enumValue: Protobuf.ModuleConfig + .ModuleConfig_CannedMessageConfig_InputEventChar, }, }, { @@ -85,9 +83,8 @@ export const CannedMessage = (): JSX.Element => { label: "Press event", description: "Select input event", properties: { - enumValue: - Protobuf.ModuleConfig - .ModuleConfig_CannedMessageConfig_InputEventChar, + enumValue: Protobuf.ModuleConfig + .ModuleConfig_CannedMessageConfig_InputEventChar, }, }, { diff --git a/src/components/PageComponents/ModuleConfig/DetectionSensor.tsx b/src/components/PageComponents/ModuleConfig/DetectionSensor.tsx index 056c48dd..ff698094 100644 --- a/src/components/PageComponents/ModuleConfig/DetectionSensor.tsx +++ b/src/components/PageComponents/ModuleConfig/DetectionSensor.tsx @@ -4,7 +4,7 @@ import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { Protobuf } from "@meshtastic/core"; -export const DetectionSensor = (): JSX.Element => { +export const DetectionSensor = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: DetectionSensorValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/ExternalNotification.tsx b/src/components/PageComponents/ModuleConfig/ExternalNotification.tsx index 6d767ea1..ecaa8cbf 100644 --- a/src/components/PageComponents/ModuleConfig/ExternalNotification.tsx +++ b/src/components/PageComponents/ModuleConfig/ExternalNotification.tsx @@ -4,7 +4,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; -export const ExternalNotification = (): JSX.Element => { +export const ExternalNotification = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: ExternalNotificationValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/MQTT.tsx b/src/components/PageComponents/ModuleConfig/MQTT.tsx index 28e3cba9..c20907cf 100644 --- a/src/components/PageComponents/ModuleConfig/MQTT.tsx +++ b/src/components/PageComponents/ModuleConfig/MQTT.tsx @@ -4,7 +4,7 @@ import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { Protobuf } from "@meshtastic/core"; -export const MQTT = (): JSX.Element => { +export const MQTT = () => { const { config, moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: MqttValidation) => { @@ -165,32 +165,31 @@ export const MQTT = (): JSX.Element => { description: "Position shared will be accurate within this distance", properties: { - enumValue: - config.display?.units === 0 - ? { - "Within 23 km": 10, - "Within 12 km": 11, - "Within 5.8 km": 12, - "Within 2.9 km": 13, - "Within 1.5 km": 14, - "Within 700 m": 15, - "Within 350 m": 16, - "Within 200 m": 17, - "Within 90 m": 18, - "Within 50 m": 19, - } - : { - "Within 15 miles": 10, - "Within 7.3 miles": 11, - "Within 3.6 miles": 12, - "Within 1.8 miles": 13, - "Within 0.9 miles": 14, - "Within 0.5 miles": 15, - "Within 0.2 miles": 16, - "Within 600 feet": 17, - "Within 300 feet": 18, - "Within 150 feet": 19, - }, + enumValue: config.display?.units === 0 + ? { + "Within 23 km": 10, + "Within 12 km": 11, + "Within 5.8 km": 12, + "Within 2.9 km": 13, + "Within 1.5 km": 14, + "Within 700 m": 15, + "Within 350 m": 16, + "Within 200 m": 17, + "Within 90 m": 18, + "Within 50 m": 19, + } + : { + "Within 15 miles": 10, + "Within 7.3 miles": 11, + "Within 3.6 miles": 12, + "Within 1.8 miles": 13, + "Within 0.9 miles": 14, + "Within 0.5 miles": 15, + "Within 0.2 miles": 16, + "Within 600 feet": 17, + "Within 300 feet": 18, + "Within 150 feet": 19, + }, }, disabledBy: [ { diff --git a/src/components/PageComponents/ModuleConfig/NeighborInfo.tsx b/src/components/PageComponents/ModuleConfig/NeighborInfo.tsx index b3391f0f..aaf154de 100644 --- a/src/components/PageComponents/ModuleConfig/NeighborInfo.tsx +++ b/src/components/PageComponents/ModuleConfig/NeighborInfo.tsx @@ -4,7 +4,7 @@ import { create } from "@bufbuild/protobuf"; import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { Protobuf } from "@meshtastic/core"; -export const NeighborInfo = (): JSX.Element => { +export const NeighborInfo = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: NeighborInfoValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/Paxcounter.tsx b/src/components/PageComponents/ModuleConfig/Paxcounter.tsx index fd5b372f..9f2804cf 100644 --- a/src/components/PageComponents/ModuleConfig/Paxcounter.tsx +++ b/src/components/PageComponents/ModuleConfig/Paxcounter.tsx @@ -4,7 +4,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; -export const Paxcounter = (): JSX.Element => { +export const Paxcounter = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: PaxcounterValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/RangeTest.tsx b/src/components/PageComponents/ModuleConfig/RangeTest.tsx index e0fbdf2f..5949385f 100644 --- a/src/components/PageComponents/ModuleConfig/RangeTest.tsx +++ b/src/components/PageComponents/ModuleConfig/RangeTest.tsx @@ -4,7 +4,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; -export const RangeTest = (): JSX.Element => { +export const RangeTest = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: RangeTestValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/Serial.tsx b/src/components/PageComponents/ModuleConfig/Serial.tsx index 05713f20..eb9b53c9 100644 --- a/src/components/PageComponents/ModuleConfig/Serial.tsx +++ b/src/components/PageComponents/ModuleConfig/Serial.tsx @@ -4,7 +4,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; -export const Serial = (): JSX.Element => { +export const Serial = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: SerialValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/StoreForward.tsx b/src/components/PageComponents/ModuleConfig/StoreForward.tsx index 72ca9bee..f091f586 100644 --- a/src/components/PageComponents/ModuleConfig/StoreForward.tsx +++ b/src/components/PageComponents/ModuleConfig/StoreForward.tsx @@ -4,7 +4,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; -export const StoreForward = (): JSX.Element => { +export const StoreForward = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: StoreForwardValidation) => { diff --git a/src/components/PageComponents/ModuleConfig/Telemetry.tsx b/src/components/PageComponents/ModuleConfig/Telemetry.tsx index c2de366e..8138a77d 100644 --- a/src/components/PageComponents/ModuleConfig/Telemetry.tsx +++ b/src/components/PageComponents/ModuleConfig/Telemetry.tsx @@ -4,7 +4,7 @@ import { DynamicForm } from "@components/Form/DynamicForm.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf } from "@meshtastic/core"; -export const Telemetry = (): JSX.Element => { +export const Telemetry = () => { const { moduleConfig, setWorkingModuleConfig } = useDevice(); const onSubmit = (data: TelemetryValidation) => { diff --git a/src/components/PageLayout.tsx b/src/components/PageLayout.tsx index d15a8dda..63834845 100644 --- a/src/components/PageLayout.tsx +++ b/src/components/PageLayout.tsx @@ -1,7 +1,7 @@ import { cn } from "@app/core/utils/cn.ts"; import { AlignLeftIcon, type LucideIcon } from "lucide-react"; -import Footer from "./UI/Footer"; -import { Spinner } from "./UI/Spinner"; +import Footer from "./UI/Footer.tsx"; +import { Spinner } from "./UI/Spinner.tsx"; export interface PageLayoutProps { label: string; @@ -44,9 +44,7 @@ export const PageLayout = ({ className="transition-all hover:text-accent" onClick={action.onClick} > - {action?.isLoading ? ( - - ) : ( + {action?.isLoading ? : ( { +export const Sidebar = ({ children }: SidebarProps) => { const { hardware, nodes, metadata } = useDevice(); const myNode = nodes.get(hardware.myNodeNum); const myMetadata = metadata.get(0); @@ -64,69 +64,71 @@ export const Sidebar = ({ children }: SidebarProps): JSX.Element => { }, ]; - return showSidebar ? ( -
-
-
- - {myNode?.user?.shortName ?? "UNK"} - - {myNode?.user?.longName ?? "UNK"} + return showSidebar + ? ( +
+
+
+ + {myNode?.user?.shortName ?? "UNK"} + + {myNode?.user?.longName ?? "UNK"} +
+ +
- - -
-
-
- - - {myNode?.deviceMetrics?.batteryLevel - ? myNode?.deviceMetrics?.batteryLevel > 100 - ? "Charging" - : `${myNode?.deviceMetrics?.batteryLevel}%` - : "UNK"} - -
-
- - - {myNode?.deviceMetrics?.voltage?.toPrecision(3) ?? "UNK"} volts - -
-
- - v{myMetadata?.firmwareVersion ?? "UNK"} +
+
+ + + {myNode?.deviceMetrics?.batteryLevel + ? myNode?.deviceMetrics?.batteryLevel > 100 + ? "Charging" + : `${myNode?.deviceMetrics?.batteryLevel}%` + : "UNK"} + +
+
+ + + {myNode?.deviceMetrics?.voltage?.toPrecision(3) ?? "UNK"} volts + +
+
+ + v{myMetadata?.firmwareVersion ?? "UNK"} +
-
- - {pages.map((link) => ( - { - setActivePage(link.page); - }} - active={link.page === activePage} - /> - ))} - - {children} -
- ) : ( -
- -
- ); + + {pages.map((link) => ( + { + setActivePage(link.page); + }} + active={link.page === activePage} + /> + ))} + + {children} +
+ ) + : ( +
+ +
+ ); }; diff --git a/src/components/ThemeSwitcher.tsx b/src/components/ThemeSwitcher.tsx index a4fa2f8a..c662eda2 100644 --- a/src/components/ThemeSwitcher.tsx +++ b/src/components/ThemeSwitcher.tsx @@ -1,5 +1,5 @@ -import { useTheme } from "@app/core/hooks/useTheme"; -import { cn } from "@app/core/utils/cn"; +import { useTheme } from "../core/hooks/useTheme.ts"; +import { cn } from "../core/utils/cn.ts"; import { Monitor, Moon, Sun } from "lucide-react"; type ThemePreference = "light" | "dark" | "system"; @@ -32,11 +32,9 @@ export default function ThemeSwitcher({ className, )} onClick={toggleTheme} - aria-label={ - preference === "system" - ? `System theme (currently ${theme}). Click to change theme.` - : `Current theme: ${theme}. Click to change theme.` - } + aria-label={preference === "system" + ? `System theme (currently ${theme}). Click to change theme.` + : `Current theme: ${theme}. Click to change theme.`} > {themeIcons[preference]} diff --git a/src/components/Toaster.tsx b/src/components/Toaster.tsx index d50ba3b8..b42044bb 100644 --- a/src/components/Toaster.tsx +++ b/src/components/Toaster.tsx @@ -5,8 +5,8 @@ import { ToastProvider, ToastTitle, ToastViewport, -} from "@components/UI/Toast"; -import { useToast } from "@core/hooks/useToast"; +} from "./UI/Toast.tsx"; +import { useToast } from "../core/hooks/useToast.ts"; export function Toaster() { const { toasts } = useToast(); diff --git a/src/components/UI/Avatar.tsx b/src/components/UI/Avatar.tsx index bbb21cb2..4b8b94cb 100644 --- a/src/components/UI/Avatar.tsx +++ b/src/components/UI/Avatar.tsx @@ -1,4 +1,4 @@ -import { cn } from "@app/core/utils/cn"; +import { cn } from "../../core/utils/cn.ts"; import type React from "react"; type RGBColor = { diff --git a/src/components/UI/Button.tsx b/src/components/UI/Button.tsx index 924f7b34..5c4bde4c 100644 --- a/src/components/UI/Button.tsx +++ b/src/components/UI/Button.tsx @@ -1,4 +1,4 @@ -import { type VariantProps, cva } from "class-variance-authority"; +import { cva, type VariantProps } from "class-variance-authority"; import * as React from "react"; import { cn } from "@core/utils/cn.ts"; @@ -20,7 +20,8 @@ const buttonVariants = cva( "bg-slate-100 text-slate-700 hover:bg-slate-200 dark:bg-slate-500 dark:text-white dark:hover:bg-slate-400", ghost: "bg-transparent hover:bg-slate-100 dark:hover:bg-slate-800 dark:text-slate-100 dark:hover:text-slate-100 data-[state=open]:bg-transparent dark:data-[state=open]:bg-transparent", - link: "bg-transparent underline-offset-4 hover:underline text-slate-900 dark:text-slate-100 hover:bg-transparent dark:hover:bg-transparent", + link: + "bg-transparent underline-offset-4 hover:underline text-slate-900 dark:text-slate-100 hover:bg-transparent dark:hover:bg-transparent", }, size: { default: "h-10 py-2 px-4", @@ -38,7 +39,8 @@ const buttonVariants = cva( export type ButtonVariant = VariantProps["variant"]; export interface ButtonProps - extends React.ButtonHTMLAttributes, + extends + React.ButtonHTMLAttributes, VariantProps {} const Button = React.forwardRef( diff --git a/src/components/UI/Command.tsx b/src/components/UI/Command.tsx index b700782e..3173179c 100644 --- a/src/components/UI/Command.tsx +++ b/src/components/UI/Command.tsx @@ -144,11 +144,11 @@ CommandShortcut.displayName = "CommandShortcut"; export { Command, CommandDialog, - CommandInput, - CommandList, CommandEmpty, CommandGroup, + CommandInput, CommandItem, - CommandShortcut, + CommandList, CommandSeparator, + CommandShortcut, }; diff --git a/src/components/UI/Dialog.tsx b/src/components/UI/Dialog.tsx index 23f7143d..bf580a79 100644 --- a/src/components/UI/Dialog.tsx +++ b/src/components/UI/Dialog.tsx @@ -23,7 +23,7 @@ DialogPortal.displayName = DialogPrimitive.Portal.displayName; const DialogOverlay = React.forwardRef< React.ElementRef, React.ComponentPropsWithoutRef ->(({ className, children, ...props }, ref) => ( +>(({ className, ...props }, ref) => ( {} const Footer = React.forwardRef( - ({ className, ...props }, ref) => { + ({ className, ...props }) => { return ( -
-
-
-
- - - ); - })} - - ) : ( -
- -

No Devices

- Connect at least one device to get started - -
- )} + + + ); + })} + + ) + : ( +
+ +

No Devices

+ Connect at least one device to get started + +
+ )}
diff --git a/src/pages/Map/index.tsx b/src/pages/Map/index.tsx index c1c484a5..a3ec823d 100644 --- a/src/pages/Map/index.tsx +++ b/src/pages/Map/index.tsx @@ -1,14 +1,13 @@ -import { NodeDetail } from "@app/components/PageComponents/Map/NodeDetail"; -import { Avatar } from "@app/components/UI/Avatar"; -import { useTheme } from "@app/core/hooks/useTheme"; +import { NodeDetail } from "../../components/PageComponents/Map/NodeDetail.tsx"; +import { Avatar } from "../../components/UI/Avatar.tsx"; +import { useTheme } from "../../core/hooks/useTheme.ts"; import { PageLayout } from "@components/PageLayout.tsx"; import { Sidebar } from "@components/Sidebar.tsx"; import { useDevice } from "@core/stores/deviceStore.ts"; import type { Protobuf } from "@meshtastic/core"; import { bbox, lineString } from "@turf/turf"; -import { current } from "immer"; import { MapPinIcon } from "lucide-react"; -import { type JSX, useCallback, useEffect, useMemo, useState } from "react"; +import { useCallback, useEffect, useMemo, useState } from "react"; import { AttributionControl, GeolocateControl, @@ -33,15 +32,16 @@ const convertToLatLng = (position: { longitude: (position.longitudeI ?? 0) / 1e7, }); -const MapPage = (): JSX.Element => { +const MapPage = () => { const { nodes, waypoints } = useDevice(); - const currentTheme = useTheme(); + const { theme } = useTheme(); const { default: map } = useMap(); - const darkMode = currentTheme === "dark"; + const darkMode = theme === "dark"; - const [selectedNode, setSelectedNode] = - useState(null); + const [selectedNode, setSelectedNode] = useState< + Protobuf.Mesh.NodeInfo | null + >(null); // Filter out nodes without a valid position const validNodes = useMemo( @@ -140,13 +140,12 @@ const MapPage = (): JSX.Element => { return ( <> - + { ))} {markers} - {selectedNode ? ( - setSelectedNode(null)} - > - - - ) : null} + {selectedNode + ? ( + setSelectedNode(null)} + > + + + ) + : null} diff --git a/src/pages/Messages.tsx b/src/pages/Messages.tsx index c4060804..b520f906 100644 --- a/src/pages/Messages.tsx +++ b/src/pages/Messages.tsx @@ -1,4 +1,4 @@ -import { useAppStore } from "@app/core/stores/appStore"; +import { useAppStore } from "../core/stores/appStore.ts"; import { ChannelChat } from "@components/PageComponents/Messages/ChannelChat.tsx"; import { PageLayout } from "@components/PageLayout.tsx"; import { Sidebar } from "@components/Sidebar.tsx"; @@ -10,12 +10,11 @@ import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf, Types } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; import { getChannelName } from "@pages/Channels.tsx"; -import { HashIcon, LockIcon, LockOpenIcon, WaypointsIcon } from "lucide-react"; +import { HashIcon, LockIcon, LockOpenIcon } from "lucide-react"; import { useState } from "react"; export const MessagesPage = () => { - const { channels, nodes, hardware, messages, traceroutes, connection } = - useDevice(); + const { channels, nodes, hardware, messages } = useDevice(); const { activeChat, chatType, setActiveChat, setChatType } = useAppStore(); const [searchTerm, setSearchTerm] = useState(""); const filteredNodes = Array.from(nodes.values()).filter((node) => { @@ -39,13 +38,11 @@ export const MessagesPage = () => { {filteredChannels.map((channel) => ( { setChatType("broadcast"); @@ -69,9 +66,8 @@ export const MessagesPage = () => { {filteredNodes.map((node) => ( { setChatType("direct"); @@ -94,32 +90,30 @@ export const MessagesPage = () => { chatType === "broadcast" && currentChannel ? getChannelName(currentChannel) : chatType === "direct" && nodes.get(activeChat) - ? (nodes.get(activeChat)?.user?.longName ?? nodeHex) - : "Loading..." + ? (nodes.get(activeChat)?.user?.longName ?? nodeHex) + : "Loading..." }`} - actions={ - chatType === "direct" - ? [ - { - icon: nodes.get(activeChat)?.user?.publicKey.length - ? LockIcon - : LockOpenIcon, - iconClasses: nodes.get(activeChat)?.user?.publicKey.length - ? "text-green-600" - : "text-yellow-300", - async onClick() { - const targetNode = nodes.get(activeChat)?.num; - if (targetNode === undefined) return; - toast({ - title: nodes.get(activeChat)?.user?.publicKey.length - ? "Chat is using PKI encryption." - : "Chat is using PSK encryption.", - }); - }, - }, - ] - : [] - } + actions={chatType === "direct" + ? [ + { + icon: nodes.get(activeChat)?.user?.publicKey.length + ? LockIcon + : LockOpenIcon, + iconClasses: nodes.get(activeChat)?.user?.publicKey.length + ? "text-green-600" + : "text-yellow-300", + onClick() { + const targetNode = nodes.get(activeChat)?.num; + if (targetNode === undefined) return; + toast({ + title: nodes.get(activeChat)?.user?.publicKey.length + ? "Chat is using PKI encryption." + : "Chat is using PSK encryption.", + }); + }, + }, + ] + : []} > {allChannels.map( (channel) => diff --git a/src/pages/Nodes.tsx b/src/pages/Nodes.tsx index 429fcbdd..dbcc6094 100644 --- a/src/pages/Nodes.tsx +++ b/src/pages/Nodes.tsx @@ -1,7 +1,7 @@ -import { LocationResponseDialog } from "@app/components/Dialog/LocationResponseDialog"; -import { NodeOptionsDialog } from "@app/components/Dialog/NodeOptionsDialog"; -import { TracerouteResponseDialog } from "@app/components/Dialog/TracerouteResponseDialog"; -import Footer from "@app/components/UI/Footer"; +import { LocationResponseDialog } from "../components/Dialog/LocationResponseDialog.tsx"; +import { NodeOptionsDialog } from "../components/Dialog/NodeOptionsDialog.tsx"; +import { TracerouteResponseDialog } from "../components/Dialog/TracerouteResponseDialog.tsx"; +import Footer from "../components/UI/Footer.tsx"; import { Sidebar } from "@components/Sidebar.tsx"; import { Avatar } from "@components/UI/Avatar.tsx"; import { Mono } from "@components/generic/Mono.tsx"; @@ -11,7 +11,7 @@ import { useDevice } from "@core/stores/deviceStore.ts"; import { Protobuf, type Types } from "@meshtastic/core"; import { numberToHexUnpadded } from "@noble/curves/abstract/utils"; import { LockIcon, LockOpenIcon } from "lucide-react"; -import { Fragment, type JSX, useCallback, useEffect, useState } from "react"; +import { Fragment, useCallback, useEffect, useState } from "react"; import { base16 } from "rfc4648"; export interface DeleteNoteDialogProps { @@ -19,7 +19,7 @@ export interface DeleteNoteDialogProps { onOpenChange: (open: boolean) => void; } -const NodesPage = (): JSX.Element => { +const NodesPage = () => { const { nodes, hardware, connection } = useDevice(); const [selectedNode, setSelectedNode] = useState< Protobuf.Mesh.NodeInfo | undefined @@ -107,9 +107,11 @@ const NodesPage = (): JSX.Element => { > {node.user?.shortName ?? (node.user?.macaddr - ? `${base16 + ? `${ + base16 .stringify(node.user?.macaddr.subarray(4, 6) ?? []) - .toLowerCase()}` + .toLowerCase() + }` : `${numberToHexUnpadded(node.num).slice(-4)}`)} , @@ -120,9 +122,11 @@ const NodesPage = (): JSX.Element => { > {node.user?.longName ?? (node.user?.macaddr - ? `Meshtastic ${base16 + ? `Meshtastic ${ + base16 .stringify(node.user?.macaddr.subarray(4, 6) ?? []) - .toLowerCase()}` + .toLowerCase() + }` : `!${numberToHexUnpadded(node.num)}`)} , @@ -136,11 +140,9 @@ const NodesPage = (): JSX.Element => { ?.join(":") ?? "UNK"} , - {node.lastHeard === 0 ? ( -

Never

- ) : ( - - )} + {node.lastHeard === 0 + ?

Never

+ : }
, {node.snr}db/ @@ -148,19 +150,17 @@ const NodesPage = (): JSX.Element => { {(node.snr + 10) * 5}raw , - {node.user?.publicKey && node.user?.publicKey.length > 0 ? ( - - ) : ( - - )} + {node.user?.publicKey && node.user?.publicKey.length > 0 + ? + : } , {node.lastHeard !== 0 ? node.viaMqtt === false && node.hopsAway === 0 ? "Direct" : `${node.hopsAway.toString()} ${ - node.hopsAway > 1 ? "hops" : "hop" - } away` + node.hopsAway > 1 ? "hops" : "hop" + } away` : "-"} {node.viaMqtt === true ? ", via MQTT" : ""} , diff --git a/src/validation/channel.ts b/src/validation/channel.ts index 6316ce4e..4f4d43bb 100644 --- a/src/validation/channel.ts +++ b/src/validation/channel.ts @@ -10,8 +10,7 @@ import { } from "class-validator"; export class ChannelValidation - implements Omit -{ + implements Omit { @IsNumber() index: number; @@ -22,8 +21,7 @@ export class ChannelValidation } export class Channel_SettingsValidation - implements Omit -{ + implements Omit { @IsNumber() channelNum: number; diff --git a/src/validation/config/bluetooth.ts b/src/validation/config/bluetooth.ts index e84d8f27..67492240 100644 --- a/src/validation/config/bluetooth.ts +++ b/src/validation/config/bluetooth.ts @@ -2,13 +2,11 @@ import type { Message } from "@bufbuild/protobuf"; import { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsEnum, IsInt } from "class-validator"; -export class BluetoothValidation - implements - Omit< - Protobuf.Config.Config_BluetoothConfig, - keyof Message | "deviceLoggingEnabled" - > -{ +export class BluetoothValidation implements + Omit< + Protobuf.Config.Config_BluetoothConfig, + keyof Message | "deviceLoggingEnabled" + > { @IsBoolean() enabled: boolean; diff --git a/src/validation/config/device.ts b/src/validation/config/device.ts index 5c79d583..0858e6a7 100644 --- a/src/validation/config/device.ts +++ b/src/validation/config/device.ts @@ -3,8 +3,7 @@ import { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsEnum, IsInt, IsString } from "class-validator"; export class DeviceValidation - implements Omit -{ + implements Omit { @IsEnum(Protobuf.Config.Config_DeviceConfig_Role) role: Protobuf.Config.Config_DeviceConfig_Role; diff --git a/src/validation/config/display.ts b/src/validation/config/display.ts index ed21d3f9..6f38164b 100644 --- a/src/validation/config/display.ts +++ b/src/validation/config/display.ts @@ -3,8 +3,7 @@ import { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsEnum, IsInt } from "class-validator"; export class DisplayValidation - implements Omit -{ + implements Omit { @IsInt() screenOnSecs: number; diff --git a/src/validation/config/lora.ts b/src/validation/config/lora.ts index 4fb5646a..ad70b586 100644 --- a/src/validation/config/lora.ts +++ b/src/validation/config/lora.ts @@ -4,8 +4,7 @@ import { IsArray, IsBoolean, IsEnum, IsInt, Max, Min } from "class-validator"; export class LoRaValidation implements - Omit -{ + Omit { @IsBoolean() usePreset: boolean; diff --git a/src/validation/config/network.ts b/src/validation/config/network.ts index 922f9563..f37796cc 100644 --- a/src/validation/config/network.ts +++ b/src/validation/config/network.ts @@ -11,8 +11,7 @@ import { export class NetworkValidation implements - Omit -{ + Omit { @IsBoolean() wifiEnabled: boolean; @@ -39,13 +38,11 @@ export class NetworkValidation rsyslogServer: string; } -export class NetworkValidationIpV4Config - implements - Omit< - Protobuf.Config.Config_NetworkConfig_IpV4Config, - keyof Message | "ip" | "gateway" | "subnet" | "dns" - > -{ +export class NetworkValidationIpV4Config implements + Omit< + Protobuf.Config.Config_NetworkConfig_IpV4Config, + keyof Message | "ip" | "gateway" | "subnet" | "dns" + > { @IsIP() @IsOptional() ip: string; diff --git a/src/validation/config/position.ts b/src/validation/config/position.ts index 97822bb4..84e67603 100644 --- a/src/validation/config/position.ts +++ b/src/validation/config/position.ts @@ -1,16 +1,14 @@ import type { Message } from "@bufbuild/protobuf"; import { Protobuf } from "@meshtastic/core"; -import { IsArray, IsBoolean, IsEnum, IsInt } from "class-validator"; +import { IsBoolean, IsEnum, IsInt } from "class-validator"; const DeprecatedPositionValidationFields = ["gpsEnabled", "gpsAttemptTime"]; -export class PositionValidation - implements - Omit< - Protobuf.Config.Config_PositionConfig, - keyof Message | (typeof DeprecatedPositionValidationFields)[number] - > -{ +export class PositionValidation implements + Omit< + Protobuf.Config.Config_PositionConfig, + keyof Message | (typeof DeprecatedPositionValidationFields)[number] + > { @IsInt() positionBroadcastSecs: number; diff --git a/src/validation/config/power.ts b/src/validation/config/power.ts index 0e1012d3..a83f5f15 100644 --- a/src/validation/config/power.ts +++ b/src/validation/config/power.ts @@ -2,10 +2,11 @@ import type { Message } from "@bufbuild/protobuf"; import type { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsInt, IsNumber, Max, Min } from "class-validator"; -export class PowerValidation - implements - Omit -{ +export class PowerValidation implements + Omit< + Protobuf.Config.Config_PowerConfig, + keyof Message | "powermonEnables" + > { @IsBoolean() isPowerSaving: boolean; diff --git a/src/validation/config/security.ts b/src/validation/config/security.ts index 0b9aa7d4..b856d521 100644 --- a/src/validation/config/security.ts +++ b/src/validation/config/security.ts @@ -2,13 +2,11 @@ import type { Message } from "@bufbuild/protobuf"; import type { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsString } from "class-validator"; -export class SecurityValidation - implements - Omit< - Protobuf.Config.Config_SecurityConfig, - keyof Message | "adminKey" | "privateKey" | "publicKey" - > -{ +export class SecurityValidation implements + Omit< + Protobuf.Config.Config_SecurityConfig, + keyof Message | "adminKey" | "privateKey" | "publicKey" + > { @IsBoolean() adminChannelEnabled: boolean; diff --git a/src/validation/moduleConfig/ambientLighting.ts b/src/validation/moduleConfig/ambientLighting.ts index 30801067..93124502 100644 --- a/src/validation/moduleConfig/ambientLighting.ts +++ b/src/validation/moduleConfig/ambientLighting.ts @@ -2,13 +2,11 @@ import type { Message } from "@bufbuild/protobuf"; import type { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsInt } from "class-validator"; -export class AmbientLightingValidation - implements - Omit< - Protobuf.ModuleConfig.ModuleConfig_AmbientLightingConfig, - keyof Message - > -{ +export class AmbientLightingValidation implements + Omit< + Protobuf.ModuleConfig.ModuleConfig_AmbientLightingConfig, + keyof Message + > { @IsBoolean() ledState: boolean; diff --git a/src/validation/moduleConfig/audio.ts b/src/validation/moduleConfig/audio.ts index 091350f7..b70e3dae 100644 --- a/src/validation/moduleConfig/audio.ts +++ b/src/validation/moduleConfig/audio.ts @@ -3,8 +3,8 @@ import { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsEnum, IsInt } from "class-validator"; export class AudioValidation - implements Omit -{ + implements + Omit { @IsBoolean() codec2Enabled: boolean; diff --git a/src/validation/moduleConfig/cannedMessage.ts b/src/validation/moduleConfig/cannedMessage.ts index 6701c553..2b70eaf5 100644 --- a/src/validation/moduleConfig/cannedMessage.ts +++ b/src/validation/moduleConfig/cannedMessage.ts @@ -2,10 +2,11 @@ import type { Message } from "@bufbuild/protobuf"; import { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsEnum, IsInt, Length } from "class-validator"; -export class CannedMessageValidation - implements - Omit -{ +export class CannedMessageValidation implements + Omit< + Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig, + keyof Message + > { @IsBoolean() rotary1Enabled: boolean; @@ -19,13 +20,16 @@ export class CannedMessageValidation inputbrokerPinPress: number; @IsEnum(Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar) - inputbrokerEventCw: Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar; + inputbrokerEventCw: + Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar; @IsEnum(Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar) - inputbrokerEventCcw: Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar; + inputbrokerEventCcw: + Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar; @IsEnum(Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar) - inputbrokerEventPress: Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar; + inputbrokerEventPress: + Protobuf.ModuleConfig.ModuleConfig_CannedMessageConfig_InputEventChar; @IsBoolean() updown1Enabled: boolean; diff --git a/src/validation/moduleConfig/detectionSensor.ts b/src/validation/moduleConfig/detectionSensor.ts index b6acaa98..b812df17 100644 --- a/src/validation/moduleConfig/detectionSensor.ts +++ b/src/validation/moduleConfig/detectionSensor.ts @@ -2,13 +2,11 @@ import type { Message } from "@bufbuild/protobuf"; import type { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsInt, Length } from "class-validator"; -export class DetectionSensorValidation - implements - Omit< - Protobuf.ModuleConfig.ModuleConfig_DetectionSensorConfig, - keyof Message - > -{ +export class DetectionSensorValidation implements + Omit< + Protobuf.ModuleConfig.ModuleConfig_DetectionSensorConfig, + keyof Message + > { @IsBoolean() enabled: boolean; diff --git a/src/validation/moduleConfig/externalNotification.ts b/src/validation/moduleConfig/externalNotification.ts index e7b9e044..5b68ffa3 100644 --- a/src/validation/moduleConfig/externalNotification.ts +++ b/src/validation/moduleConfig/externalNotification.ts @@ -2,13 +2,11 @@ import type { Message } from "@bufbuild/protobuf"; import type { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsInt } from "class-validator"; -export class ExternalNotificationValidation - implements - Omit< - Protobuf.ModuleConfig.ModuleConfig_ExternalNotificationConfig, - keyof Message - > -{ +export class ExternalNotificationValidation implements + Omit< + Protobuf.ModuleConfig.ModuleConfig_ExternalNotificationConfig, + keyof Message + > { @IsBoolean() enabled: boolean; diff --git a/src/validation/moduleConfig/mqtt.ts b/src/validation/moduleConfig/mqtt.ts index 79608610..44312c8e 100644 --- a/src/validation/moduleConfig/mqtt.ts +++ b/src/validation/moduleConfig/mqtt.ts @@ -8,13 +8,11 @@ import { Length, } from "class-validator"; -export class MqttValidation - implements - Omit< - Protobuf.ModuleConfig.ModuleConfig_MQTTConfig, - keyof Message | "mapReportSettings" - > -{ +export class MqttValidation implements + Omit< + Protobuf.ModuleConfig.ModuleConfig_MQTTConfig, + keyof Message | "mapReportSettings" + > { @IsBoolean() enabled: boolean; @@ -50,8 +48,7 @@ export class MqttValidation export class MqttValidationMapReportSettings implements - Omit -{ + Omit { @IsNumber() @IsOptional() publishIntervalSecs: number; diff --git a/src/validation/moduleConfig/neighborInfo.ts b/src/validation/moduleConfig/neighborInfo.ts index b81a04d6..513b8d7c 100644 --- a/src/validation/moduleConfig/neighborInfo.ts +++ b/src/validation/moduleConfig/neighborInfo.ts @@ -4,8 +4,7 @@ import { IsBoolean, IsInt } from "class-validator"; export class NeighborInfoValidation implements - Omit -{ + Omit { @IsBoolean() enabled: boolean; diff --git a/src/validation/moduleConfig/paxcounter.ts b/src/validation/moduleConfig/paxcounter.ts index 10d0ece0..6b3eeb9b 100644 --- a/src/validation/moduleConfig/paxcounter.ts +++ b/src/validation/moduleConfig/paxcounter.ts @@ -4,8 +4,7 @@ import { IsBoolean, IsInt } from "class-validator"; export class PaxcounterValidation implements - Omit -{ + Omit { @IsBoolean() enabled: boolean; diff --git a/src/validation/moduleConfig/rangeTest.ts b/src/validation/moduleConfig/rangeTest.ts index fa7a1feb..5debf256 100644 --- a/src/validation/moduleConfig/rangeTest.ts +++ b/src/validation/moduleConfig/rangeTest.ts @@ -4,8 +4,7 @@ import { IsBoolean, IsInt } from "class-validator"; export class RangeTestValidation implements - Omit -{ + Omit { @IsBoolean() enabled: boolean; diff --git a/src/validation/moduleConfig/serial.ts b/src/validation/moduleConfig/serial.ts index db69c7c5..c814a71b 100644 --- a/src/validation/moduleConfig/serial.ts +++ b/src/validation/moduleConfig/serial.ts @@ -4,8 +4,7 @@ import { IsBoolean, IsEnum, IsInt } from "class-validator"; export class SerialValidation implements - Omit -{ + Omit { @IsBoolean() enabled: boolean; diff --git a/src/validation/moduleConfig/storeForward.ts b/src/validation/moduleConfig/storeForward.ts index 39007de8..e539dd4b 100644 --- a/src/validation/moduleConfig/storeForward.ts +++ b/src/validation/moduleConfig/storeForward.ts @@ -2,13 +2,11 @@ import type { Message } from "@bufbuild/protobuf"; import type { Protobuf } from "@meshtastic/core"; import { IsBoolean, IsInt } from "class-validator"; -export class StoreForwardValidation - implements - Omit< - Protobuf.ModuleConfig.ModuleConfig_StoreForwardConfig, - keyof Message | "isServer" - > -{ +export class StoreForwardValidation implements + Omit< + Protobuf.ModuleConfig.ModuleConfig_StoreForwardConfig, + keyof Message | "isServer" + > { @IsBoolean() enabled: boolean; diff --git a/src/validation/moduleConfig/telemetry.ts b/src/validation/moduleConfig/telemetry.ts index 08cc3d70..921fb04a 100644 --- a/src/validation/moduleConfig/telemetry.ts +++ b/src/validation/moduleConfig/telemetry.ts @@ -4,8 +4,7 @@ import { IsBoolean, IsInt } from "class-validator"; export class TelemetryValidation implements - Omit -{ + Omit { @IsInt() deviceUpdateInterval: number;