diff --git a/src/App.tsx b/src/App.tsx index 07f3af0..4ac0285 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,5 @@ import { useState, useEffect, useCallback } from 'react'; import { useBrotherMachine } from './hooks/useBrotherMachine'; -import { MachineConnection } from './components/MachineConnection'; import { FileUpload } from './components/FileUpload'; import { PatternCanvas } from './components/PatternCanvas'; import { ProgressMonitor } from './components/ProgressMonitor'; @@ -10,7 +9,8 @@ import { PatternSummaryCard } from './components/PatternSummaryCard'; import type { PesPatternData } from './utils/pystitchConverter'; import { pyodideLoader } from './utils/pyodideLoader'; import { hasError } from './utils/errorCodeHelpers'; -import { canDeletePattern } from './utils/machineStateHelpers'; +import { canDeletePattern, getStateVisualInfo } from './utils/machineStateHelpers'; +import { CheckCircleIcon, BoltIcon, PauseCircleIcon, ExclamationTriangleIcon, ArrowPathIcon, XMarkIcon } from '@heroicons/react/24/solid'; import './App.css'; function App() { @@ -94,23 +94,67 @@ function App() { } } + // Get state visual info for header status badge + const stateVisual = getStateVisualInfo(machine.machineStatus); + const stateIcons = { + ready: CheckCircleIcon, + active: BoltIcon, + waiting: PauseCircleIcon, + complete: CheckCircleIcon, + interrupted: PauseCircleIcon, + error: ExclamationTriangleIcon, + }; + const StatusIcon = stateIcons[stateVisual.iconName]; + return (
-
-

SKiTCH Controller

- - {/* Workflow Stepper - Integrated in header when connected */} - {machine.isConnected && ( -
- +
+ {/* Machine Connection Status - Fixed width column */} +
+
+
+
+
+

SKiTCH Controller

+ {machine.isPolling && ( + + )} +
+
+

+ {machine.isConnected ? (machine.machineInfo?.serialNumber || 'Connected') : 'Not Connected'} +

+ {machine.isConnected && ( + <> + + + + {machine.machineStatusName} + + + )} +
- )} +
+ + {/* Workflow Stepper - Flexible width column */} +
+ +
@@ -155,18 +199,28 @@ function App() {
{/* Left Column - Controls */}
- {/* Machine Connection - Always visible */} - + {/* Connect Button - Show when disconnected */} + {!machine.isConnected && ( +
+
+
+ + + +
+
+

Get Started

+

Connect to your embroidery machine

+
+
+ +
+ )} {/* Pattern File - Show during upload stage (before pattern is uploaded) */} {machine.isConnected && !patternUploaded && ( diff --git a/src/components/MachineConnection.tsx b/src/components/MachineConnection.tsx index 61f7c77..b8b136a 100644 --- a/src/components/MachineConnection.tsx +++ b/src/components/MachineConnection.tsx @@ -85,8 +85,8 @@ export function MachineConnection({
-

Machine Connection

-

Not connected

+

Machine

+

Ready to connect

@@ -102,17 +102,10 @@ export function MachineConnection({
-
-

Machine Connected

- {isPolling && ( - - )} -
- {machineInfo && ( -

- {machineInfo.serialNumber} -

- )} +

Machine Info

+

+ {machineInfo?.modelNumber || 'Brother Embroidery Machine'} +