Skip to content

Commit cbcbafc

Browse files
authored
fix: added a notes fild to Dynamic form allowing for notes to inform users about using BLE and wifi at the same time. (meshtastic#474)
1 parent 7e66dc7 commit cbcbafc

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/components/Form/DynamicForm.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface BaseFormBuilderProps<T> {
2727
disabledBy?: DisabledBy<T>[];
2828
label: string;
2929
description?: string;
30+
notes?: string;
3031
validationText?: string;
3132
properties?: Record<string, unknown>;
3233
}
@@ -45,6 +46,7 @@ export interface DynamicFormProps<T extends FieldValues> {
4546
fieldGroups: {
4647
label: string;
4748
description: string;
49+
notes?: string;
4850
valid?: boolean;
4951
validationText?: string;
5052
fields: FieldProps<T>[];
@@ -96,6 +98,7 @@ export function DynamicForm<T extends FieldValues>({
9698
<div>
9799
<H4 className="font-medium">{fieldGroup.label}</H4>
98100
<Subtle>{fieldGroup.description}</Subtle>
101+
<Subtle className="font-semibold">{fieldGroup?.notes}</Subtle>
99102
</div>
100103

101104
{fieldGroup.fields.map((field) => {

src/components/PageComponents/Config/Bluetooth.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export const Bluetooth = () => {
7070
fieldGroups={[
7171
{
7272
label: "Bluetooth Settings",
73-
description: "Settings for the Bluetooth module",
73+
description: "Settings for the Bluetooth module ",
74+
notes:
75+
"Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.",
7476
fields: [
7577
{
7678
type: "toggle",

src/components/PageComponents/Config/Network.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
} from "@core/utils/ip.ts";
99
import { Protobuf } from "@meshtastic/core";
1010

11-
export const Network = (): JSX.Element => {
11+
export const Network = () => {
1212
const { config, setWorkingConfig } = useDevice();
1313

1414
const onSubmit = (data: NetworkValidation) => {
@@ -53,6 +53,8 @@ export const Network = (): JSX.Element => {
5353
{
5454
label: "WiFi Config",
5555
description: "WiFi radio configuration",
56+
notes:
57+
"Note: Some devices (ESP32) cannot use both Bluetooth and WiFi at the same time.",
5658
fields: [
5759
{
5860
type: "toggle",

src/components/PageComponents/Connect/Serial.tsx

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => {
1818
setSerialPorts(await navigator?.serial.getPorts());
1919
}, []);
2020

21-
navigator?.serial?.addEventListener("connect", () => {
21+
navigator?.serial?.addEventListener("connect", (event) => {
22+
console.log(event);
23+
2224
updateSerialPortList();
2325
});
2426
navigator?.serial?.addEventListener("disconnect", () => {
@@ -45,6 +47,8 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => {
4547
<div className="flex w-full flex-col gap-2 p-4">
4648
<div className="flex h-48 flex-col gap-2 overflow-y-auto">
4749
{serialPorts.map((port, index) => {
50+
console.log(port);
51+
4852
const { usbProductId, usbVendorId } = port.getInfo();
4953
return (
5054
<Button
@@ -55,9 +59,8 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => {
5559
await onConnect(port);
5660
}}
5761
>
58-
{`# ${index} - ${usbVendorId ?? "UNK"} - ${
59-
usbProductId ?? "UNK"
60-
}`}
62+
{`# ${index} - ${usbVendorId ?? "UNK"} - ${usbProductId ?? "UNK"
63+
}`}
6164
</Button>
6265
);
6366
})}

0 commit comments

Comments
 (0)