summaryrefslogtreecommitdiffstats
path: root/src/components/chat_header.rs
blob: 51906aa263cbdd393b3d3b3eb8d9bb02441c0d95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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 name = move || get_name(chat.user.get().into(), true);
    let jid = move || chat.user.get().jid().read().to_string();

    view! {
        <div class="chat-view-header panel">
            {move || {
                let user = chat.user.get().into();
                view! {
                    <AvatarWithPresence user />
                }
            }}
            <div class="user-info">
                <h2 class="name">{name}</h2>
                <h3>{jid}</h3>
            </div>
        </div>
    }
}