diff --git a/src/components/NewDevice.tsx b/src/components/NewDevice.tsx index b1ac1264..fbc5f9e0 100644 --- a/src/components/NewDevice.tsx +++ b/src/components/NewDevice.tsx @@ -1,4 +1,4 @@ -import type React from "react"; +import React, { useState } from "react"; import { FiBluetooth, FiTerminal, FiWifi } from "react-icons/fi"; @@ -8,23 +8,26 @@ import { HTTP } from "./PageComponents/Connect/HTTP.js"; import { Serial } from "./PageComponents/Connect/Serial.js"; export const NewDevice = () => { - const tabs: TabType[] = [ + const [tabs, _setTabs] = useState([ { name: "BLE", icon: , element: BLE, + disabled: !navigator.bluetooth }, { name: "HTTP", icon: , element: HTTP, + disabled: false }, { name: "Serial", icon: , element: Serial, - }, - ]; + disabled: !navigator.serial + } + ]); return (
diff --git a/src/components/layout/page/TabbedContent.tsx b/src/components/layout/page/TabbedContent.tsx index 474630e6..86768d52 100644 --- a/src/components/layout/page/TabbedContent.tsx +++ b/src/components/layout/page/TabbedContent.tsx @@ -2,6 +2,7 @@ import type React from "react"; import { Fragment } from "react"; import { Tab } from "@headlessui/react"; +import { Mono } from "@app/components/Mono"; export interface TabType { name: string; @@ -50,7 +51,11 @@ export const TabbedContent = ({ {tabs.map((entry, index) => ( - + {!entry.disabled ? : ( + + This functionality is not supported in your browser. + + )} ))}