fix: changed position of error message, disabled buttons when error is showing

This commit is contained in:
Dan Ditomaso
2025-01-19 22:42:38 -05:00
parent 225d6055d4
commit ebb32f0893
3 changed files with 15 additions and 26 deletions
@@ -14,13 +14,13 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => {
const { setSelectedDevice } = useAppStore();
const updateSerialPortList = useCallback(async () => {
setSerialPorts(await navigator.serial.getPorts());
setSerialPorts(await navigator?.serial.getPorts());
}, []);
navigator.serial.addEventListener("connect", () => {
navigator?.serial?.addEventListener("connect", () => {
updateSerialPortList();
});
navigator.serial.addEventListener("disconnect", () => {
navigator?.serial?.addEventListener("disconnect", () => {
updateSerialPortList();
});
useEffect(() => {
@@ -58,9 +58,8 @@ export const Serial = ({ closeDialog }: TabElementProps): JSX.Element => {
await onConnect(port);
}}
>
{`# ${index} - ${usbVendorId ?? "UNK"} - ${
usbProductId ?? "UNK"
}`}
{`# ${index} - ${usbVendorId ?? "UNK"} - ${usbProductId ?? "UNK"
}`}
</Button>
);
})}