From 998f1ed09fc788787d75dbbbf25b73abf3e904d5 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Thu, 28 Dec 2023 11:05:08 -0600 Subject: [PATCH 01/15] Add group labels to sidebar --- src/renderer/assets/css/nav.css | 3 +++ src/renderer/src/pages.js | 7 +++++++ src/renderer/src/stories/sidebar.js | 28 ++++++++++++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/renderer/assets/css/nav.css b/src/renderer/assets/css/nav.css index dcedbecb5..e81e0d06c 100755 --- a/src/renderer/assets/css/nav.css +++ b/src/renderer/assets/css/nav.css @@ -111,6 +111,9 @@ a[data-toggle="collapse"] { display: flex; flex-direction: column; justify-content: space-between; + overflow-y: auto; + margin-top: 15px; + border-top: 1px solid #d5d5d5; flex-grow: 1; } diff --git a/src/renderer/src/pages.js b/src/renderer/src/pages.js index d60abe07b..6d6b37b26 100644 --- a/src/renderer/src/pages.js +++ b/src/renderer/src/pages.js @@ -104,6 +104,7 @@ const pages = { conversion: new GuidedHomePage({ label: "Conversions", icon: guidedIcon, + group: 'Workflow', pages: { start: new GuidedStartPage({ label: "Start", @@ -176,26 +177,32 @@ const pages = { inspect: new InspectPage({ label: "Inspect", icon: inspectIcon, + group: 'Workflow' }), preview: new PreviewPage({ label: "Neurosift", icon: neurosiftIcon, + group: 'Workflow', }), uploads: new UploadsPage({ label: "Uploads", icon: uploadIcon, + group: 'Workflow' }), tutorial: new TutorialPage({ label: "Tutorial", icon: tutorialIcon, + group: 'Documentation' }), docs: new DocumentationPage({ label: "Documentation", icon: documentationIcon, + group: 'Documentation' }), contact: new ContactPage({ label: "Contact Us", icon: contactIcon, + group: 'Documentation' }), settings: new SettingsPage({ label: "Settings", diff --git a/src/renderer/src/stories/sidebar.js b/src/renderer/src/stories/sidebar.js index 2c6c0735d..a11ac14cb 100644 --- a/src/renderer/src/stories/sidebar.js +++ b/src/renderer/src/stories/sidebar.js @@ -1,5 +1,6 @@ import { LitElement, html } from "lit"; import useGlobalStyles from "./utils/useGlobalStyles.js"; +import { header } from "./forms/utils"; const componentCSS = ``; // These are not active until the component is using shadow DOM @@ -162,14 +163,17 @@ export class Sidebar extends LitElement { ul.classList.add("components"); const groups = {}; + + Object.entries(this.pages).forEach(([id, page]) => { const info = page.info ?? {}; const label = info.label ?? id; const icon = info.icon ?? ""; + const a = document.createElement("a"); a.setAttribute("data-id", id); a.href = "#"; - a.innerHTML = `${icon} ${label} `; + a.innerHTML = `${icon} ${label}`; a.onclick = () => this.#onClick(id); const li = document.createElement("li"); @@ -181,7 +185,27 @@ export class Sidebar extends LitElement { parent.append(a); }); - return [ul, ...Object.values(groups)]; + const bottomGroup = groups["bottom"] + delete groups["bottom"] + + for (let key in groups) { + const group = groups[key] + const title = document.createElement("h4") + Object.assign(title.style, { + color: "gray", + fontSize: "14px", + padding: "15px 0px 7px 10px", + borderBottom: "1px solid #ccc", + margin: 0, + marginBottom: "10px", + }) + title.innerHTML = header(key) + group.prepend(title) + } + + ul.append(...Object.values(groups)) + + return [ul, bottomGroup]; })()}
From f56c373f1ad3036ad348de421640309e314f8e98 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 28 Dec 2023 17:06:30 +0000 Subject: [PATCH 02/15] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/renderer/src/pages.js | 14 +++++++------- src/renderer/src/stories/sidebar.js | 17 ++++++++--------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/renderer/src/pages.js b/src/renderer/src/pages.js index 6d6b37b26..f29851169 100644 --- a/src/renderer/src/pages.js +++ b/src/renderer/src/pages.js @@ -104,7 +104,7 @@ const pages = { conversion: new GuidedHomePage({ label: "Conversions", icon: guidedIcon, - group: 'Workflow', + group: "Workflow", pages: { start: new GuidedStartPage({ label: "Start", @@ -177,32 +177,32 @@ const pages = { inspect: new InspectPage({ label: "Inspect", icon: inspectIcon, - group: 'Workflow' + group: "Workflow", }), preview: new PreviewPage({ label: "Neurosift", icon: neurosiftIcon, - group: 'Workflow', + group: "Workflow", }), uploads: new UploadsPage({ label: "Uploads", icon: uploadIcon, - group: 'Workflow' + group: "Workflow", }), tutorial: new TutorialPage({ label: "Tutorial", icon: tutorialIcon, - group: 'Documentation' + group: "Documentation", }), docs: new DocumentationPage({ label: "Documentation", icon: documentationIcon, - group: 'Documentation' + group: "Documentation", }), contact: new ContactPage({ label: "Contact Us", icon: contactIcon, - group: 'Documentation' + group: "Documentation", }), settings: new SettingsPage({ label: "Settings", diff --git a/src/renderer/src/stories/sidebar.js b/src/renderer/src/stories/sidebar.js index a11ac14cb..4e44801f7 100644 --- a/src/renderer/src/stories/sidebar.js +++ b/src/renderer/src/stories/sidebar.js @@ -164,7 +164,6 @@ export class Sidebar extends LitElement { const groups = {}; - Object.entries(this.pages).forEach(([id, page]) => { const info = page.info ?? {}; const label = info.label ?? id; @@ -185,12 +184,12 @@ export class Sidebar extends LitElement { parent.append(a); }); - const bottomGroup = groups["bottom"] - delete groups["bottom"] + const bottomGroup = groups["bottom"]; + delete groups["bottom"]; for (let key in groups) { - const group = groups[key] - const title = document.createElement("h4") + const group = groups[key]; + const title = document.createElement("h4"); Object.assign(title.style, { color: "gray", fontSize: "14px", @@ -198,12 +197,12 @@ export class Sidebar extends LitElement { borderBottom: "1px solid #ccc", margin: 0, marginBottom: "10px", - }) - title.innerHTML = header(key) - group.prepend(title) + }); + title.innerHTML = header(key); + group.prepend(title); } - ul.append(...Object.values(groups)) + ul.append(...Object.values(groups)); return [ul, bottomGroup]; })()} From 4b1b8c8ee8249b62b85ee88970397300f05c9cb2 Mon Sep 17 00:00:00 2001 From: Garrett Michael Flynn Date: Thu, 28 Dec 2023 15:11:22 -0600 Subject: [PATCH 03/15] Hide home button --- src/renderer/assets/css/nav.css | 13 +++++++++++++ src/renderer/src/pages.js | 1 + src/renderer/src/stories/sidebar.js | 6 +++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/renderer/assets/css/nav.css b/src/renderer/assets/css/nav.css index e81e0d06c..574293d81 100755 --- a/src/renderer/assets/css/nav.css +++ b/src/renderer/assets/css/nav.css @@ -107,6 +107,10 @@ a[data-toggle="collapse"] { padding-bottom: 0px; } +#main-nav .sidebar-header img { + cursor: pointer; +} + #main-nav .sidebar-body { display: flex; flex-direction: column; @@ -117,6 +121,15 @@ a[data-toggle="collapse"] { flex-grow: 1; } +#main-nav .sidebar-body > *:last-child { + /* margin-top: 50px; */ + border-top: 1px solid #ccc; + padding-top: 10px; + position: sticky; + bottom: 0; + background: var(--color-sidebar); +} + #main-nav ul.components { list-style: none; padding-right: 10px; diff --git a/src/renderer/src/pages.js b/src/renderer/src/pages.js index f29851169..e9ad123d9 100644 --- a/src/renderer/src/pages.js +++ b/src/renderer/src/pages.js @@ -100,6 +100,7 @@ const pages = { "/": new GettingStartedPage({ label: "Home", icon: overviewIcon, + hidden: true }), conversion: new GuidedHomePage({ label: "Conversions", diff --git a/src/renderer/src/stories/sidebar.js b/src/renderer/src/stories/sidebar.js index 4e44801f7..bebac393c 100644 --- a/src/renderer/src/stories/sidebar.js +++ b/src/renderer/src/stories/sidebar.js @@ -139,7 +139,9 @@ export class Sidebar extends LitElement {