diff --git a/frontend/index.html b/frontend/index.html index 676852c..33d48ed 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,108 +1,128 @@ - + + + + + VibeTorrent - - - - VibeTorrent + + + + + + - - - - - - + + + + + + + - var meta = document.querySelector('meta[name="theme-color"]'); - if (meta) { - var colorMap = { - "light": "#ffffff", - "cupcake": "#faf7f5", - "bumblebee": "#ffffff", - "emerald": "#ffffff", - "corporate": "#ffffff", - "synthwave": "#2d1b69", - "retro": "#ece3ca", - "cyberpunk": "#ffee00", - "valentine": "#f0d6e8", - "halloween": "#212121", - "garden": "#e9e7e7", - "forest": "#171212", - "aqua": "#345da7", - "lofi": "#ffffff", - "pastel": "#ffffff", - "fantasy": "#ffffff", - "wireframe": "#ffffff", - "black": "#000000", - "luxury": "#09090b", - "dracula": "#282a36", - "cmyk": "#ffffff", - "autumn": "#8C0327", - "business": "#202020", - "acid": "#fafafa", - "lemonade": "#F1F8E8", - "night": "#0f1729", - "coffee": "#20161f", - "winter": "#ffffff", - "dark": "#1d232a" - }; - var color = colorMap[theme] || "#1d232a"; - meta.setAttribute("content", color); - } - })(); - - + +
+
+
+ - - - - \ No newline at end of file + body.app-loaded #app-loading { + display: none !important; + } + + + + diff --git a/frontend/src/components/layout/statusbar.rs b/frontend/src/components/layout/statusbar.rs index 96f40b5..58a813b 100644 --- a/frontend/src/components/layout/statusbar.rs +++ b/frontend/src/components/layout/statusbar.rs @@ -27,18 +27,31 @@ pub fn StatusBar() -> impl IntoView { let store = use_context::().expect("store not provided"); let stats = store.global_stats; - let (current_theme, set_current_theme) = create_signal("light".to_string()); + let initial_theme = if let Some(win) = web_sys::window() { + if let Some(doc) = win.document() { + doc.document_element() + .and_then(|el| el.get_attribute("data-theme")) + .unwrap_or_else(|| "dark".to_string()) + } else { + "dark".to_string() + } + } else { + "dark".to_string() + }; + + let (current_theme, set_current_theme) = create_signal(initial_theme); create_effect(move |_| { if let Some(win) = web_sys::window() { if let Some(storage) = win.local_storage().ok().flatten() { if let Ok(Some(stored_theme)) = storage.get_item("vibetorrent_theme") { - set_current_theme.set(stored_theme.clone()); + let theme = stored_theme.to_lowercase(); + set_current_theme.set(theme.clone()); if let Some(doc) = win.document() { let _ = doc .document_element() .unwrap() - .set_attribute("data-theme", &stored_theme); + .set_attribute("data-theme", &theme); } } }