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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
use dioxus::prelude::*;
use crate::pages::chat_export::ChatExportDialog;
use crate::pages::devtools::DevToolsDialog;
use crate::room::call::call_button::CallButtons;
use crate::room::invite_dialog::InviteDialog;
use crate::room::share_room_dialog::ShareRoomDialog;
use crate::room::widgets::integration_manager::IntegrationManagerDialog;
use crate::notifications::push_rules::PushRulesDialog;
use crate::state::app_state::{AppState, RightPanelView};
use crate::utils::room_helpers::format_member_count;
/// Room header component showing room name, topic, and action buttons.
#[component]
pub fn RoomHeader(
room_id: String,
room_name: String,
room_topic: Option<String>,
member_count: u64,
is_encrypted: bool,
on_search_toggle: EventHandler<()>,
) -> Element {
let mut state = use_context::<Signal<AppState>>();
let mut show_invite = use_signal(|| false);
let mut show_export = use_signal(|| false);
let mut show_share = use_signal(|| false);
let mut show_widgets = use_signal(|| false);
let mut show_push_rules = use_signal(|| false);
let mut show_devtools = use_signal(|| false);
let toggle_members = move |_| {
let current = state.read().right_panel.clone();
if matches!(current, RightPanelView::MemberList) {
state.write().right_panel = RightPanelView::Closed;
} else {
state.write().right_panel = RightPanelView::MemberList;
}
};
let toggle_info = move |_| {
let current = state.read().right_panel.clone();
if matches!(current, RightPanelView::RoomInfo) {
state.write().right_panel = RightPanelView::Closed;
} else {
state.write().right_panel = RightPanelView::RoomInfo;
}
};
rsx! {
header {
class: "room-header",
div {
class: "room-header__info",
div {
class: "room-header__name-row",
if is_encrypted {
span {
class: "room-header__encrypted-icon",
title: "Encrypted",
"🔒"
}
}
h2 {
class: "room-header__name",
"{room_name}"
}
}
if let Some(ref topic) = room_topic {
p {
class: "room-header__topic",
title: "{topic}",
"{topic}"
}
}
}
div {
class: "room-header__actions",
// VoIP call buttons
CallButtons {
room_id: room_id.clone(),
}
// Invite button
button {
class: "room-header__action-btn",
title: "Invite user",
onclick: move |_| show_invite.set(true),
"+"
}
// Search button
button {
class: "room-header__action-btn",
title: "Search in room",
onclick: move |_| on_search_toggle.call(()),
"🔍"
}
// Members button
button {
class: "room-header__action-btn",
title: "{format_member_count(member_count)}",
onclick: toggle_members,
"👥 {member_count}"
}
// Share room button
button {
class: "room-header__action-btn",
title: "Share room",
onclick: move |_| show_share.set(true),
"🔗"
}
// Export button (#62)
button {
class: "room-header__action-btn",
title: "Export chat",
onclick: move |_| show_export.set(true),
"📥"
}
// Widgets/integrations button
button {
class: "room-header__action-btn",
title: "Integrations",
onclick: move |_| show_widgets.set(true),
"🧩"
}
// Devtools button
button {
class: "room-header__action-btn",
title: "Developer tools",
onclick: move |_| show_devtools.set(true),
"</>"
}
// Notification settings button
button {
class: "room-header__action-btn",
title: "Notification settings",
onclick: move |_| show_push_rules.set(true),
"🔔"
}
// Room info button
button {
class: "room-header__action-btn",
title: "Room info",
onclick: toggle_info,
"ℹ"
}
}
// Invite dialog
if *show_invite.read() {
InviteDialog {
room_id: room_id.clone(),
on_close: move |_| show_invite.set(false),
}
}
// Share room dialog
if *show_share.read() {
ShareRoomDialog {
room_id: room_id.clone(),
room_name: room_name.clone(),
on_close: move |_| show_share.set(false),
}
}
// Chat export dialog (#62)
if *show_export.read() {
ChatExportDialog {
room_id: room_id.clone(),
room_name: room_name.clone(),
on_close: move |_| show_export.set(false),
}
}
// Widget/integration manager
if *show_widgets.read() {
IntegrationManagerDialog {
room_id: room_id.clone(),
on_close: move |_| show_widgets.set(false),
}
}
// Developer tools dialog
if *show_devtools.read() {
DevToolsDialog {
room_id: room_id.clone(),
on_close: move |_| show_devtools.set(false),
}
}
// Push rules dialog
if *show_push_rules.read() {
PushRulesDialog {
room_id: room_id.clone(),
room_name: room_name.clone(),
on_close: move |_| show_push_rules.set(false),
}
}
}
}
}