summaryrefslogtreecommitdiffstats
path: root/src/components/chat_header.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-06-01 16:10:26 +0100
committerLibravatar cel 🌸 <cel@bunny.garden>2025-06-01 17:27:40 +0100
commit6ee4190a26f32bfa953302ee363ad3bb6c384ebb (patch)
tree2c3182c29d5780a0ad9c9770b5e546312bea49b4 /src/components/chat_header.rs
parentf76c80c1d23177ab00c81240ee3a75d3bcda0e3b (diff)
downloadmacaw-web-6ee4190a26f32bfa953302ee363ad3bb6c384ebb.tar.gz
macaw-web-6ee4190a26f32bfa953302ee363ad3bb6c384ebb.tar.bz2
macaw-web-6ee4190a26f32bfa953302ee363ad3bb6c384ebb.zip
refactor: reorganise code
Diffstat (limited to 'src/components/chat_header.rs')
-rw-r--r--src/components/chat_header.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/components/chat_header.rs b/src/components/chat_header.rs
new file mode 100644
index 0000000..208e7f6
--- /dev/null
+++ b/src/components/chat_header.rs
@@ -0,0 +1,23 @@
+use filamento::user::UserStoreFields;
+use leptos::prelude::*;
+use reactive_stores::ArcStore;
+
+use crate::{chat::MacawChat, components::avatar::AvatarWithPresence, user::get_name};
+
+#[component]
+pub fn ChatViewHeader(chat: MacawChat) -> impl IntoView {
+ let chat_user = <ArcStore<filamento::user::User> as Clone>::clone(&chat.user).into();
+ let name = move || get_name(chat_user, true);
+ let jid = move || chat_user.jid().read().to_string();
+
+ view! {
+ <div class="chat-view-header panel">
+ <AvatarWithPresence user=chat_user />
+ <div class="user-info">
+ <h2 class="name">{name}</h2>
+ <h3>{jid}</h3>
+ </div>
+ </div>
+ }
+}
+