From 1052e1564ac61a637b6a0ca4f83071988a09216c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Wed, 13 Nov 2024 14:47:00 +0100 Subject: [PATCH] ui - refactor theme handling in templates to use a unified 'theme' variable and move upgrade to pro button --- src/ui/app/static/css/overrides.css | 21 +++++---- src/ui/app/static/js/utils.js | 2 + src/ui/app/templates/base.html | 8 ++-- src/ui/app/templates/dashboard.html | 23 ++-------- src/ui/app/templates/flash.html | 2 +- src/ui/app/templates/instances.html | 2 +- src/ui/app/templates/loading.html | 2 +- src/ui/app/templates/login.html | 2 +- src/ui/app/templates/menu.html | 28 +++++++++++ src/ui/app/templates/navbar.html | 46 ++++++++----------- src/ui/app/templates/profile.html | 6 +-- src/ui/app/templates/setup.html | 4 +- src/ui/app/templates/sidebar-news.html | 2 +- .../app/templates/sidebar-notifications.html | 4 +- src/ui/main.py | 1 + 15 files changed, 82 insertions(+), 71 deletions(-) diff --git a/src/ui/app/static/css/overrides.css b/src/ui/app/static/css/overrides.css index 650196ffdb..f3a9fe7ffa 100644 --- a/src/ui/app/static/css/overrides.css +++ b/src/ui/app/static/css/overrides.css @@ -171,10 +171,7 @@ button.list-group-item-secondary.active { } .buy-now .btn-buy-now { - position: fixed; - bottom: 3rem; - right: 1.625rem; - z-index: 1080; + position: unset; box-shadow: 0 1px 20px 1px var(--bs-primary); /* Initial shadow */ background-color: var(--bs-bw-green); /* Initial background color */ color: #fff; @@ -306,10 +303,16 @@ button.list-group-item-secondary.active { animation: fadeIn 1.5s infinite alternate; } */ +.btn-responsive { + padding: 6px 14px; + font-size: 90%; + line-height: 1.2; +} + @media (max-width: 768px) { .btn-responsive { - padding: 4px 9px; - font-size: 80%; + padding: 2px 6px; + font-size: 70%; line-height: 1; } @@ -321,9 +324,9 @@ button.list-group-item-secondary.active { @media (min-width: 769px) and (max-width: 992px) { .btn-responsive { - padding: 8px 18px; - font-size: 90%; - line-height: 1.2; + padding: 4px 9px; + font-size: 80%; + line-height: 1.1; } } diff --git a/src/ui/app/static/js/utils.js b/src/ui/app/static/js/utils.js index d4cc034325..4341d1cd37 100644 --- a/src/ui/app/static/js/utils.js +++ b/src/ui/app/static/js/utils.js @@ -439,6 +439,7 @@ $(document).ready(() => { .addClass("bg-dark-subtle") .removeClass("bg-light-subtle"); $("html").attr("data-bs-theme", "dark"); + $(".dark-mode-toggle-icon").removeClass("bx-sun").addClass("bx-moon"); } else { $("html").removeClass("dark-style").addClass("light-style"); $(".btn-outline-light") @@ -450,6 +451,7 @@ $(document).ready(() => { .addClass("bg-light-subtle") .removeClass("bg-dark-subtle"); $("html").attr("data-bs-theme", null); + $(".dark-mode-toggle-icon").removeClass("bx-moon").addClass("bx-sun"); } $("#theme").val(darkMode ? "dark" : "light"); diff --git a/src/ui/app/templates/base.html b/src/ui/app/templates/base.html index 1df89f13d3..795ba96cf9 100644 --- a/src/ui/app/templates/base.html +++ b/src/ui/app/templates/base.html @@ -24,9 +24,9 @@ } %} + {% if theme == 'dark' %}data-bs-theme="dark"{% endif %}> - {% if current_user.theme == 'dark' %} + {% if theme == 'dark' %} @@ -126,7 +126,7 @@ - + {% if current_endpoint != "loading" %} {% include "flash.html" %} diff --git a/src/ui/app/templates/dashboard.html b/src/ui/app/templates/dashboard.html index abffa6dbfa..7c75eefcf0 100644 --- a/src/ui/app/templates/dashboard.html +++ b/src/ui/app/templates/dashboard.html @@ -28,7 +28,7 @@
-
- {% endif %}
diff --git a/src/ui/app/templates/flash.html b/src/ui/app/templates/flash.html index bb4a498f63..f506fbd389 100644 --- a/src/ui/app/templates/flash.html +++ b/src/ui/app/templates/flash.html @@ -8,7 +8,7 @@ {% endif %} {% for category, message in messages %} -