🚨 Fix clippy warnings
This commit is contained in:
@@ -1,3 +1,203 @@
|
||||
pub mod chats_window;
|
||||
|
||||
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 {}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user