diff --git a/src/components/Connection.tsx b/src/components/Connection.tsx index 6534e607..66a6294d 100644 --- a/src/components/Connection.tsx +++ b/src/components/Connection.tsx @@ -1,7 +1,7 @@ import type React from 'react'; import { useEffect } from 'react'; -import { AnimatePresence, m } from 'framer-motion'; +import { m } from 'framer-motion'; import { BLE } from '@components/connection/BLE'; import { HTTP } from '@components/connection/HTTP'; @@ -49,92 +49,87 @@ export const Connection = (): JSX.Element => { }, [meshtasticState.ready, dispatch]); return ( - - {appState.connectionModalOpen && ( - { - dispatch(closeConnectionModal()); - }} - > -
-
-
- { + dispatch(setConnType(parseInt(e.target.value))); + }} + disabled={ + meshtasticState.deviceStatus === + Types.DeviceStatusEnum.DEVICE_CONNECTED + } + /> + {appState.connType === connType.HTTP && ( + + )} + {appState.connType === connType.BLE && ( + + )} + {appState.connType === connType.SERIAL && ( + + )} +
+
+
+
+ {meshtasticState.logs.length === 0 && ( +
+ - {appState.connType === connType.HTTP && ( - - )} - {appState.connType === connType.BLE && ( - - )} - {appState.connType === connType.SERIAL && ( - - )}
-
-
-
- {meshtasticState.logs.length === 0 && ( -
- + )} + {meshtasticState.logs + .filter((log) => { + return ![ + Types.Emitter.handleFromRadio, + Types.Emitter.handleMeshPacket, + Types.Emitter.sendPacket, + ].includes(log.emitter); + }) + .map((log, index) => ( +
+
+ {log.message}
- )} - {meshtasticState.logs - .filter((log) => { - return ![ - Types.Emitter.handleFromRadio, - Types.Emitter.handleMeshPacket, - Types.Emitter.sendPacket, - ].includes(log.emitter); - }) - .map((log, index) => ( -
-
- {log.message} -
-
- ))} -
-
+
+ ))}
- - )} - +
+
+
); }; diff --git a/src/components/connection/BLE.tsx b/src/components/connection/BLE.tsx index 94f649ae..66c79c3c 100644 --- a/src/components/connection/BLE.tsx +++ b/src/components/connection/BLE.tsx @@ -36,26 +36,31 @@ export const BLE = ({ connecting }: BLEProps): JSX.Element => { }); return ( -
- {bleDevices.map((device, index) => ( -
=> { - await setConnection(connType.BLE); - }} - className="flex justify-between rounded-md bg-gray-700 p-2 dark:text-white" - key={index} - > -
{device.name}
- => { - await setConnection(connType.BLE); - }} - icon={} - disabled={connecting} - /> -
- ))} + +
+ {bleDevices.length > 0 ? ( + bleDevices.map((device, index) => ( +
+
{device.name}
+ => { + await setConnection(connType.BLE); + }} + icon={} + disabled={connecting} + /> +
+ )) + ) : ( +
+

No previously connected devices found

+
+ )} +