♻️ Use of the assets management introduced by Dioxus 0.6.0
Cf. https://dioxuslabs.com/blog/release-060#stabilizing-manganis-asset-system
This commit is contained in:
20
src/main.rs
20
src/main.rs
@@ -10,6 +10,7 @@ mod utils;
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use dioxus::document::{Link, Style};
|
||||
use dioxus::prelude::*;
|
||||
use futures_util::stream::StreamExt;
|
||||
use tracing::{debug, error, warn};
|
||||
@@ -89,13 +90,24 @@ async fn login(mut rx: UnboundedReceiver<bool>, session: &GlobalSignal<Session>)
|
||||
fn app() -> Element {
|
||||
let login_coro = use_coroutine(|rx| login(rx, &SESSION));
|
||||
|
||||
if !SESSION.read().is_logged {
|
||||
let is_logged = SESSION.read().is_logged;
|
||||
|
||||
if !is_logged {
|
||||
login_coro.send(false);
|
||||
rsx! {
|
||||
}
|
||||
|
||||
rsx! {
|
||||
Link {
|
||||
href: asset!("public/fonts/Geist/Geist-Medium.woff2"), as: "font", type: "font/woff2"
|
||||
}
|
||||
Style {
|
||||
id: "style-head", "body {{ font-family: 'Geist'; font-weight: normal; }}"
|
||||
}
|
||||
|
||||
if !is_logged {
|
||||
Login {}
|
||||
}
|
||||
} else {
|
||||
rsx! {
|
||||
else {
|
||||
Conversations {}
|
||||
}
|
||||
}
|
||||
|
@@ -181,18 +181,14 @@ $border-thin: solid $border-thin-width $border-default-color;
|
||||
// TODO: Radius should be a percentage(eg: 1024/16px).
|
||||
$border-radius: 16px;
|
||||
|
||||
$geist-font-path: "../fonts/Geist";
|
||||
|
||||
$transition-duration: 300ms;
|
||||
|
||||
@font-face {
|
||||
src: url("#{$geist-font-path}/Geist-Medium.woff2") format("woff2");
|
||||
font-family: "Geist";
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
src: url("#{$geist-font-path}/Geist-Bold.woff2") format("woff2");
|
||||
font-family: "Geist";
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@@ -7,10 +7,8 @@ turf::style_sheet!("src/ui/components/wallpaper.scss");
|
||||
|
||||
#[component]
|
||||
pub fn Wallpaper(display_version: Option<bool>) -> Element {
|
||||
let background_image = format!(
|
||||
"url({})",
|
||||
manganis::asset!("public/images/wallpaper-pattern.svg")
|
||||
);
|
||||
let background_image_asset = asset!("/public/images/wallpaper-pattern.svg");
|
||||
let background_image = format!("url({})", background_image_asset.to_string());
|
||||
|
||||
let version = display_version.map(|flag| if flag { Some(GIT_VERSION) } else { None });
|
||||
|
||||
|
Reference in New Issue
Block a user