🎨 Refactor App + add an empty ChatsWindow in a dedicated window

This commit is contained in:
2023-08-16 21:06:28 +02:00
parent 2159c6adeb
commit 60f2466411
5 changed files with 42 additions and 13 deletions

View File

@@ -0,0 +1,8 @@
use dioxus::prelude::*;
pub fn ChatsWindow(cx: Scope) -> Element {
cx.render(rsx! {
div {
}
})
}

View File

@@ -0,0 +1 @@
pub mod chats_window;

View File

@@ -0,0 +1,22 @@
use dioxus::prelude::*;
use dioxus_std::utils::rw::use_rw;
use crate::base::Store;
use crate::components::contacts_window::contacts_window::ContactsWindow;
use crate::components::login::Login;
#[inline_props]
pub fn MainWindow(cx: Scope) -> Element {
let rw_store = use_rw(cx, || Store::new());
let is_logged = rw_store.read().unwrap().is_logged;
cx.render(rsx! {
if is_logged {
rsx!(ContactsWindow {rw_store: rw_store})
}
else {
rsx!(Login {rw_store: rw_store})
}
})
}

View File

@@ -1,4 +1,6 @@
pub mod avatar_selector;
pub mod chats_window;
pub mod contacts_window;
pub mod header;
pub mod login;
pub mod main_window;