From be6905cc3b695fe781ae80aa504dd24ac397bd99 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Mon, 28 Apr 2025 02:34:42 +0200 Subject: [PATCH] Logo for dark theme --- backend/scss/toast.scss | 2 +- backend/static/logo_dark.svg | 60 +++++++++++++++++++++ backend/static/{logo.svg => logo_light.svg} | 19 +++---- backend/templates/title.html | 7 ++- frontend/src/pages/dev_panel.rs | 12 ++--- frontend/src/toast.rs | 1 + 6 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 backend/static/logo_dark.svg rename backend/static/{logo.svg => logo_light.svg} (85%) diff --git a/backend/scss/toast.scss b/backend/scss/toast.scss index dd35068..0e1d1a9 100644 --- a/backend/scss/toast.scss +++ b/backend/scss/toast.scss @@ -21,7 +21,7 @@ background-color: consts.$color-2; text-align: center; - padding: calc(2 * consts.$margin) calc(4 * consts.$margin); + padding: calc(2 * consts.$margin) calc(2 * consts.$margin); box-shadow: -1px 1px 10px rgba(0, 0, 0, 0.3); margin: consts.$margin; diff --git a/backend/static/logo_dark.svg b/backend/static/logo_dark.svg new file mode 100644 index 0000000..8e0bdac --- /dev/null +++ b/backend/static/logo_dark.svg @@ -0,0 +1,60 @@ + + + + + + + + + + + + diff --git a/backend/static/logo.svg b/backend/static/logo_light.svg similarity index 85% rename from backend/static/logo.svg rename to backend/static/logo_light.svg index 6b8d98f..a255b06 100644 --- a/backend/static/logo.svg +++ b/backend/static/logo_light.svg @@ -2,9 +2,9 @@ + inkscape:current-layer="layer1" + showgrid="false" /> + transform="translate(-51.871853,-88.876652)"> {{ context.tr.t(Sentence::MainTitle) }} \ No newline at end of file +{{ context.tr.t(Sentence::MainTitle) }} \ No newline at end of file diff --git a/frontend/src/pages/dev_panel.rs b/frontend/src/pages/dev_panel.rs index 0b59e75..ef42c1e 100644 --- a/frontend/src/pages/dev_panel.rs +++ b/frontend/src/pages/dev_panel.rs @@ -1,14 +1,10 @@ -use gloo::{console::log, events::EventListener, utils::document}; -use wasm_bindgen::prelude::*; +use gloo::{events::EventListener, utils::document}; use wasm_bindgen_futures::spawn_local; -use web_sys::{Element, HtmlElement, HtmlInputElement}; use crate::{ - calendar, modal_dialog, - recipe_scheduler::RecipeScheduler, - shopping_list::ShoppingList, + modal_dialog, toast::{self, Level}, - utils::{SelectorExt, by_id, get_current_lang, get_locale, selector}, + utils::by_id, }; pub fn setup_page() { @@ -65,7 +61,7 @@ pub fn setup_page() { EventListener::new(&by_id("test-modal-dialog"), "click", move |_event| { spawn_local(async move { - modal_dialog::show("#hidden-templates").await; + modal_dialog::show("#hidden-templates .modal-test-message").await; }); }) .forget(); diff --git a/frontend/src/toast.rs b/frontend/src/toast.rs index c3a12fd..faaff59 100644 --- a/frontend/src/toast.rs +++ b/frontend/src/toast.rs @@ -72,6 +72,7 @@ fn show_message_content(level: Level, content: Content) { // FIXME: Here the two events will leak memory. How to fix that? // Save them in a global vec variable and remove them manually? + // Some insights: https://github.com/rustwasm/wasm-bindgen/issues/993#issuecomment-2244046849 let close_button: HtmlElement = toast_element.selector(".close"); let toast_element_cloned = toast_element.clone(); EventListener::once(&close_button, "click", move |_event| {