From 83d5d595d1e7815b34f110820f7504bdcae9c925 Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Mon, 22 Apr 2024 14:07:36 +0200 Subject: [PATCH 1/4] Make a component for overlays --- ui/arduino/index.html | 1 + ui/arduino/main.js | 31 +++++++++++++------------- ui/arduino/views/components/overlay.js | 16 +++++++++++++ 3 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 ui/arduino/views/components/overlay.js diff --git a/ui/arduino/index.html b/ui/arduino/index.html index 25f1967..8478cc7 100644 --- a/ui/arduino/index.html +++ b/ui/arduino/index.html @@ -30,6 +30,7 @@ + diff --git a/ui/arduino/main.js b/ui/arduino/main.js index f7d1ef7..c5e68e5 100644 --- a/ui/arduino/main.js +++ b/ui/arduino/main.js @@ -19,27 +19,26 @@ function App(state, emit) { ` } - let overlay = html`
` - - if (state.diskFiles == null) { - emit('load-disk-files') - overlay = html`

Loading files...

` + if (state.view == 'file-manager') { + return html` +
+ ${FileManagerView(state, emit)} + ${Overlay(state, emit)} +
+ ` + } else { + return html` +
+ ${EditorView(state, emit)} + ${Overlay(state, emit)} +
+ ` } - - if (state.isRemoving) overlay = html`

Removing...

` - if (state.isConnecting) overlay = html`

Connecting...

` - if (state.isLoadingFiles) overlay = html`

Loading files...

` - if (state.isSaving) overlay = html`

Saving file... ${state.savingProgress}

` - if (state.isTransferring) overlay = html`

Transferring file... ${state.transferringProgress}

` - - const view = state.view == 'editor' ? EditorView(state, emit) : FileManagerView(state, emit) return html`
- ${view} - ${overlay} + ${Overlay(state, emit)}
` - } window.addEventListener('load', () => { diff --git a/ui/arduino/views/components/overlay.js b/ui/arduino/views/components/overlay.js new file mode 100644 index 0000000..1b9389c --- /dev/null +++ b/ui/arduino/views/components/overlay.js @@ -0,0 +1,16 @@ +function Overlay(state, emit) { + let overlay = html`
` + + if (state.diskFiles == null) { + emit('load-disk-files') + overlay = html`

Loading files...

` + } + + if (state.isRemoving) overlay = html`

Removing...

` + if (state.isConnecting) overlay = html`

Connecting...

` + if (state.isLoadingFiles) overlay = html`

Loading files...

` + if (state.isSaving) overlay = html`

Saving file... ${state.savingProgress}

` + if (state.isTransferring) overlay = html`

Transferring file... ${state.transferringProgress}

` + + return overlay +} From 51430789fb87265627772181c824d1ee70fe9639 Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Mon, 22 Apr 2024 14:08:13 +0200 Subject: [PATCH 2/4] No need to use `await` here --- preload.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/preload.js b/preload.js index cce145f..05abf0c 100644 --- a/preload.js +++ b/preload.js @@ -13,10 +13,10 @@ const Serial = { return ports.filter(p => p.vendorId && p.productId) }, connect: async (path) => { - return await board.open(path) + return board.open(path) }, disconnect: async () => { - return await board.close() + return board.close() }, run: async (code) => { return board.run(code) From ec733cabcaf45640fff0c844995f354b0c35a7b6 Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Mon, 22 Apr 2024 14:08:42 +0200 Subject: [PATCH 3/4] Check if there is a `diskNavigationRoot` before refreshing files --- ui/arduino/main.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/arduino/main.js b/ui/arduino/main.js index c5e68e5..bf693df 100644 --- a/ui/arduino/main.js +++ b/ui/arduino/main.js @@ -48,7 +48,9 @@ window.addEventListener('load', () => { app.mount('#app') app.emitter.on('DOMContentLoaded', () => { - app.emitter.emit('refresh-files') + if (app.state.diskNavigationRoot) { + app.emitter.emit('refresh-files') + } }) }) From c13304ab21eff0beb2fe0940778c56718c55f2d6 Mon Sep 17 00:00:00 2001 From: Murilo Polese Date: Tue, 23 Apr 2024 09:26:57 +0200 Subject: [PATCH 4/4] Enable devtools on production --- backend/menu.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/backend/menu.js b/backend/menu.js index 3ee40a6..6b62cdf 100644 --- a/backend/menu.js +++ b/backend/menu.js @@ -4,7 +4,6 @@ const openAboutWindow = require('about-window').default module.exports = function registerMenu(win) { const isMac = process.platform === 'darwin' - const isDev = !app.isPackaged const template = [ ...(isMac ? [{ label: app.name, @@ -56,17 +55,13 @@ module.exports = function registerMenu(win) { label: 'View', submenu: [ { role: 'reload' }, + { role: 'toggleDevTools' }, { type: 'separator' }, { role: 'resetZoom' }, { role: 'zoomIn' }, { role: 'zoomOut' }, { type: 'separator' }, { role: 'togglefullscreen' }, - ...(isDev ? [ - { type: 'separator' }, - { role: 'toggleDevTools' }, - ]:[ - ]) ] }, { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy