diff --git a/ui/arduino/main.css b/ui/arduino/main.css index cc0e95c..37fa561 100644 --- a/ui/arduino/main.css +++ b/ui/arduino/main.css @@ -273,7 +273,7 @@ button.small .icon { } #panel #drag-handle { - width: 100%; + flex-grow: 2; height: 100%; cursor: grab; } @@ -293,6 +293,19 @@ button.small .icon { background: #008184; } +.panel-bar #connection-status { + display: flex; + align-items: center; + gap: 10px; + color: white; +} + +.panel-bar #connection-status img { + width: 1.25em; + height: 1.25em; + filter: invert(1); +} + .panel-bar .term-operations { transition: opacity 0.15s; display: flex; diff --git a/ui/arduino/store.js b/ui/arduino/store.js index 09a373e..116c0dc 100644 --- a/ui/arduino/store.js +++ b/ui/arduino/store.js @@ -210,6 +210,20 @@ async function store(state, emitter) { emitter.emit('render') }) + emitter.on('connect', async () => { + try { + state.availablePorts = await getAvailablePorts() + } catch(e) { + console.error('Could not get available ports. ', e) + } + + if(state.availablePorts.length == 1) { + emitter.emit('select-port', state.availablePorts[0]) + } else { + emitter.emit('open-connection-dialog') + } + }) + // CODE EXECUTION emitter.on('run', async (onlySelected = false) => { log('run') diff --git a/ui/arduino/views/components/repl-panel.js b/ui/arduino/views/components/repl-panel.js index 3974d50..7a89fbd 100644 --- a/ui/arduino/views/components/repl-panel.js +++ b/ui/arduino/views/components/repl-panel.js @@ -13,6 +13,10 @@ function ReplPanel(state, emit) { return html`
+
+ +
${state.isConnected ? 'Connected to ' + state.connectedPort : ''}
+
emit('start-resizing-panel')} onmouseup=${() => emit('stop-resizing-panel')} diff --git a/ui/arduino/views/components/toolbar.js b/ui/arduino/views/components/toolbar.js index 70982b0..eff0731 100644 --- a/ui/arduino/views/components/toolbar.js +++ b/ui/arduino/views/components/toolbar.js @@ -16,7 +16,7 @@ function Toolbar(state, emit) { ${Button({ icon: state.isConnected ? 'connect.svg' : 'disconnect.svg', tooltip: state.isConnected ? `Disconnect (${metaKeyString}+Shift+D)` : `Connect (${metaKeyString}+Shift+C)`, - onClick: () => state.isConnected ? emit('disconnect') : emit('open-connection-dialog'), + onClick: () => state.isConnected ? emit('disconnect') : emit('connect'), active: state.isConnected })}