From cbcbafc4a35b21bf85eb28bff745b2c37300efe9 Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Sun, 2 Mar 2025 01:43:07 -0500 Subject: [PATCH] fix: added a notes fild to Dynamic form allowing for notes to inform users about using BLE and wifi at the same time. (#474) --- src/components/Form/DynamicForm.tsx | 3 +++ src/components/PageComponents/Config/Bluetooth.tsx | 4 +++- src/components/PageComponents/Config/Network.tsx | 4 +++- src/components/PageComponents/Connect/Serial.tsx | 11 +++++++---- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/components/Form/DynamicForm.tsx b/src/components/Form/DynamicForm.tsx index e883b004..f3977355 100644 --- a/src/components/Form/DynamicForm.tsx +++ b/src/components/Form/DynamicForm.tsx @@ -27,6 +27,7 @@ export interface BaseFormBuilderProps { disabledBy?: DisabledBy[]; label: string; description?: string; + notes?: string; validationText?: string; properties?: Record; } @@ -45,6 +46,7 @@ export interface DynamicFormProps { fieldGroups: { label: string; description: string; + notes?: string; valid?: boolean; validationText?: string; fields: FieldProps[]; @@ -96,6 +98,7 @@ export function DynamicForm({

{fieldGroup.label}

{fieldGroup.description} + {fieldGroup?.notes}
{fieldGroup.fields.map((field) => { diff --git a/src/components/PageComponents/Config/Bluetooth.tsx b/src/components/PageComponents/Config/Bluetooth.tsx index 97a38fd0..47327d9c 100644 --- a/src/components/PageComponents/Config/Bluetooth.tsx +++ b/src/components/PageComponents/Config/Bluetooth.tsx @@ -70,7 +70,9 @@ export const Bluetooth = () => { fieldGroups={[ { label: "Bluetooth Settings", - description: "Settings for the Bluetooth module", + description: "Settings for the Bluetooth module ", + notes: + "Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.", fields: [ { type: "toggle", diff --git a/src/components/PageComponents/Config/Network.tsx b/src/components/PageComponents/Config/Network.tsx index 42d724d8..1c991cb4 100644 --- a/src/components/PageComponents/Config/Network.tsx +++ b/src/components/PageComponents/Config/Network.tsx @@ -8,7 +8,7 @@ import { } from "@core/utils/ip.ts"; import { Protobuf } from "@meshtastic/core"; -export const Network = (): JSX.Element => { +export const Network = () => { const { config, setWorkingConfig } = useDevice(); const onSubmit = (data: NetworkValidation) => { @@ -53,6 +53,8 @@ export const Network = (): JSX.Element => { { label: "WiFi Config", description: "WiFi radio configuration", + notes: + "Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.", fields: [ { type: "toggle", diff --git a/src/components/PageComponents/Connect/Serial.tsx b/src/components/PageComponents/Connect/Serial.tsx index f5288403..45444c37 100644 --- a/src/components/PageComponents/Connect/Serial.tsx +++ b/src/components/PageComponents/Connect/Serial.tsx @@ -18,7 +18,9 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => { setSerialPorts(await navigator?.serial.getPorts()); }, []); - navigator?.serial?.addEventListener("connect", () => { + navigator?.serial?.addEventListener("connect", (event) => { + console.log(event); + updateSerialPortList(); }); navigator?.serial?.addEventListener("disconnect", () => { @@ -45,6 +47,8 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => {
{serialPorts.map((port, index) => { + console.log(port); + const { usbProductId, usbVendorId } = port.getInfo(); return ( ); })}