From 55d727b47149fb6725a6fc9a19647d46b5c076c1 Mon Sep 17 00:00:00 2001 From: whtv <28059402+whtv@users.noreply.github.com> Date: Sat, 25 Dec 2021 23:39:40 +0100 Subject: [PATCH 1/6] Implement system menu --- Platform/Client/httpInterface.js | 5 + Platform/UI/AppPostLoader.js | 9 ++ Platform/WebServer/css/menu.css | 94 ++++++++++++++++++ Platform/WebServer/index.html | 3 +- .../SystemActionFunctions.js | 45 +++++++++ .../Function-Libraries/SystemActionSwitch.js | 42 ++++++++ .../UI/Spaces/Design-Space/Workspace.js | 79 +++++++++++++++ Projects/ProjectsMenu.json | 99 +++++++++++++++++++ Projects/ProjectsSchema.json | 5 + 9 files changed, 380 insertions(+), 1 deletion(-) create mode 100644 Platform/WebServer/css/menu.css create mode 100644 Projects/Foundations/UI/Function-Libraries/SystemActionFunctions.js create mode 100644 Projects/Foundations/UI/Function-Libraries/SystemActionSwitch.js create mode 100644 Projects/ProjectsMenu.json diff --git a/Platform/Client/httpInterface.js b/Platform/Client/httpInterface.js index 657a643e9c..8770c40800 100644 --- a/Platform/Client/httpInterface.js +++ b/Platform/Client/httpInterface.js @@ -2227,6 +2227,11 @@ exports.newHttpInterface = function newHttpInterface() { SA.projects.foundations.utilities.httpResponses.respondWithFile(path, httpResponse) } break + case 'ProjectsMenu': { + let path = global.env.PATH_TO_PROJECTS + '/' + 'ProjectsMenu.json' + SA.projects.foundations.utilities.httpResponses.respondWithFile(path, httpResponse) + } + break case 'ListSpaceFiles': { let fs = SA.nodeModules.fs let allFiles = [] diff --git a/Platform/UI/AppPostLoader.js b/Platform/UI/AppPostLoader.js index 9d5cccd813..7dfe23501b 100644 --- a/Platform/UI/AppPostLoader.js +++ b/Platform/UI/AppPostLoader.js @@ -24,6 +24,7 @@ function newAppPostLoader() { function onResponse(err, file) { UI.environment = JSON.parse(file) setupProjectsSchema() + setupProjectsMenu() } } @@ -36,6 +37,14 @@ function newAppPostLoader() { } } + function setupProjectsMenu() { + httpRequest(undefined, 'ProjectsMenu', onResponse) + + function onResponse(err, file) { + PROJECTS_MENU = JSON.parse(file) + } + } + function setupSchemas() { let totalWebServerCalls = 0 diff --git a/Platform/WebServer/css/menu.css b/Platform/WebServer/css/menu.css new file mode 100644 index 0000000000..2adf7ecb5d --- /dev/null +++ b/Platform/WebServer/css/menu.css @@ -0,0 +1,94 @@ +#topMenu { + position: fixed; + top: 0; + left: 200px; + z-index: 1; + font-family: 'Saira Condensed'; + font-weight: bold; + letter-spacing: 0.2px; +} + +nav il { + position: relative; + display: block; + opacity: 1; + cursor: pointer; +} + +nav > ul > il > a{ + background:rgb(0, 0, 0, 0); +} + +nav > ul > il > ul > il a{ + background:rgb(0, 0, 0, 0.5); +} + +nav il > ul { + padding: 0; + position: absolute; + pointer-events: none; +} + +nav > ul { + margin: 0; + display:flex; +} + +nav > ul > il { + pointer-events: all; + opacity: 1; + text-decoration: underline; +} + +ul il a { + white-space: nowrap; + display: block; +} + +il:hover > ul { + pointer-events: initial; +} + +il:hover > ul > il, +ul:hover > il { + opacity: 1; +} + +nav > ul > il il ul { + transform: translateX(100%); + top: 0; + right: 0; +} + +nav { + width: 80%; + margin: auto; +} + +nav a { + background:rgb(0, 0, 0, 0.5); + color:#FFF; + height: 38px; + margin: 0px 3px 3px 0px; + padding: 8px 10px; + box-sizing: border-box; + border-radius: 5px; + box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.5); + position: relative; + transition: 0.1s; +} + +nav a:hover { + background:rgb(2 149 170); + transition: 0.1s; +} + +nav > ul > il > ul > il { + transition: opacity 0.1s; + opacity: 0; +} + +il > ul > il > ul > il { + transition: opacity 0.1s; + opacity: 0; +} diff --git a/Platform/WebServer/index.html b/Platform/WebServer/index.html index 5eca7795da..d9898606aa 100644 --- a/Platform/WebServer/index.html +++ b/Platform/WebServer/index.html @@ -13,6 +13,7 @@ + @@ -305,7 +306,7 @@ - +