From e56cb9dcd92434f70e04b56896647ebc5dc2ee3d Mon Sep 17 00:00:00 2001 From: Peter van Arkel Date: Tue, 24 Nov 2026 01:14:23 +0100 Subject: [PATCH 1/2] Refine sidebar navigation and service visibility --- .../hosting/static/hosting/panel-icons.svg | 75 +++++++ .../static/hosting/panel-navigation.js | 17 ++ src/coulobre/hosting/static/hosting/panel.css | 206 ++++-------------- .../templates/hosting/account_list.html | 7 +- .../hosting/templates/hosting/base.html | 17 +- .../templates/hosting/service_health.html | 4 +- .../hosting/workspace_navigation.html | 4 +- .../templates/hosting/workspace_page.html | 4 +- .../hosting/templatetags/panel_assets.py | 17 ++ src/coulobre/hosting/views.py | 26 --- src/coulobre/hosting/workspaces.py | 28 +-- 11 files changed, 188 insertions(+), 217 deletions(-) create mode 100644 src/coulobre/hosting/static/hosting/panel-icons.svg create mode 100644 src/coulobre/hosting/templatetags/panel_assets.py diff --git a/src/coulobre/hosting/static/hosting/panel-icons.svg b/src/coulobre/hosting/static/hosting/panel-icons.svg new file mode 100644 index 0000000..ff4b454 --- /dev/null +++ b/src/coulobre/hosting/static/hosting/panel-icons.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/coulobre/hosting/static/hosting/panel-navigation.js b/src/coulobre/hosting/static/hosting/panel-navigation.js index 9b54114..18b05fd 100644 --- a/src/coulobre/hosting/static/hosting/panel-navigation.js +++ b/src/coulobre/hosting/static/hosting/panel-navigation.js @@ -31,6 +31,23 @@ navigation.addEventListener("keydown", (event) => { compactLayout.addEventListener("change", updateMenuLayout); updateMenuLayout(); +const roleSwitch = document.querySelector("[data-role-switch]"); +if (roleSwitch) { + const picker = roleSwitch.querySelector("select"); + const currentRole = picker.value; + roleSwitch.classList.add("role-switch-on-change"); + roleSwitch.querySelector("button").hidden = true; + picker.setAttribute("aria-label", "Panel role (switches when selected)"); + picker.addEventListener("change", () => { + if (picker.value !== currentRole) { + roleSwitch.requestSubmit(); + } + }); + window.addEventListener("pageshow", () => { + picker.value = currentRole; + }); +} + const accountTabs = document.querySelector("[data-account-tabs]"); if (accountTabs) { const panels = [...document.querySelectorAll("[data-account-section]")]; diff --git a/src/coulobre/hosting/static/hosting/panel.css b/src/coulobre/hosting/static/hosting/panel.css index 52c484a..d3152e1 100644 --- a/src/coulobre/hosting/static/hosting/panel.css +++ b/src/coulobre/hosting/static/hosting/panel.css @@ -142,7 +142,6 @@ button, input, select, textarea { display: flex; height: 100dvh; flex-direction: column; - overflow-y: auto; padding: 1.65rem 1.1rem 1.1rem; background: linear-gradient(160deg, var(--sidebar-gradient), var(--sidebar) 55%); color: var(--sidebar-text); @@ -196,6 +195,17 @@ button, input, select, textarea { margin-top: 1.4rem; } +@media (min-width: 781px) { + .navigation { + min-height: 0; + align-content: start; + overflow-y: auto; + overscroll-behavior: contain; + padding: 0.15rem; + scrollbar-width: thin; + } +} + .navigation a { display: flex; align-items: center; @@ -245,175 +255,35 @@ button, input, select, textarea { display: none; } -.nav-icon { - display: inline-block; +.nav-icon, +.sidebar-icon-action svg { + display: block; width: 1rem; - height: 0.85rem; - flex: 0 0 auto; - border: 1px solid currentColor; - border-radius: 2px; + height: 1rem; + flex: 0 0 1rem; + fill: none; + stroke: currentColor; + stroke-width: 1.6px; + stroke-linecap: round; + stroke-linejoin: round; +} + +.nav-icon { color: var(--sidebar-icon); } -.nav-icon-accounts { - background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat; -} - -.nav-icon-plans { - width: 0.8rem; - height: 1rem; - margin-inline: 0.1rem; - background: - linear-gradient(currentColor, currentColor) center 35% / 55% 1px no-repeat, - linear-gradient(currentColor, currentColor) center 65% / 55% 1px no-repeat; -} - -.nav-icon-packages { - background: linear-gradient(currentColor, currentColor) center 35% / 40% 1px no-repeat; -} - -.nav-icon-resellers { - background: - linear-gradient(currentColor, currentColor) center 35% / 55% 1px no-repeat, - linear-gradient(currentColor, currentColor) center 65% / 75% 1px no-repeat; -} - -.nav-icon-health { - background: - linear-gradient(currentColor, currentColor) 25% bottom / 1px 40% no-repeat, - linear-gradient(currentColor, currentColor) center bottom / 1px 70% no-repeat, - linear-gradient(currentColor, currentColor) 75% bottom / 1px 55% no-repeat; -} - -.nav-icon-information { - display: grid; - place-content: center; - border-radius: 50%; - font-size: 0.7rem; - font-weight: 700; -} - -.nav-icon-customers { - position: relative; - height: 0.46rem; - margin-top: 0.47rem; - border-radius: 0.4rem 0.4rem 2px 2px; -} - -.nav-icon-customers::before { - position: absolute; - left: 50%; - bottom: calc(100% + 2px); - width: 0.39rem; - height: 0.39rem; - transform: translateX(-50%); - border: 1px solid currentColor; - border-radius: 50%; - content: ""; -} - -.nav-icon-mail { - background: - linear-gradient(35deg, transparent 47%, currentColor 50%, transparent 54%) left top / 50% 68% no-repeat, - linear-gradient(-35deg, transparent 47%, currentColor 50%, transparent 54%) right top / 50% 68% no-repeat; -} - -.nav-icon-network { - height: 1rem; - border-radius: 50%; - background: - linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat, - linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat; -} - -.nav-icon-lock { - position: relative; - height: 0.66rem; - margin-top: 0.35rem; -} - -.nav-icon-lock::before { - position: absolute; - inset: auto 19% 100%; - height: 0.36rem; - border: 1px solid currentColor; - border-radius: 0.6rem 0.6rem 0 0; - content: ""; -} - -.nav-icon-database { - height: 1rem; - border-radius: 50% / 22%; - background: - linear-gradient(currentColor, currentColor) center 35% / 100% 1px no-repeat, - linear-gradient(currentColor, currentColor) center 70% / 100% 1px no-repeat; -} - -.nav-icon-folder { - position: relative; - height: 0.68rem; - margin-top: 0.2rem; -} - -.nav-icon-folder::before { - position: absolute; - inset: auto auto 100% -1px; - width: 0.45rem; - height: 0.24rem; - border: 1px solid currentColor; - border-radius: 2px 2px 0 0; - content: ""; -} - -.nav-icon-settings { - border: 1px dashed currentColor; - border-radius: 50%; - background: radial-gradient(circle, transparent 21%, currentColor 23% 34%, transparent 36%); -} - -.nav-icon-appearance { - border-radius: 50%; - background: linear-gradient(90deg, currentColor 50%, transparent 50%); -} - -.nav-icon-archive { - background: - linear-gradient(currentColor, currentColor) center 28% / 100% 1px no-repeat, - linear-gradient(currentColor, currentColor) center 63% / 38% 1px no-repeat; -} - -.nav-icon-clock { - height: 1rem; - border-radius: 50%; - background: - linear-gradient(currentColor, currentColor) center 27% / 1px 30% no-repeat, - linear-gradient(currentColor, currentColor) 71% center / 30% 1px no-repeat; -} - -.nav-icon-transfer { - border-width: 0 0 1px; - border-radius: 0; - background: linear-gradient(currentColor, currentColor) left 35% / 88% 1px no-repeat; - position: relative; -} - -.nav-icon-transfer::before { - position: absolute; - right: 0.1rem; - top: 0.04rem; - width: 0.4rem; - height: 0.4rem; - transform: rotate(45deg); - border-top: 1px solid currentColor; - border-right: 1px solid currentColor; - content: ""; +.navigation a:hover .nav-icon, +.navigation a[aria-current] .nav-icon { + color: currentColor; } .sidebar-account { display: grid; + grid-template-columns: minmax(0, 1fr); gap: 0.55rem; + flex: 0 0 auto; margin-top: auto; - padding-top: 0.85rem; + padding-top: 0.7rem; border-top: 1px solid var(--sidebar-divider); font-size: 0.88rem; } @@ -465,6 +335,10 @@ a.sidebar-identity:hover { font-size: 0.82rem; } +.panel-role-switch.role-switch-on-change { + display: block; +} + .panel-role-switch select { width: 100%; min-width: 0; @@ -494,6 +368,13 @@ a.sidebar-identity:hover { color: var(--sidebar-text); } +.sidebar-icon-action { + display: grid; + width: 2.2rem; + padding: 0; + place-items: center; +} + .appearance-control { min-width: 2.2rem; font-size: 1rem; @@ -616,6 +497,11 @@ h2 { overflow-wrap: anywhere; } +.package-controls { + display: grid; + gap: 0.75rem; +} + .update-release { padding: 0.75rem 0.9rem; border: 1px solid var(--line); diff --git a/src/coulobre/hosting/templates/hosting/account_list.html b/src/coulobre/hosting/templates/hosting/account_list.html index 4ba9c21..d76e801 100644 --- a/src/coulobre/hosting/templates/hosting/account_list.html +++ b/src/coulobre/hosting/templates/hosting/account_list.html @@ -27,12 +27,7 @@ {% endblock %} {% block page_content %} - {% if health_summary %} -
-

{% if not health_summary.configured %}Service checks need setup.{% elif health_summary.needs_attention %}{{ health_summary.needs_attention }} of {{ health_summary.configured }} service checks need attention.{% else %}All {{ health_summary.configured }} service checks are healthy.{% endif %}

- Service health -
- {% elif is_reseller %} + {% if is_reseller %}

Manage the logins for your assigned customers.

My customers diff --git a/src/coulobre/hosting/templates/hosting/base.html b/src/coulobre/hosting/templates/hosting/base.html index 5d23ec2..eb73888 100644 --- a/src/coulobre/hosting/templates/hosting/base.html +++ b/src/coulobre/hosting/templates/hosting/base.html @@ -1,15 +1,15 @@ -{% load static %} +{% load static panel_assets %} {% block title %}Coulobre Panel{% endblock %} - + {% if custom_panel_theme %}{% endif %} {% if has_user_theme %}{% endif %} {% block extra_styles %}{% endblock %} - + {% if request.user.is_authenticated and not auth_screen %} @@ -27,6 +27,7 @@ {% include "hosting/workspace_navigation.html" %} @@ -83,7 +86,7 @@ {% block content %}{% endblock %} - + {% block extra_scripts %}{% endblock %} {% else %} {% block public_content %}{% endblock %} diff --git a/src/coulobre/hosting/templates/hosting/service_health.html b/src/coulobre/hosting/templates/hosting/service_health.html index 0f2b2f5..5390f8a 100644 --- a/src/coulobre/hosting/templates/hosting/service_health.html +++ b/src/coulobre/hosting/templates/hosting/service_health.html @@ -11,7 +11,7 @@

{{ node.node }}

- {% if node.transport == 'local' %}Local{% else %}Remote{% endif %} + {% if node.transport == 'local' %}Local{% else %}Remote · monitoring only{% endif %}
@@ -40,7 +40,7 @@ - {% else %}—{% endif %} + {% else %}Manage on host{% endif %} {% endif %} diff --git a/src/coulobre/hosting/templates/hosting/workspace_navigation.html b/src/coulobre/hosting/templates/hosting/workspace_navigation.html index 7c81a6a..7aac246 100644 --- a/src/coulobre/hosting/templates/hosting/workspace_navigation.html +++ b/src/coulobre/hosting/templates/hosting/workspace_navigation.html @@ -1,9 +1,11 @@ +{% load panel_assets %} +{% panel_asset 'hosting/panel-icons.svg' as panel_icons %} {% for title, entries in navigation_groups %}