{#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 rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700" > 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 rounded-md bg-purple-600 px-4 py-2 text-white hover:bg-purple-700" > Connect Transport Consumer
{:else if modalType === "producer"}
{ await selectedRobot?.addProducer({ type: "usb", baudRate: 1000000 }); showConnectionModal = false; }} class="w-full rounded-md bg-green-600 px-4 py-2 text-white hover:bg-green-700" > 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 rounded-md bg-orange-600 px-4 py-2 text-white hover:bg-orange-700" > 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}