🔥 Remove the use of LoadingPage component
For now, the LoadingPage component is kept, just in case.
This commit is contained in:
31
src/main.rs
31
src/main.rs
@@ -5,9 +5,6 @@ mod infrastructure;
|
|||||||
mod ui;
|
mod ui;
|
||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
use async_std::task;
|
|
||||||
use dioxus::prelude::*;
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
#[cfg(feature = "desktop")]
|
#[cfg(feature = "desktop")]
|
||||||
@@ -21,7 +18,6 @@ use tracing_web::MakeWebConsoleWriter;
|
|||||||
|
|
||||||
use crate::base::{login, sync_rooms};
|
use crate::base::{login, sync_rooms};
|
||||||
use crate::base::{APP_SETTINGS, ROOMS, SESSION};
|
use crate::base::{APP_SETTINGS, ROOMS, SESSION};
|
||||||
use crate::ui::components::loading::LoadingPage;
|
|
||||||
use crate::ui::components::login::Login;
|
use crate::ui::components::login::Login;
|
||||||
use crate::ui::components::main_window::MainWindow;
|
use crate::ui::components::main_window::MainWindow;
|
||||||
|
|
||||||
@@ -30,17 +26,6 @@ mod base;
|
|||||||
fn app() -> Element {
|
fn app() -> Element {
|
||||||
debug!("*** App rendering ***");
|
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 login_coro = use_coroutine(|rx| login(rx, &APP_SETTINGS, &SESSION));
|
||||||
|
|
||||||
let mut sync_rooms_coro = None;
|
let mut sync_rooms_coro = None;
|
||||||
@@ -100,20 +85,14 @@ fn app() -> Element {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if *ready.read() {
|
if SESSION.read().is_logged {
|
||||||
if SESSION.read().is_logged {
|
debug!("Should render the MainWindow component");
|
||||||
debug!("Should render the MainWindow component");
|
rsx! {
|
||||||
rsx! {
|
MainWindow {},
|
||||||
MainWindow {},
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
rsx! {
|
|
||||||
Login {},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rsx! {
|
rsx! {
|
||||||
LoadingPage {},
|
Login {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user