From bd8b218e0ff6db47eca495565c182b46af7cea02 Mon Sep 17 00:00:00 2001 From: heapwolf Date: Thu, 18 Apr 2024 16:30:03 +0200 Subject: [PATCH] fix tabs when project is closed, pass env to child ssc --- build.js | 4 ++++ socket.ini | 3 ++- src/css/component-editor.css | 4 ++++ src/index.js | 21 ++++++++++++++++++--- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/build.js b/build.js index 2c0bb82..71a96eb 100644 --- a/build.js +++ b/build.js @@ -56,6 +56,10 @@ async function main (argv) { } const target = process.env.PREFIX + if (!target) { + console.log('This script should not be run directly. It will be run by the SSC command.') + process.exit(0) + } const opts = { ...params, diff --git a/socket.ini b/socket.ini index c54864a..6a1868a 100644 --- a/socket.ini +++ b/socket.ini @@ -29,7 +29,7 @@ ; copy_map = src/mapping.ini ; An list of environment variables, separated by commas. -env = HOME, USER, TMPDIR, PWD, DEBUG, RESET +env = HOME, USER, TMPDIR, PWD, DEBUG, RESET, VERBOSE ; Advanced Compiler Settings (ie C++ compiler -02, -03, etc). flags = -O3 @@ -52,6 +52,7 @@ script = "node build.js" [env] DEV = true + [build.script] ; If true, it will pass build arguments to the build script. WARNING: this could be deprecated in the future. ; default value: false diff --git a/src/css/component-editor.css b/src/css/component-editor.css index 73a2ec5..54a3883 100644 --- a/src/css/component-editor.css +++ b/src/css/component-editor.css @@ -14,6 +14,10 @@ editor-tabs header.component::-webkit-scrollbar { display: none; } +editor-tabs.inset header { + padding-left: 80px; +} + editor-tabs .tab { display: flex; align-items: center; diff --git a/src/index.js b/src/index.js index b5711f3..fd13c70 100644 --- a/src/index.js +++ b/src/index.js @@ -480,7 +480,6 @@ class AppView extends Tonic { const args = [ 'build', '-r' - // TODO allow config for -w ] const coDevice = document.querySelector('#device') @@ -506,7 +505,8 @@ class AppView extends Tonic { term.info('Running new instance of app') const cwd = this.state.currentProject.id - const c = this.childprocess = await spawn('ssc', args, { cwd }) + const env = { SSC_PARENT_LOG_SOCKET: process.env.SSC_LOG_SOCKET } + const c = this.childprocess = await spawn('ssc', args, { cwd, env }) c.stdout.on('data', data => { term.writeln(Buffer.from(data).toString().trim()) @@ -638,7 +638,22 @@ class AppView extends Tonic { } case 'Toggle Project': { - document.querySelector('#split-editor').toggle('left') + const coSplit = document.querySelector('#split-editor') + coSplit.toggle('left') + + // + // if the project has been closed, we dont want the tabs to + // go under the traffic lights. + // + if (process.platform === 'darwin') { + const coTabs = document.querySelector('#editor-tabs') + if (coSplit.firstElementChild.style.visibility === 'hidden') { + coTabs.classList.add('inset') + } else { + coTabs.classList.remove('inset') + } + } + break }