🚨 Fix clippy warnings
This commit is contained in:
@@ -160,7 +160,7 @@ pub async fn sync_rooms(
|
|||||||
receivers: Receivers,
|
receivers: Receivers,
|
||||||
rooms_ref: UseAtomRef<ByIdRooms>,
|
rooms_ref: UseAtomRef<ByIdRooms>,
|
||||||
) {
|
) {
|
||||||
while let Some(_is_logged) = rx.next().await {
|
if let Some(_is_logged) = rx.next().await {
|
||||||
let mut rooms_receiver = receivers.rooms_receiver.borrow_mut();
|
let mut rooms_receiver = receivers.rooms_receiver.borrow_mut();
|
||||||
let mut room_topic_receiver = receivers.room_topic_receiver.borrow_mut();
|
let mut room_topic_receiver = receivers.room_topic_receiver.borrow_mut();
|
||||||
|
|
||||||
|
@@ -1,202 +0,0 @@
|
|||||||
use dioxus::prelude::*;
|
|
||||||
use fermi::*;
|
|
||||||
use tracing::debug;
|
|
||||||
|
|
||||||
use crate::base::{sync_rooms, ROOMS};
|
|
||||||
use crate::components::avatar_selector::AvatarSelector;
|
|
||||||
use crate::components::icons::DownArrowIcon;
|
|
||||||
use crate::matrix_interface::requester::Receivers;
|
|
||||||
|
|
||||||
use super::edit_section::EditSection;
|
|
||||||
|
|
||||||
turf::style_sheet!("src/components/chats_window/chats_window.scss");
|
|
||||||
|
|
||||||
pub struct ChatsWindowProps {
|
|
||||||
pub receivers: Receivers,
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn ChatsWindow(cx: Scope<ChatsWindowProps>) -> Element {
|
|
||||||
debug!("ChatsWindow rendering");
|
|
||||||
|
|
||||||
let receivers = &cx.props.receivers;
|
|
||||||
|
|
||||||
use_init_atom_root(cx);
|
|
||||||
|
|
||||||
let rooms_ref = use_atom_ref(cx, &ROOMS);
|
|
||||||
|
|
||||||
let sync_rooms_coro = use_coroutine(cx, |rx| {
|
|
||||||
to_owned![receivers];
|
|
||||||
|
|
||||||
sync_rooms(rx, receivers, rooms_ref.clone())
|
|
||||||
});
|
|
||||||
sync_rooms_coro.send(true);
|
|
||||||
|
|
||||||
let rooms = rooms_ref.read();
|
|
||||||
let rendered_room_tabs = rooms.values().map(|room| {
|
|
||||||
let room = room.borrow();
|
|
||||||
let room_name = room.name().unwrap_or(room.id().to_string());
|
|
||||||
rsx!(
|
|
||||||
div {
|
|
||||||
class: ClassName::TAB,
|
|
||||||
|
|
||||||
button {
|
|
||||||
img {
|
|
||||||
src: "./images/status_online.png",
|
|
||||||
},
|
|
||||||
|
|
||||||
"{room_name}",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
)
|
|
||||||
});
|
|
||||||
|
|
||||||
cx.render(rsx! {
|
|
||||||
style { STYLE_SHEET },
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::CHATS_WINDOW,
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::TABS,
|
|
||||||
|
|
||||||
rendered_room_tabs.into_iter(),
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::CHAT,
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::HEADER,
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::INFO,
|
|
||||||
|
|
||||||
p {
|
|
||||||
class: ClassName::ROOM_NAME,
|
|
||||||
|
|
||||||
"MON POTE",
|
|
||||||
},
|
|
||||||
|
|
||||||
p {
|
|
||||||
class: ClassName::ROOM_TOPIC,
|
|
||||||
|
|
||||||
"LE STATUT A MON POTE",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::NAVBAR,
|
|
||||||
|
|
||||||
button {
|
|
||||||
style: "background: url(./images/add_user2.png) center no-repeat",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
style: "background: url(./images/directory.png) center no-repeat",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
style: "background: url(./images/phone.png) center no-repeat",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
style: "background: url(./images/medias.png) center no-repeat",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
style: "background: url(./images/games.png) center no-repeat",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
style: "background: url(./images/ban_user.png) center no-repeat",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
class: ClassName::FLEX_RIGHT_AERO_BUTTON,
|
|
||||||
style: "background: url(./images/brush.png) center no-repeat",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
class: ClassName::FLEX_LAST_BUTTON,
|
|
||||||
style: "background: url(./images/settings.png) center no-repeat",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::CONVERSATION,
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::ROOM_EVENTS,
|
|
||||||
|
|
||||||
ul {
|
|
||||||
li {
|
|
||||||
class: ClassName::ROOM_EVENT,
|
|
||||||
div {
|
|
||||||
p {
|
|
||||||
class: ClassName::TITLE,
|
|
||||||
"MON POTE says:"
|
|
||||||
},
|
|
||||||
p {
|
|
||||||
class: ClassName::CONTENT,
|
|
||||||
"Coucou mon pote",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::OTHER_AVATAR_SELECTOR_CONTAINER,
|
|
||||||
|
|
||||||
div {
|
|
||||||
|
|
||||||
class: ClassName::AVATAR_SELECTOR,
|
|
||||||
AvatarSelector {},
|
|
||||||
},
|
|
||||||
div {
|
|
||||||
class: ClassName::WEBCAM,
|
|
||||||
img {
|
|
||||||
src: "images/webcam.svg"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::ARROW_ICON,
|
|
||||||
DownArrowIcon {}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::HOLDER,
|
|
||||||
"••••••"
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::EDIT_SECTION,
|
|
||||||
EditSection {},
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::MY_AVATAR_SELECTOR_CONTAINER,
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::AVATAR_SELECTOR,
|
|
||||||
AvatarSelector {},
|
|
||||||
},
|
|
||||||
div {
|
|
||||||
class: ClassName::WEBCAM,
|
|
||||||
img {
|
|
||||||
src: "images/webcam.svg"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
div {
|
|
||||||
class: ClassName::ARROW_ICON,
|
|
||||||
DownArrowIcon {}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
@@ -1,3 +1,203 @@
|
|||||||
pub mod chats_window;
|
|
||||||
|
|
||||||
mod edit_section;
|
mod edit_section;
|
||||||
|
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
use fermi::*;
|
||||||
|
use tracing::debug;
|
||||||
|
|
||||||
|
use crate::base::{sync_rooms, ROOMS};
|
||||||
|
use crate::components::avatar_selector::AvatarSelector;
|
||||||
|
use crate::components::icons::DownArrowIcon;
|
||||||
|
use crate::matrix_interface::requester::Receivers;
|
||||||
|
use edit_section::EditSection;
|
||||||
|
|
||||||
|
turf::style_sheet!("src/components/chats_window/chats_window.scss");
|
||||||
|
|
||||||
|
pub struct ChatsWindowProps {
|
||||||
|
pub receivers: Receivers,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ChatsWindow(cx: Scope<ChatsWindowProps>) -> Element {
|
||||||
|
debug!("ChatsWindow rendering");
|
||||||
|
|
||||||
|
let receivers = &cx.props.receivers;
|
||||||
|
|
||||||
|
use_init_atom_root(cx);
|
||||||
|
|
||||||
|
let rooms_ref = use_atom_ref(cx, &ROOMS);
|
||||||
|
|
||||||
|
let sync_rooms_coro = use_coroutine(cx, |rx| {
|
||||||
|
to_owned![receivers];
|
||||||
|
|
||||||
|
sync_rooms(rx, receivers, rooms_ref.clone())
|
||||||
|
});
|
||||||
|
sync_rooms_coro.send(true);
|
||||||
|
|
||||||
|
let rooms = rooms_ref.read();
|
||||||
|
let rendered_room_tabs = rooms.values().map(|room| {
|
||||||
|
let room = room.borrow();
|
||||||
|
let room_name = room.name().unwrap_or(room.id().to_string());
|
||||||
|
rsx!(
|
||||||
|
div {
|
||||||
|
class: ClassName::TAB,
|
||||||
|
|
||||||
|
button {
|
||||||
|
img {
|
||||||
|
src: "./images/status_online.png",
|
||||||
|
},
|
||||||
|
|
||||||
|
"{room_name}",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
cx.render(rsx! {
|
||||||
|
style { STYLE_SHEET },
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::CHATS_WINDOW,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::TABS,
|
||||||
|
|
||||||
|
rendered_room_tabs.into_iter(),
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::CHAT,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::HEADER,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::INFO,
|
||||||
|
|
||||||
|
p {
|
||||||
|
class: ClassName::ROOM_NAME,
|
||||||
|
|
||||||
|
"MON POTE",
|
||||||
|
},
|
||||||
|
|
||||||
|
p {
|
||||||
|
class: ClassName::ROOM_TOPIC,
|
||||||
|
|
||||||
|
"LE STATUT A MON POTE",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::NAVBAR,
|
||||||
|
|
||||||
|
button {
|
||||||
|
style: "background: url(./images/add_user2.png) center no-repeat",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
style: "background: url(./images/directory.png) center no-repeat",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
style: "background: url(./images/phone.png) center no-repeat",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
style: "background: url(./images/medias.png) center no-repeat",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
style: "background: url(./images/games.png) center no-repeat",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
style: "background: url(./images/ban_user.png) center no-repeat",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
class: ClassName::FLEX_RIGHT_AERO_BUTTON,
|
||||||
|
style: "background: url(./images/brush.png) center no-repeat",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
class: ClassName::FLEX_LAST_BUTTON,
|
||||||
|
style: "background: url(./images/settings.png) center no-repeat",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::CONVERSATION,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::ROOM_EVENTS,
|
||||||
|
|
||||||
|
ul {
|
||||||
|
li {
|
||||||
|
class: ClassName::ROOM_EVENT,
|
||||||
|
div {
|
||||||
|
p {
|
||||||
|
class: ClassName::TITLE,
|
||||||
|
"MON POTE says:"
|
||||||
|
},
|
||||||
|
p {
|
||||||
|
class: ClassName::CONTENT,
|
||||||
|
"Coucou mon pote",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::OTHER_AVATAR_SELECTOR_CONTAINER,
|
||||||
|
|
||||||
|
div {
|
||||||
|
|
||||||
|
class: ClassName::AVATAR_SELECTOR,
|
||||||
|
AvatarSelector {},
|
||||||
|
},
|
||||||
|
div {
|
||||||
|
class: ClassName::WEBCAM,
|
||||||
|
img {
|
||||||
|
src: "images/webcam.svg"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::ARROW_ICON,
|
||||||
|
DownArrowIcon {}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::HOLDER,
|
||||||
|
"••••••"
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::EDIT_SECTION,
|
||||||
|
EditSection {},
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::MY_AVATAR_SELECTOR_CONTAINER,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::AVATAR_SELECTOR,
|
||||||
|
AvatarSelector {},
|
||||||
|
},
|
||||||
|
div {
|
||||||
|
class: ClassName::WEBCAM,
|
||||||
|
img {
|
||||||
|
src: "images/webcam.svg"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
div {
|
||||||
|
class: ClassName::ARROW_ICON,
|
||||||
|
DownArrowIcon {}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -64,7 +64,7 @@ pub fn ContactsSection<'a>(
|
|||||||
|
|
||||||
let show = use_state(cx, || false);
|
let show = use_state(cx, || false);
|
||||||
|
|
||||||
let classes = vec![
|
let classes = [
|
||||||
ClassName::SECTION,
|
ClassName::SECTION,
|
||||||
if **show { ClassName::ACTIVE } else { "" },
|
if **show { ClassName::ACTIVE } else { "" },
|
||||||
]
|
]
|
||||||
@@ -86,7 +86,7 @@ pub fn ContactsSection<'a>(
|
|||||||
let formatted = format!(
|
let formatted = format!(
|
||||||
"{room_name} - {}",
|
"{room_name} - {}",
|
||||||
if is_invited {
|
if is_invited {
|
||||||
format!("Invited - ")
|
"Invited - ".to_string()
|
||||||
} else {
|
} else {
|
||||||
"".to_string()
|
"".to_string()
|
||||||
}
|
}
|
||||||
|
@@ -1,94 +0,0 @@
|
|||||||
use dioxus::prelude::*;
|
|
||||||
use tracing::debug;
|
|
||||||
|
|
||||||
use crate::components::contacts_window::contacts::Contacts;
|
|
||||||
use crate::components::contacts_window::user_infos::UserInfos;
|
|
||||||
|
|
||||||
turf::style_sheet!("src/components/contacts_window/contacts_window.scss");
|
|
||||||
|
|
||||||
pub fn ContactsWindow(cx: Scope) -> Element {
|
|
||||||
debug!("ContactsWindow rendering");
|
|
||||||
|
|
||||||
cx.render(rsx! {
|
|
||||||
style { STYLE_SHEET },
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::CONTACTS_WINDOW,
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::HEADER,
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::TITLE_BAR,
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::USER_INFO,
|
|
||||||
},
|
|
||||||
|
|
||||||
UserInfos {},
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::CONTACTS_NAV,
|
|
||||||
div {
|
|
||||||
class: ClassName::INNER,
|
|
||||||
|
|
||||||
button {
|
|
||||||
class: ClassName::AERO_BUTTON,
|
|
||||||
style: "background: url(./images/letter.png) center no-repeat",
|
|
||||||
},
|
|
||||||
button {
|
|
||||||
class: ClassName::AERO_BUTTON,
|
|
||||||
style: "background: url(./images/directory.png) no-repeat center",
|
|
||||||
},
|
|
||||||
button {
|
|
||||||
class: ClassName::AERO_BUTTON,
|
|
||||||
style: "background: url(./images/news.png) no-repeat center",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
class: ClassName::FLEX_RIGHT_AERO_BUTTON,
|
|
||||||
style: "background: url(./images/brush.png) no-repeat center",
|
|
||||||
},
|
|
||||||
button {
|
|
||||||
class: ClassName::AERO_BUTTON,
|
|
||||||
style: "background: url(./images/settings.png) no-repeat center",
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::SEARCH,
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::INNER,
|
|
||||||
|
|
||||||
input {
|
|
||||||
class: ClassName::SEARCH_INPUT,
|
|
||||||
placeholder: "Find a contact...",
|
|
||||||
r#type: "text",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
class: ClassName::BUTTON,
|
|
||||||
style: "background: url(./images/add_user.png) no-repeat center",
|
|
||||||
},
|
|
||||||
|
|
||||||
button {
|
|
||||||
class: ClassName::BUTTON,
|
|
||||||
style: "background: url(./images/tbc_transfert.png) no-repeat center",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
Contacts {},
|
|
||||||
|
|
||||||
div {
|
|
||||||
class: ClassName::FOOTER,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
@@ -1,5 +1,98 @@
|
|||||||
pub mod contacts_window;
|
|
||||||
|
|
||||||
mod contacts;
|
mod contacts;
|
||||||
mod contacts_section;
|
mod contacts_section;
|
||||||
mod user_infos;
|
mod user_infos;
|
||||||
|
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
use tracing::debug;
|
||||||
|
|
||||||
|
use crate::components::contacts_window::contacts::Contacts;
|
||||||
|
use crate::components::contacts_window::user_infos::UserInfos;
|
||||||
|
|
||||||
|
turf::style_sheet!("src/components/contacts_window/contacts_window.scss");
|
||||||
|
|
||||||
|
pub fn ContactsWindow(cx: Scope) -> Element {
|
||||||
|
debug!("ContactsWindow rendering");
|
||||||
|
|
||||||
|
cx.render(rsx! {
|
||||||
|
style { STYLE_SHEET },
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::CONTACTS_WINDOW,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::HEADER,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::TITLE_BAR,
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::USER_INFO,
|
||||||
|
},
|
||||||
|
|
||||||
|
UserInfos {},
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::CONTACTS_NAV,
|
||||||
|
div {
|
||||||
|
class: ClassName::INNER,
|
||||||
|
|
||||||
|
button {
|
||||||
|
class: ClassName::AERO_BUTTON,
|
||||||
|
style: "background: url(./images/letter.png) center no-repeat",
|
||||||
|
},
|
||||||
|
button {
|
||||||
|
class: ClassName::AERO_BUTTON,
|
||||||
|
style: "background: url(./images/directory.png) no-repeat center",
|
||||||
|
},
|
||||||
|
button {
|
||||||
|
class: ClassName::AERO_BUTTON,
|
||||||
|
style: "background: url(./images/news.png) no-repeat center",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
class: ClassName::FLEX_RIGHT_AERO_BUTTON,
|
||||||
|
style: "background: url(./images/brush.png) no-repeat center",
|
||||||
|
},
|
||||||
|
button {
|
||||||
|
class: ClassName::AERO_BUTTON,
|
||||||
|
style: "background: url(./images/settings.png) no-repeat center",
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::SEARCH,
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::INNER,
|
||||||
|
|
||||||
|
input {
|
||||||
|
class: ClassName::SEARCH_INPUT,
|
||||||
|
placeholder: "Find a contact...",
|
||||||
|
r#type: "text",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
class: ClassName::BUTTON,
|
||||||
|
style: "background: url(./images/add_user.png) no-repeat center",
|
||||||
|
},
|
||||||
|
|
||||||
|
button {
|
||||||
|
class: ClassName::BUTTON,
|
||||||
|
style: "background: url(./images/tbc_transfert.png) no-repeat center",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
Contacts {},
|
||||||
|
|
||||||
|
div {
|
||||||
|
class: ClassName::FOOTER,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@@ -19,7 +19,7 @@ pub fn Login(cx: Scope) -> Element {
|
|||||||
|
|
||||||
let invalid_login = use_state(cx, || false);
|
let invalid_login = use_state(cx, || false);
|
||||||
|
|
||||||
let login = use_ref(cx, || Login::new());
|
let login = use_ref(cx, Login::new);
|
||||||
|
|
||||||
let password_class = if **invalid_login {
|
let password_class = if **invalid_login {
|
||||||
ClassName::INVALID_INPUT
|
ClassName::INVALID_INPUT
|
||||||
@@ -127,11 +127,10 @@ struct Login {
|
|||||||
|
|
||||||
impl Login {
|
impl Login {
|
||||||
fn new() -> Self {
|
fn new() -> Self {
|
||||||
let login = Self {
|
Self {
|
||||||
homeserver_url: None,
|
homeserver_url: None,
|
||||||
email: None,
|
email: None,
|
||||||
password: None,
|
password: None,
|
||||||
};
|
}
|
||||||
login
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,7 +3,7 @@ use fermi::*;
|
|||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
use crate::base::SESSION;
|
use crate::base::SESSION;
|
||||||
use crate::components::contacts_window::contacts_window::ContactsWindow;
|
use crate::components::contacts_window::ContactsWindow;
|
||||||
use crate::components::login::Login;
|
use crate::components::login::Login;
|
||||||
|
|
||||||
pub fn MainWindow(cx: Scope) -> Element {
|
pub fn MainWindow(cx: Scope) -> Element {
|
||||||
|
@@ -9,7 +9,7 @@ pub mod components;
|
|||||||
pub mod matrix_interface;
|
pub mod matrix_interface;
|
||||||
|
|
||||||
use crate::base::{login, sync_rooms, APP_SETTINGS, ROOMS, SESSION};
|
use crate::base::{login, sync_rooms, APP_SETTINGS, ROOMS, SESSION};
|
||||||
use crate::components::chats_window::chats_window::{ChatsWindow, ChatsWindowProps};
|
use crate::components::chats_window::{ChatsWindow, ChatsWindowProps};
|
||||||
use crate::components::main_window::MainWindow;
|
use crate::components::main_window::MainWindow;
|
||||||
|
|
||||||
mod base;
|
mod base;
|
||||||
|
@@ -291,13 +291,9 @@ impl Client {
|
|||||||
let joined_matrix_rooms_ref = &matrix_client.joined_rooms();
|
let joined_matrix_rooms_ref = &matrix_client.joined_rooms();
|
||||||
let invited_matrix_rooms_ref = &matrix_client.invited_rooms();
|
let invited_matrix_rooms_ref = &matrix_client.invited_rooms();
|
||||||
|
|
||||||
for matrix_rooms in vec![joined_matrix_rooms_ref, invited_matrix_rooms_ref] {
|
for matrix_rooms in [joined_matrix_rooms_ref, invited_matrix_rooms_ref] {
|
||||||
for matrix_room in matrix_rooms.iter() {
|
for matrix_room in matrix_rooms.iter() {
|
||||||
let topic = match matrix_room.topic() {
|
let topic = matrix_room.topic().map(RefCell::new);
|
||||||
None => None,
|
|
||||||
Some(topic) => Some(RefCell::new(topic)),
|
|
||||||
};
|
|
||||||
|
|
||||||
let room = Room::new(
|
let room = Room::new(
|
||||||
Arc::new(matrix_room.to_owned()),
|
Arc::new(matrix_room.to_owned()),
|
||||||
topic,
|
topic,
|
||||||
@@ -405,7 +401,7 @@ impl Client {
|
|||||||
async fn run(&mut self, task: WorkerTask) {
|
async fn run(&mut self, task: WorkerTask) {
|
||||||
match task {
|
match task {
|
||||||
WorkerTask::Init(reply) => {
|
WorkerTask::Init(reply) => {
|
||||||
assert_eq!(self.initialized, false);
|
assert!(!self.initialized);
|
||||||
self.init();
|
self.init();
|
||||||
reply.send(());
|
reply.send(());
|
||||||
}
|
}
|
||||||
|
@@ -35,12 +35,12 @@ impl Requester {
|
|||||||
pub fn init(&self) {
|
pub fn init(&self) {
|
||||||
let (reply, response) = oneshot();
|
let (reply, response) = oneshot();
|
||||||
self.tx.send(WorkerTask::Init(reply)).unwrap();
|
self.tx.send(WorkerTask::Init(reply)).unwrap();
|
||||||
return response.recv();
|
response.recv()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn login(&self, style: LoginStyle) -> anyhow::Result<()> {
|
pub fn login(&self, style: LoginStyle) -> anyhow::Result<()> {
|
||||||
let (reply, response) = oneshot();
|
let (reply, response) = oneshot();
|
||||||
self.tx.send(WorkerTask::Login(style, reply)).unwrap();
|
self.tx.send(WorkerTask::Login(style, reply)).unwrap();
|
||||||
return response.recv();
|
response.recv()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,7 +24,7 @@ pub(super) fn oneshot<T>() -> (ClientReply<T>, ClientResponse<T>) {
|
|||||||
let reply = ClientReply(tx);
|
let reply = ClientReply(tx);
|
||||||
let response = ClientResponse(rx);
|
let response = ClientResponse(rx);
|
||||||
|
|
||||||
return (reply, response);
|
(reply, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
Reference in New Issue
Block a user