diff --git a/.github/workflows/autolabel.yaml b/.github/workflows/autolabel.yaml index 87b97c4..eabe804 100644 --- a/.github/workflows/autolabel.yaml +++ b/.github/workflows/autolabel.yaml @@ -1,3 +1,5 @@ +name: Autolabel + on: pull_request: types: [opened, reopened, synchronize] diff --git a/src/App.tsx b/src/App.tsx index c2e8c7f..3c5524a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -12,6 +12,7 @@ import { BluetoothDevicePicker } from './components/BluetoothDevicePicker'; import { getErrorDetails } from './utils/errorCodeHelpers'; import { getStateVisualInfo } from './utils/machineStateHelpers'; import { CheckCircleIcon, BoltIcon, PauseCircleIcon, ExclamationTriangleIcon, ArrowPathIcon, XMarkIcon, InformationCircleIcon } from '@heroicons/react/24/solid'; +import { isBluetoothSupported } from './utils/bluetoothSupport'; import './App.css'; function App() { @@ -333,27 +334,60 @@ function App() {
{/* Left Column - Controls */}
- {/* Connect Button - Show when disconnected */} + {/* Connect Button or Browser Hint - Show when disconnected */} {!isConnected && ( -
-
-
- - - + <> + {isBluetoothSupported() ? ( +
+
+
+ + + +
+
+

Get Started

+

Connect to your embroidery machine

+
+
+
-
-

Get Started

-

Connect to your embroidery machine

+ ) : ( +
+
+ +
+

Browser Not Supported

+

+ Your browser doesn't support Web Bluetooth, which is required to connect to your embroidery machine. +

+
+

Please try one of these options:

+
    +
  • Use a supported browser (Chrome, Edge, or Opera)
  • +
  • + Download the Desktop app from{' '} + + GitHub Releases + +
  • +
+
+
+
-
- -
+ )} + )} {/* Pattern File - Show during upload stage (before pattern is uploaded) */} diff --git a/src/utils/bluetoothSupport.ts b/src/utils/bluetoothSupport.ts new file mode 100644 index 0000000..eb87b7d --- /dev/null +++ b/src/utils/bluetoothSupport.ts @@ -0,0 +1,17 @@ +/** + * Check if the current browser/environment supports Web Bluetooth API + * @returns true if Web Bluetooth is supported (or running in Electron), false otherwise + */ +export function isBluetoothSupported(): boolean { + // Always supported in Electron app + if (typeof window !== "undefined" && "electronAPI" in window) { + return true; + } + + // Check for Web Bluetooth API support in browser + if (typeof navigator !== "undefined" && "bluetooth" in navigator) { + return true; + } + + return false; +}