🏗️ Rearchitecting the interface with the MatrixClient

- Replace RwStore with channels.
- Use of fermi to handle application data.
- Use of tracing.
This commit is contained in:
2023-12-10 22:01:05 +01:00
parent 4988054dae
commit ae8dba86f6
11 changed files with 472 additions and 450 deletions

View File

@@ -1,20 +1,23 @@
use dioxus::prelude::*;
use dioxus_std::utils::rw::UseRw;
use fermi::*;
use tracing::debug;
use crate::base::Store;
use crate::base::APP_SETTINGS;
use crate::components::contacts_window::contacts_window::ContactsWindow;
use crate::components::login::Login;
#[inline_props]
pub fn MainWindow<'a>(cx: Scope, rw_store: &'a UseRw<Store>) -> Element {
let is_logged = rw_store.read().unwrap().is_logged;
pub fn MainWindow(cx: Scope) -> Element {
debug!("MainWindow rendering");
let app_settings = use_atom_ref(cx, &APP_SETTINGS);
let is_logged = app_settings.read().store.is_logged;
cx.render(rsx! {
if is_logged {
rsx!(ContactsWindow {rw_store: rw_store})
rsx!(ContactsWindow {})
}
else {
rsx!(Login {rw_store: rw_store})
rsx!(Login {})
}
})
}