From ccbbe960c14cbdb71ca2175f3f747b868acb278b Mon Sep 17 00:00:00 2001 From: mchilli Date: Fri, 13 Oct 2023 18:51:09 +0200 Subject: [PATCH] add description under button icons --- webui/css/style.css | 2 +- webui/css/style.min.css | 2 +- webui/js/main.js | 91 +++++++++++++++++++++++++++++++++++------ webui/scss/style.scss | 2 +- 4 files changed, 81 insertions(+), 16 deletions(-) diff --git a/webui/css/style.css b/webui/css/style.css index b52119a..95e33a5 100644 --- a/webui/css/style.css +++ b/webui/css/style.css @@ -8392,7 +8392,7 @@ body { .main-container .key-entries-controls .info { display: flex; flex-direction: column; - justify-content: center; + justify-content: space-evenly; align-items: center; width: 100px; height: 50px; diff --git a/webui/css/style.min.css b/webui/css/style.min.css index e1cde32..463973c 100644 --- a/webui/css/style.min.css +++ b/webui/css/style.min.css @@ -6,4 +6,4 @@ * Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) * Copyright 2023 Fonticons, Inc. - */:root,:host{--fa-style-family-classic: "Font Awesome 6 Free";--fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free"}@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:block;src:url("../webfonts/fa-solid-900.woff2") format("woff2"),url("../webfonts/fa-solid-900.ttf") format("truetype")}.fas,.fa-solid{font-weight:900}:root{font-family:monospace;user-select:none}body{margin:10px;background-color:#fff;color:#404040}.hidden{display:none !important}.invisible{visibility:hidden !important}.button{cursor:pointer}.github-corner:active,.github-corner:visited,.github-corner svg{fill:#404040;color:#fff}.main-container{display:flex;flex-direction:column;align-items:center}.main-container .key-entries{display:grid;grid-template-columns:repeat(3, 1fr);gap:10px;margin-bottom:5px;padding:5px;max-height:320px;overflow:hidden}.main-container .key-entries .key-container{display:grid;grid-template-rows:max-content 1fr max-content;width:100px;height:100px;border-top:1px solid rgba(128,128,128,.7490196078);border-left:1px solid rgba(128,128,128,.7490196078);border-radius:10px;box-sizing:border-box;box-shadow:3px 3px 2px 1px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container.blank{background-color:rgba(0,0,0,0) !important}.main-container .key-entries .key-container .key-type-icon{grid-row:1;cursor:help;background-color:#fff;border-radius:10px 0 10px 0;padding:0 2px 0 0;box-shadow:inset 1px 1px 2px 0px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container .key-handle{justify-self:end;grid-row:1;cursor:grab;background-color:#fff;border-radius:0 10px 0 10px;padding:0 0 0 2px;box-shadow:inset 1px 1px 2px 0px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container.blank .key-label{display:none}.main-container .key-entries .key-container .key-label{grid-row:2;grid-column:1/3;justify-self:center;align-self:center;font-weight:bold;word-break:break-all;background-color:#fff;border-radius:10px;padding:2px 6px;box-shadow:inset 1px 1px 2px 0px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container .key-controls{display:flex;grid-row:3;grid-column:1/3;justify-self:end;background-color:#fff;border-radius:10px 0 10px 0;padding:2px 0 0 2px;box-shadow:inset 1px 1px 2px 0px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container .key-controls .button.edit:hover{color:#4fc1e9}.main-container .key-entries .key-container .key-controls .button.open:hover{color:#add468}.main-container .key-entries .key-container .key-controls .button.delete:hover{color:#fc6e51}.main-container .key-entries .key-container .key-type-icon,.main-container .key-entries .key-container .button{width:22px;height:22px;display:flex;justify-content:center;align-items:center}.main-container .key-entries .key-container.blank .button.delete{display:none}.main-container .key-entries .key-container.blank .button.open,.main-container .key-entries .key-container.macro .button.open{display:none}.main-container .key-entries .key-container:nth-child(9n){margin-bottom:50px}.main-container .app-controls,.main-container .device-controls,.main-container .key-entries-controls{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin-bottom:10px}.main-container .app-controls .button,.main-container .app-controls .info,.main-container .device-controls .button,.main-container .device-controls .info,.main-container .key-entries-controls .button,.main-container .key-entries-controls .info{display:flex;flex-direction:column;justify-content:center;align-items:center;width:100px;height:50px;box-sizing:border-box;align-self:flex-end;user-select:none;word-break:break-word}.main-container .app-controls .button,.main-container .device-controls .button,.main-container .key-entries-controls .button{position:relative;background-color:#4fc1e9;border:1px solid gray}.main-container .app-controls .button i,.main-container .device-controls .button i,.main-container .key-entries-controls .button i{pointer-events:none}.dialog-container{position:absolute;top:0;left:0;height:100%;width:100%}.dialog-container::before{display:block;height:100%;width:100%;content:"";background-color:#fff;opacity:.5;backdrop-filter:blur(1px)}.dialog-container .dialog{display:grid;grid-auto-columns:auto 40px;column-gap:4px;position:absolute;width:fit-content;min-width:320px;background-color:#fff;border:1px solid rgba(128,128,128,.7490196078);border-radius:4px;box-sizing:border-box;box-shadow:5px 5px 4px 2px rgba(128,128,128,.7490196078);overflow:auto}.dialog-container .dialog .dialog-header{grid-row:1;grid-column:1/3;display:grid;align-items:center;justify-content:center;height:40px;background-color:#404040;color:#fff;font-weight:bold;font-size:large;cursor:move}.dialog-container .dialog .dialog-prompt{grid-row:2;grid-column:1;max-width:265px;margin:4px}.dialog-container .dialog .dialog-inputs{grid-row:2;grid-column:1/3;display:grid;align-items:start;row-gap:4px;margin-left:4px;margin-top:4px}.dialog-container .dialog .dialog-inputs .dialog-type-input,.dialog-container .dialog .dialog-inputs .dialog-label-input{margin-right:44px}.dialog-container .dialog .dialog-inputs .dialog-details summary{cursor:pointer}.dialog-container .dialog .dialog-inputs .dialog-macros{display:grid;grid-template-columns:1fr 40px;gap:4px}.dialog-container .dialog .dialog-inputs .dialog-macros .dialog-sortable{display:grid;gap:4px;background-color:#fff;border:1px solid gray;box-sizing:border-box;padding:4px;max-height:174px;overflow:auto}.dialog-container .dialog .dialog-inputs .dialog-macros .dialog-sortable .macro-entry-container{display:flex;gap:4px;align-items:center;height:30px;padding:4px;background-color:#add468;border:1px solid gray;border-radius:5px;box-sizing:border-box}.dialog-container .dialog .dialog-inputs .dialog-macros .dialog-sortable .macro-entry-container .macro-entry-handle{cursor:grab}.dialog-container .dialog .dialog-inputs .dialog-macros .dialog-sortable .macro-entry-container .macro-entry-additionals{margin:0 0 0 auto;cursor:pointer}.dialog-container .dialog.blank .dialog-inputs .dialog-label,.dialog-container .dialog.blank .dialog-inputs .dialog-color,.dialog-container .dialog.blank .dialog-inputs .dialog-content,.dialog-container .dialog.blank .dialog-inputs .dialog-encoder,.dialog-container .dialog.group .dialog-inputs .dialog-content,.dialog-container .dialog.macro .dialog-inputs .dialog-encoder{display:none}.dialog-container .dialog .dialog-button{border:1px solid gray}.dialog-container .dialog .dialog-button.close{grid-row:1;grid-column:2;border:none;border-bottom:1px solid gray;border-left:1px solid gray}.dialog-container .dialog .dialog-button.ok{grid-row:3;grid-column:2;margin-top:4px;border:none;border-top:1px solid gray;border-left:1px solid gray}.notification-container{display:flex;flex-direction:column-reverse;position:absolute;right:0;bottom:0}.notification-container .notification{display:grid;grid-auto-columns:auto 40px;align-items:center;position:relative;min-height:40px;background-color:#404040;border:1px solid gray;border-radius:4px;box-sizing:border-box;overflow:hidden}.notification-container .notification.info{background-color:#4fc1e9}.notification-container .notification.success{background-color:#add468}.notification-container .notification.warning{background-color:#ffce54}.notification-container .notification.error{background-color:#fc6e51}.notification-container .notification .notification-message{padding:0 10px}.notification-container .notification .dialog-button.close{border-left:1px solid gray}.dialog-container .dialog-button,.notification-container .dialog-button{display:flex;justify-content:center;align-items:center;position:relative;width:40px;height:40px;background-color:#fff;box-sizing:border-box;cursor:pointer}.dialog-container .dialog-button.close,.notification-container .dialog-button.close{grid-row:1;grid-column:2;background-color:#fc6e51}.dialog-container .dialog-button.ok,.notification-container .dialog-button.ok{grid-row:3;grid-column:2;background-color:#4fc1e9;margin-top:4px}.main-container .app-controls .button:hover:after,.main-container .device-controls .button:hover:after,.main-container .key-entries-controls .button:hover:after,.dialog-container .dialog-button:hover:after,.notification-container .dialog-button:hover:after{display:block;content:"";width:100%;height:100%;position:absolute;box-shadow:inset 0px 0px 5px 2px rgba(128,128,128,.7490196078)} \ No newline at end of file + */:root,:host{--fa-style-family-classic: "Font Awesome 6 Free";--fa-font-solid: normal 900 1em/1 "Font Awesome 6 Free"}@font-face{font-family:"Font Awesome 6 Free";font-style:normal;font-weight:900;font-display:block;src:url("../webfonts/fa-solid-900.woff2") format("woff2"),url("../webfonts/fa-solid-900.ttf") format("truetype")}.fas,.fa-solid{font-weight:900}:root{font-family:monospace;user-select:none}body{margin:10px;background-color:#fff;color:#404040}.hidden{display:none !important}.invisible{visibility:hidden !important}.button{cursor:pointer}.github-corner:active,.github-corner:visited,.github-corner svg{fill:#404040;color:#fff}.main-container{display:flex;flex-direction:column;align-items:center}.main-container .key-entries{display:grid;grid-template-columns:repeat(3, 1fr);gap:10px;margin-bottom:5px;padding:5px;max-height:320px;overflow:hidden}.main-container .key-entries .key-container{display:grid;grid-template-rows:max-content 1fr max-content;width:100px;height:100px;border-top:1px solid rgba(128,128,128,.7490196078);border-left:1px solid rgba(128,128,128,.7490196078);border-radius:10px;box-sizing:border-box;box-shadow:3px 3px 2px 1px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container.blank{background-color:rgba(0,0,0,0) !important}.main-container .key-entries .key-container .key-type-icon{grid-row:1;cursor:help;background-color:#fff;border-radius:10px 0 10px 0;padding:0 2px 0 0;box-shadow:inset 1px 1px 2px 0px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container .key-handle{justify-self:end;grid-row:1;cursor:grab;background-color:#fff;border-radius:0 10px 0 10px;padding:0 0 0 2px;box-shadow:inset 1px 1px 2px 0px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container.blank .key-label{display:none}.main-container .key-entries .key-container .key-label{grid-row:2;grid-column:1/3;justify-self:center;align-self:center;font-weight:bold;word-break:break-all;background-color:#fff;border-radius:10px;padding:2px 6px;box-shadow:inset 1px 1px 2px 0px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container .key-controls{display:flex;grid-row:3;grid-column:1/3;justify-self:end;background-color:#fff;border-radius:10px 0 10px 0;padding:2px 0 0 2px;box-shadow:inset 1px 1px 2px 0px rgba(128,128,128,.7490196078)}.main-container .key-entries .key-container .key-controls .button.edit:hover{color:#4fc1e9}.main-container .key-entries .key-container .key-controls .button.open:hover{color:#add468}.main-container .key-entries .key-container .key-controls .button.delete:hover{color:#fc6e51}.main-container .key-entries .key-container .key-type-icon,.main-container .key-entries .key-container .button{width:22px;height:22px;display:flex;justify-content:center;align-items:center}.main-container .key-entries .key-container.blank .button.delete{display:none}.main-container .key-entries .key-container.blank .button.open,.main-container .key-entries .key-container.macro .button.open{display:none}.main-container .key-entries .key-container:nth-child(9n){margin-bottom:50px}.main-container .app-controls,.main-container .device-controls,.main-container .key-entries-controls{display:flex;flex-wrap:wrap;justify-content:center;gap:10px;margin-bottom:10px}.main-container .app-controls .button,.main-container .app-controls .info,.main-container .device-controls .button,.main-container .device-controls .info,.main-container .key-entries-controls .button,.main-container .key-entries-controls .info{display:flex;flex-direction:column;justify-content:space-evenly;align-items:center;width:100px;height:50px;box-sizing:border-box;align-self:flex-end;user-select:none;word-break:break-word}.main-container .app-controls .button,.main-container .device-controls .button,.main-container .key-entries-controls .button{position:relative;background-color:#4fc1e9;border:1px solid gray}.main-container .app-controls .button i,.main-container .device-controls .button i,.main-container .key-entries-controls .button i{pointer-events:none}.dialog-container{position:absolute;top:0;left:0;height:100%;width:100%}.dialog-container::before{display:block;height:100%;width:100%;content:"";background-color:#fff;opacity:.5;backdrop-filter:blur(1px)}.dialog-container .dialog{display:grid;grid-auto-columns:auto 40px;column-gap:4px;position:absolute;width:fit-content;min-width:320px;background-color:#fff;border:1px solid rgba(128,128,128,.7490196078);border-radius:4px;box-sizing:border-box;box-shadow:5px 5px 4px 2px rgba(128,128,128,.7490196078);overflow:auto}.dialog-container .dialog .dialog-header{grid-row:1;grid-column:1/3;display:grid;align-items:center;justify-content:center;height:40px;background-color:#404040;color:#fff;font-weight:bold;font-size:large;cursor:move}.dialog-container .dialog .dialog-prompt{grid-row:2;grid-column:1;max-width:265px;margin:4px}.dialog-container .dialog .dialog-inputs{grid-row:2;grid-column:1/3;display:grid;align-items:start;row-gap:4px;margin-left:4px;margin-top:4px}.dialog-container .dialog .dialog-inputs .dialog-type-input,.dialog-container .dialog .dialog-inputs .dialog-label-input{margin-right:44px}.dialog-container .dialog .dialog-inputs .dialog-details summary{cursor:pointer}.dialog-container .dialog .dialog-inputs .dialog-macros{display:grid;grid-template-columns:1fr 40px;gap:4px}.dialog-container .dialog .dialog-inputs .dialog-macros .dialog-sortable{display:grid;gap:4px;background-color:#fff;border:1px solid gray;box-sizing:border-box;padding:4px;max-height:174px;overflow:auto}.dialog-container .dialog .dialog-inputs .dialog-macros .dialog-sortable .macro-entry-container{display:flex;gap:4px;align-items:center;height:30px;padding:4px;background-color:#add468;border:1px solid gray;border-radius:5px;box-sizing:border-box}.dialog-container .dialog .dialog-inputs .dialog-macros .dialog-sortable .macro-entry-container .macro-entry-handle{cursor:grab}.dialog-container .dialog .dialog-inputs .dialog-macros .dialog-sortable .macro-entry-container .macro-entry-additionals{margin:0 0 0 auto;cursor:pointer}.dialog-container .dialog.blank .dialog-inputs .dialog-label,.dialog-container .dialog.blank .dialog-inputs .dialog-color,.dialog-container .dialog.blank .dialog-inputs .dialog-content,.dialog-container .dialog.blank .dialog-inputs .dialog-encoder,.dialog-container .dialog.group .dialog-inputs .dialog-content,.dialog-container .dialog.macro .dialog-inputs .dialog-encoder{display:none}.dialog-container .dialog .dialog-button{border:1px solid gray}.dialog-container .dialog .dialog-button.close{grid-row:1;grid-column:2;border:none;border-bottom:1px solid gray;border-left:1px solid gray}.dialog-container .dialog .dialog-button.ok{grid-row:3;grid-column:2;margin-top:4px;border:none;border-top:1px solid gray;border-left:1px solid gray}.notification-container{display:flex;flex-direction:column-reverse;position:absolute;right:0;bottom:0}.notification-container .notification{display:grid;grid-auto-columns:auto 40px;align-items:center;position:relative;min-height:40px;background-color:#404040;border:1px solid gray;border-radius:4px;box-sizing:border-box;overflow:hidden}.notification-container .notification.info{background-color:#4fc1e9}.notification-container .notification.success{background-color:#add468}.notification-container .notification.warning{background-color:#ffce54}.notification-container .notification.error{background-color:#fc6e51}.notification-container .notification .notification-message{padding:0 10px}.notification-container .notification .dialog-button.close{border-left:1px solid gray}.dialog-container .dialog-button,.notification-container .dialog-button{display:flex;justify-content:center;align-items:center;position:relative;width:40px;height:40px;background-color:#fff;box-sizing:border-box;cursor:pointer}.dialog-container .dialog-button.close,.notification-container .dialog-button.close{grid-row:1;grid-column:2;background-color:#fc6e51}.dialog-container .dialog-button.ok,.notification-container .dialog-button.ok{grid-row:3;grid-column:2;background-color:#4fc1e9;margin-top:4px}.main-container .app-controls .button:hover:after,.main-container .device-controls .button:hover:after,.main-container .key-entries-controls .button:hover:after,.dialog-container .dialog-button:hover:after,.notification-container .dialog-button:hover:after{display:block;content:"";width:100%;height:100%;position:absolute;box-shadow:inset 0px 0px 5px 2px rgba(128,128,128,.7490196078)} \ No newline at end of file diff --git a/webui/js/main.js b/webui/js/main.js index f168cc2..40c5801 100644 --- a/webui/js/main.js +++ b/webui/js/main.js @@ -142,10 +142,14 @@ class App { this.appControls.connection.childNodes[0].className = this.deviceConnected ? 'fa-solid fa-link-slash' : 'fa-solid fa-link'; + this.appControls.connection.childNodes[1].innerText = this.deviceConnected + ? 'Disconnect' + : 'Connect'; + this.deviceControlsContainer.classList.toggle('hidden', !this.deviceConnected); this._notify( - this.deviceConnected ? 'success' : 'warning', + this.deviceConnected ? 'success' : 'info', this.deviceConnected ? 'Connected to macropad' : 'Disconnected from macropad' ); } @@ -169,6 +173,9 @@ class App { class: 'fa-solid fa-link', }, }), + utils.create({ + text: 'Connect', + }), ], events: { click: (event) => this._appControlsHandler(event, 'connection'), @@ -186,6 +193,9 @@ class App { class: 'fa-solid fa-file', }, }), + utils.create({ + text: 'New', + }), ], events: { click: (event) => this._appControlsHandler(event, 'new'), @@ -203,6 +213,9 @@ class App { class: 'fa-solid fa-floppy-disk', }, }), + utils.create({ + text: 'Save', + }), ], events: { click: (event) => this._appControlsHandler(event, 'save'), @@ -220,6 +233,9 @@ class App { class: 'fa-solid fa-folder-open', }, }), + utils.create({ + text: 'Open', + }), ], events: { click: (event) => this._appControlsHandler(event, 'open'), @@ -249,7 +265,7 @@ class App { const importedMacros = JSON.parse(content); this._newKeyEntries(importedMacros); - this._notify('info', 'Macros loaded from file'); + this._notify('success', 'Macros loaded from file'); } catch (error) { console.error("appControlsHandler - can't parse JSON string:"); } @@ -277,7 +293,7 @@ class App { break; case 'new': if (this._allKeyEntriesEmpty()) { - this._notify('warning', 'No macros configured'); + this._notify('info', 'No macros configured'); } else { new ConfirmationDialog({ position: { @@ -296,7 +312,7 @@ class App { break; case 'save': if (this._allKeyEntriesEmpty()) { - this._notify('warning', 'No macros configured'); + this._notify('info', 'No macros configured'); } else { utils.downloadObjectAsJson(this.macroStack[0], 'macros.json'); } @@ -346,6 +362,9 @@ class App { class: 'fa-solid fa-download', }, }), + utils.create({ + text: 'Download', + }), ], events: { click: (event) => this._deviceControlsHandler(event, 'getMacros'), @@ -363,6 +382,9 @@ class App { class: 'fa-solid fa-upload', }, }), + utils.create({ + text: 'Upload', + }), ], events: { click: (event) => this._deviceControlsHandler(event, 'setMacros'), @@ -370,44 +392,77 @@ class App { }), save: utils.create({ attributes: { - title: 'Save on Macropad', + title: 'Store on Macropad', class: 'button', }, children: [ utils.create({ type: 'i', attributes: { - class: 'fa-solid fa-floppy-disk', + class: 'fa-solid fa-hard-drive', }, }), + utils.create({ + text: 'Store', + }), ], events: { click: (event) => this._deviceControlsHandler(event, 'saveMacros'), }, }), softreset: utils.create({ - text: 'soft reset', attributes: { class: 'button', }, + children: [ + utils.create({ + type: 'i', + attributes: { + class: 'fa-solid fa-screwdriver-wrench', + }, + }), + utils.create({ + text: 'Soft Reset', + }), + ], events: { click: (event) => this._deviceControlsHandler(event, 'softReset'), }, }), hardreset: utils.create({ - text: 'hard reset', attributes: { class: 'button', }, + children: [ + utils.create({ + type: 'i', + attributes: { + class: 'fa-solid fa-screwdriver-wrench', + }, + }), + utils.create({ + text: 'Hard Reset', + }), + ], events: { click: (event) => this._deviceControlsHandler(event, 'hardReset'), }, }), enableusb: utils.create({ - text: 'enable USB', attributes: { class: 'button', }, + children: [ + utils.create({ + type: 'i', + attributes: { + class: 'fa-solid fa-screwdriver-wrench', + }, + }), + utils.create({ + text: 'Enable USB', + }), + ], events: { click: (event) => this._deviceControlsHandler(event, 'enableUSB'), }, @@ -534,6 +589,9 @@ class App { class: 'fa-solid fa-arrow-right', }, }), + utils.create({ + text: 'Next', + }), ], events: { click: () => this._keyChunkControlsHandler('next'), @@ -551,6 +609,9 @@ class App { class: 'fa-solid fa-arrow-left', }, }), + utils.create({ + text: 'Previous', + }), ], events: { click: () => this._keyChunkControlsHandler('back'), @@ -887,10 +948,14 @@ class App { this.groupPageStack[this.groupPageStack.length - 1] + 1 } / ${pageCount}`; - this.keyEntriesControls.back.childNodes[0].className = - this.macroStack.length > 1 && this.groupPageStack[this.groupPageStack.length - 1] === 0 - ? 'fa-solid fa-arrow-turn-up fa-flip-horizontal' - : 'fa-solid fa-arrow-left'; + const firstPageOfGroup = + this.macroStack.length > 1 && this.groupPageStack[this.groupPageStack.length - 1] === 0; + this.keyEntriesControls.back.childNodes[0].className = firstPageOfGroup + ? 'fa-solid fa-arrow-turn-up fa-flip-horizontal' + : 'fa-solid fa-arrow-left'; + this.keyEntriesControls.back.childNodes[1].innerText = firstPageOfGroup + ? 'Close' + : 'Previous'; } /** diff --git a/webui/scss/style.scss b/webui/scss/style.scss index 3185be5..c2c8564 100644 --- a/webui/scss/style.scss +++ b/webui/scss/style.scss @@ -182,7 +182,7 @@ body { .info { display: flex; flex-direction: column; - justify-content: center; + justify-content: space-evenly; align-items: center; width: $key-entry-size; height: calc($key-entry-size / 2);