{#if showConnectionModal && selectedRobot}
{modalType === 'consumer' ? 'Consumer Driver' : modalType === 'producer' ? 'Producer Drivers' : 'Manual Control'}
showConnectionModal = false} class="text-gray-400 hover:text-white" > ✕
{#if modalType === 'consumer'}
{ await selectedRobot?.setConsumer({ type: 'usb', baudRate: 1000000 }); showConnectionModal = false; }} class="w-full px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-md" > Connect USB Consumer
{ await selectedRobot?.setConsumer({ type: 'remote', url: settings.transportServerUrl.replace('http://', 'ws://').replace('https://', 'wss://'), robotId: selectedRobot.id }); showConnectionModal = false; }} class="w-full px-4 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-md" > Connect Transport Consumer
{:else if modalType === 'producer'}
{ await selectedRobot?.addProducer({ type: 'usb', baudRate: 1000000 }); showConnectionModal = false; }} class="w-full px-4 py-2 bg-green-600 hover:bg-green-700 text-white rounded-md" > Connect USB Producer
{ await selectedRobot?.addProducer({ type: 'remote', url: settings.transportServerUrl.replace('http://', 'ws://').replace('https://', 'wss://'), robotId: selectedRobot.id }); showConnectionModal = false; }} class="w-full px-4 py-2 bg-orange-600 hover:bg-orange-700 text-white rounded-md" > Connect Transport Producer
{:else}
Manual control interface would go here
{/if}
{#if modalType !== 'manual'} Note: USB connections will prompt for calibration if needed {/if}
{/if}