🔥 Remove the use of LoadingPage component

For now, the LoadingPage component is kept, just in case.
This commit is contained in:
2024-04-12 14:39:23 +02:00
parent df33e94a12
commit 9951c2fea6

View File

@@ -5,9 +5,6 @@ mod infrastructure;
mod ui;
mod utils;
use std::time::Duration;
use async_std::task;
use dioxus::prelude::*;
#[cfg(feature = "desktop")]
@@ -21,7 +18,6 @@ use tracing_web::MakeWebConsoleWriter;
use crate::base::{login, sync_rooms};
use crate::base::{APP_SETTINGS, ROOMS, SESSION};
use crate::ui::components::loading::LoadingPage;
use crate::ui::components::login::Login;
use crate::ui::components::main_window::MainWindow;
@@ -30,17 +26,6 @@ mod base;
fn app() -> Element {
debug!("*** App rendering ***");
let mut ready = use_signal(|| false);
// Dummy timer simulating the loading of the application
let _: Coroutine<()> = use_coroutine(|_: UnboundedReceiver<_>| async move {
debug!("Not ready");
task::sleep(Duration::from_secs(3)).await;
// task::sleep(Duration::from_secs(0)).await;
debug!("Ready");
ready.set(true);
});
let login_coro = use_coroutine(|rx| login(rx, &APP_SETTINGS, &SESSION));
let mut sync_rooms_coro = None;
@@ -100,20 +85,14 @@ fn app() -> Element {
// }
}
if *ready.read() {
if SESSION.read().is_logged {
debug!("Should render the MainWindow component");
rsx! {
MainWindow {},
}
} else {
rsx! {
Login {},
}
if SESSION.read().is_logged {
debug!("Should render the MainWindow component");
rsx! {
MainWindow {},
}
} else {
rsx! {
LoadingPage {},
Login {},
}
}
}