1use crate::face_pile::FacePile;
2use auto_update::AutoUpdateStatus;
3use call::{ActiveCall, ParticipantLocation, Room};
4use client::{proto::PeerId, Client, User, UserStore};
5use gpui::{
6 actions, canvas, div, point, px, Action, AnyElement, AppContext, Element, Hsla,
7 InteractiveElement, IntoElement, Model, ParentElement, Path, Render,
8 StatefulInteractiveElement, Styled, Subscription, View, ViewContext, VisualContext, WeakView,
9};
10use project::{Project, RepositoryEntry};
11use recent_projects::RecentProjects;
12use rpc::proto::{self, DevServerStatus};
13use std::sync::Arc;
14use theme::ActiveTheme;
15use ui::{
16 h_flex, popover_menu, prelude::*, Avatar, AvatarAudioStatusIndicator, Button, ButtonLike,
17 ButtonStyle, ContextMenu, Icon, IconButton, IconName, Indicator, TintColor, TitleBar, Tooltip,
18};
19use util::ResultExt;
20use vcs_menu::{build_branch_list, BranchList, OpenRecent as ToggleVcsMenu};
21use workspace::{notifications::NotifyResultExt, Workspace};
22
23const MAX_PROJECT_NAME_LENGTH: usize = 40;
24const MAX_BRANCH_NAME_LENGTH: usize = 40;
25
26actions!(
27 collab,
28 [
29 ShareProject,
30 UnshareProject,
31 ToggleUserMenu,
32 ToggleProjectMenu,
33 SwitchBranch
34 ]
35);
36
37pub fn init(cx: &mut AppContext) {
38 cx.observe_new_views(|workspace: &mut Workspace, cx| {
39 let titlebar_item = cx.new_view(|cx| CollabTitlebarItem::new(workspace, cx));
40 workspace.set_titlebar_item(titlebar_item.into(), cx)
41 })
42 .detach();
43}
44
45pub struct CollabTitlebarItem {
46 project: Model<Project>,
47 user_store: Model<UserStore>,
48 client: Arc<Client>,
49 workspace: WeakView<Workspace>,
50 _subscriptions: Vec<Subscription>,
51}
52
53impl Render for CollabTitlebarItem {
54 fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
55 let room = ActiveCall::global(cx).read(cx).room().cloned();
56 let current_user = self.user_store.read(cx).current_user();
57 let client = self.client.clone();
58 let project_id = self.project.read(cx).remote_id();
59 let workspace = self.workspace.upgrade();
60
61 TitleBar::new("collab-titlebar")
62 // note: on windows titlebar behaviour is handled by the platform implementation
63 .when(cfg!(not(windows)), |this| {
64 this.on_click(|event, cx| {
65 if event.up.click_count == 2 {
66 cx.zoom_window();
67 }
68 })
69 })
70 // left side
71 .child(
72 h_flex()
73 .gap_1()
74 .children(self.render_project_host(cx))
75 .child(self.render_project_name(cx))
76 .children(self.render_project_branch(cx)),
77 )
78 .child(
79 h_flex()
80 .id("collaborator-list")
81 .w_full()
82 .gap_1()
83 .overflow_x_scroll()
84 .when_some(
85 current_user.clone().zip(client.peer_id()).zip(room.clone()),
86 |this, ((current_user, peer_id), room)| {
87 let player_colors = cx.theme().players();
88 let room = room.read(cx);
89 let mut remote_participants =
90 room.remote_participants().values().collect::<Vec<_>>();
91 remote_participants.sort_by_key(|p| p.participant_index.0);
92
93 let current_user_face_pile = self.render_collaborator(
94 ¤t_user,
95 peer_id,
96 true,
97 room.is_speaking(),
98 room.is_muted(),
99 None,
100 &room,
101 project_id,
102 ¤t_user,
103 cx,
104 );
105
106 this.children(current_user_face_pile.map(|face_pile| {
107 v_flex()
108 .child(face_pile)
109 .child(render_color_ribbon(player_colors.local().cursor))
110 }))
111 .children(
112 remote_participants.iter().filter_map(|collaborator| {
113 let player_color = player_colors
114 .color_for_participant(collaborator.participant_index.0);
115 let is_following = workspace
116 .as_ref()?
117 .read(cx)
118 .is_being_followed(collaborator.peer_id);
119 let is_present = project_id.map_or(false, |project_id| {
120 collaborator.location
121 == ParticipantLocation::SharedProject { project_id }
122 });
123
124 let face_pile = self.render_collaborator(
125 &collaborator.user,
126 collaborator.peer_id,
127 is_present,
128 collaborator.speaking,
129 collaborator.muted,
130 is_following.then_some(player_color.selection),
131 &room,
132 project_id,
133 ¤t_user,
134 cx,
135 )?;
136
137 Some(
138 v_flex()
139 .id(("collaborator", collaborator.user.id))
140 .child(face_pile)
141 .child(render_color_ribbon(player_color.cursor))
142 .cursor_pointer()
143 .on_click({
144 let peer_id = collaborator.peer_id;
145 cx.listener(move |this, _, cx| {
146 this.workspace
147 .update(cx, |workspace, cx| {
148 workspace.follow(peer_id, cx);
149 })
150 .ok();
151 })
152 })
153 .tooltip({
154 let login = collaborator.user.github_login.clone();
155 move |cx| {
156 Tooltip::text(format!("Follow {login}"), cx)
157 }
158 }),
159 )
160 }),
161 )
162 },
163 ),
164 )
165 // right side
166 .child(
167 h_flex()
168 .gap_1()
169 .pr_1()
170 .when_some(room, |this, room| {
171 let room = room.read(cx);
172 let project = self.project.read(cx);
173 let is_local = project.is_local();
174 let is_dev_server_project = project.dev_server_project_id().is_some();
175 let is_shared = (is_local || is_dev_server_project) && project.is_shared();
176 let is_muted = room.is_muted();
177 let is_deafened = room.is_deafened().unwrap_or(false);
178 let is_screen_sharing = room.is_screen_sharing();
179 let can_use_microphone = room.can_use_microphone();
180 let can_share_projects = room.can_share_projects();
181
182 this.when(
183 (is_local || is_dev_server_project) && can_share_projects,
184 |this| {
185 this.child(
186 Button::new(
187 "toggle_sharing",
188 if is_shared { "Unshare" } else { "Share" },
189 )
190 .tooltip(move |cx| {
191 Tooltip::text(
192 if is_shared {
193 "Stop sharing project with call participants"
194 } else {
195 "Share project with call participants"
196 },
197 cx,
198 )
199 })
200 .style(ButtonStyle::Subtle)
201 .selected_style(ButtonStyle::Tinted(TintColor::Accent))
202 .selected(is_shared)
203 .label_size(LabelSize::Small)
204 .on_click(cx.listener(
205 move |this, _, cx| {
206 if is_shared {
207 this.unshare_project(&Default::default(), cx);
208 } else {
209 this.share_project(&Default::default(), cx);
210 }
211 },
212 )),
213 )
214 },
215 )
216 .child(
217 div()
218 .child(
219 IconButton::new("leave-call", ui::IconName::Exit)
220 .style(ButtonStyle::Subtle)
221 .tooltip(|cx| Tooltip::text("Leave call", cx))
222 .icon_size(IconSize::Small)
223 .on_click(move |_, cx| {
224 ActiveCall::global(cx)
225 .update(cx, |call, cx| call.hang_up(cx))
226 .detach_and_log_err(cx);
227 }),
228 )
229 .pr_2(),
230 )
231 .when(can_use_microphone, |this| {
232 this.child(
233 IconButton::new(
234 "mute-microphone",
235 if is_muted {
236 ui::IconName::MicMute
237 } else {
238 ui::IconName::Mic
239 },
240 )
241 .tooltip(move |cx| {
242 Tooltip::text(
243 if is_muted {
244 "Unmute microphone"
245 } else {
246 "Mute microphone"
247 },
248 cx,
249 )
250 })
251 .style(ButtonStyle::Subtle)
252 .icon_size(IconSize::Small)
253 .selected(is_muted)
254 .selected_style(ButtonStyle::Tinted(TintColor::Negative))
255 .on_click(move |_, cx| crate::toggle_mute(&Default::default(), cx)),
256 )
257 })
258 .child(
259 IconButton::new(
260 "mute-sound",
261 if is_deafened {
262 ui::IconName::AudioOff
263 } else {
264 ui::IconName::AudioOn
265 },
266 )
267 .style(ButtonStyle::Subtle)
268 .selected_style(ButtonStyle::Tinted(TintColor::Negative))
269 .icon_size(IconSize::Small)
270 .selected(is_deafened)
271 .tooltip(move |cx| {
272 if can_use_microphone {
273 Tooltip::with_meta(
274 "Deafen Audio",
275 None,
276 "Mic will be muted",
277 cx,
278 )
279 } else {
280 Tooltip::text("Deafen Audio", cx)
281 }
282 })
283 .on_click(move |_, cx| crate::toggle_deafen(&Default::default(), cx)),
284 )
285 .when(can_share_projects, |this| {
286 this.child(
287 IconButton::new("screen-share", ui::IconName::Screen)
288 .style(ButtonStyle::Subtle)
289 .icon_size(IconSize::Small)
290 .selected(is_screen_sharing)
291 .selected_style(ButtonStyle::Tinted(TintColor::Accent))
292 .tooltip(move |cx| {
293 Tooltip::text(
294 if is_screen_sharing {
295 "Stop Sharing Screen"
296 } else {
297 "Share Screen"
298 },
299 cx,
300 )
301 })
302 .on_click(move |_, cx| {
303 crate::toggle_screen_sharing(&Default::default(), cx)
304 }),
305 )
306 })
307 .child(div().pr_2())
308 })
309 .map(|el| {
310 let status = self.client.status();
311 let status = &*status.borrow();
312 if matches!(status, client::Status::Connected { .. }) {
313 el.child(self.render_user_menu_button(cx))
314 } else {
315 el.children(self.render_connection_status(status, cx))
316 .child(self.render_sign_in_button(cx))
317 .child(self.render_user_menu_button(cx))
318 }
319 }),
320 )
321 }
322}
323
324fn render_color_ribbon(color: Hsla) -> impl Element {
325 canvas(
326 move |_, _| {},
327 move |bounds, _, cx| {
328 let height = bounds.size.height;
329 let horizontal_offset = height;
330 let vertical_offset = px(height.0 / 2.0);
331 let mut path = Path::new(bounds.lower_left());
332 path.curve_to(
333 bounds.origin + point(horizontal_offset, vertical_offset),
334 bounds.origin + point(px(0.0), vertical_offset),
335 );
336 path.line_to(bounds.upper_right() + point(-horizontal_offset, vertical_offset));
337 path.curve_to(
338 bounds.lower_right(),
339 bounds.upper_right() + point(px(0.0), vertical_offset),
340 );
341 path.line_to(bounds.lower_left());
342 cx.paint_path(path, color);
343 },
344 )
345 .h_1()
346 .w_full()
347}
348
349impl CollabTitlebarItem {
350 pub fn new(workspace: &Workspace, cx: &mut ViewContext<Self>) -> Self {
351 let project = workspace.project().clone();
352 let user_store = workspace.app_state().user_store.clone();
353 let client = workspace.app_state().client.clone();
354 let active_call = ActiveCall::global(cx);
355 let mut subscriptions = Vec::new();
356 subscriptions.push(
357 cx.observe(&workspace.weak_handle().upgrade().unwrap(), |_, _, cx| {
358 cx.notify()
359 }),
360 );
361 subscriptions.push(cx.observe(&project, |_, _, cx| cx.notify()));
362 subscriptions.push(cx.observe(&active_call, |this, _, cx| this.active_call_changed(cx)));
363 subscriptions.push(cx.observe_window_activation(Self::window_activation_changed));
364 subscriptions.push(cx.observe(&user_store, |_, _, cx| cx.notify()));
365
366 Self {
367 workspace: workspace.weak_handle(),
368 project,
369 user_store,
370 client,
371 _subscriptions: subscriptions,
372 }
373 }
374
375 // resolve if you are in a room -> render_project_owner
376 // render_project_owner -> resolve if you are in a room -> Option<foo>
377
378 pub fn render_project_host(&self, cx: &mut ViewContext<Self>) -> Option<AnyElement> {
379 if let Some(dev_server) =
380 self.project
381 .read(cx)
382 .dev_server_project_id()
383 .and_then(|dev_server_project_id| {
384 dev_server_projects::Store::global(cx)
385 .read(cx)
386 .dev_server_for_project(dev_server_project_id)
387 })
388 {
389 return Some(
390 ButtonLike::new("dev_server_trigger")
391 .child(Indicator::dot().color(
392 if dev_server.status == DevServerStatus::Online {
393 Color::Created
394 } else {
395 Color::Disabled
396 },
397 ))
398 .child(
399 Label::new(dev_server.name.clone())
400 .size(LabelSize::Small)
401 .line_height_style(LineHeightStyle::UiLabel),
402 )
403 .tooltip(move |cx| Tooltip::text("Project is hosted on a dev server", cx))
404 .on_click(cx.listener(|this, _, cx| {
405 if let Some(workspace) = this.workspace.upgrade() {
406 recent_projects::DevServerProjects::open(workspace, cx)
407 }
408 }))
409 .into_any_element(),
410 );
411 }
412
413 let host = self.project.read(cx).host()?;
414 let host_user = self.user_store.read(cx).get_cached_user(host.user_id)?;
415 let participant_index = self
416 .user_store
417 .read(cx)
418 .participant_indices()
419 .get(&host_user.id)?;
420 Some(
421 Button::new("project_owner_trigger", host_user.github_login.clone())
422 .color(Color::Player(participant_index.0))
423 .style(ButtonStyle::Subtle)
424 .label_size(LabelSize::Small)
425 .tooltip(move |cx| {
426 Tooltip::text(
427 format!(
428 "{} is sharing this project. Click to follow.",
429 host_user.github_login.clone()
430 ),
431 cx,
432 )
433 })
434 .on_click({
435 let host_peer_id = host.peer_id;
436 cx.listener(move |this, _, cx| {
437 this.workspace
438 .update(cx, |workspace, cx| {
439 workspace.follow(host_peer_id, cx);
440 })
441 .log_err();
442 })
443 })
444 .into_any_element(),
445 )
446 }
447
448 pub fn render_project_name(&self, cx: &mut ViewContext<Self>) -> impl IntoElement {
449 let name = {
450 let mut names = self.project.read(cx).visible_worktrees(cx).map(|worktree| {
451 let worktree = worktree.read(cx);
452 worktree.root_name()
453 });
454
455 names.next()
456 };
457 let is_project_selected = name.is_some();
458 let name = if let Some(name) = name {
459 util::truncate_and_trailoff(name, MAX_PROJECT_NAME_LENGTH)
460 } else {
461 "Open recent project".to_string()
462 };
463
464 let workspace = self.workspace.clone();
465 Button::new("project_name_trigger", name)
466 .when(!is_project_selected, |b| b.color(Color::Muted))
467 .style(ButtonStyle::Subtle)
468 .label_size(LabelSize::Small)
469 .tooltip(move |cx| {
470 Tooltip::for_action(
471 "Recent Projects",
472 &recent_projects::OpenRecent {
473 create_new_window: false,
474 },
475 cx,
476 )
477 })
478 .on_click(cx.listener(move |_, _, cx| {
479 if let Some(workspace) = workspace.upgrade() {
480 workspace.update(cx, |workspace, cx| {
481 RecentProjects::open(workspace, false, cx);
482 })
483 }
484 }))
485 }
486
487 pub fn render_project_branch(&self, cx: &mut ViewContext<Self>) -> Option<impl Element> {
488 let entry = {
489 let mut names_and_branches =
490 self.project.read(cx).visible_worktrees(cx).map(|worktree| {
491 let worktree = worktree.read(cx);
492 worktree.root_git_entry()
493 });
494
495 names_and_branches.next().flatten()
496 };
497 let workspace = self.workspace.upgrade()?;
498 let branch_name = entry
499 .as_ref()
500 .and_then(RepositoryEntry::branch)
501 .map(|branch| util::truncate_and_trailoff(&branch, MAX_BRANCH_NAME_LENGTH))?;
502 Some(
503 popover_menu("project_branch_trigger")
504 .trigger(
505 Button::new("project_branch_trigger", branch_name)
506 .color(Color::Muted)
507 .style(ButtonStyle::Subtle)
508 .label_size(LabelSize::Small)
509 .tooltip(move |cx| {
510 Tooltip::with_meta(
511 "Recent Branches",
512 Some(&ToggleVcsMenu),
513 "Local branches only",
514 cx,
515 )
516 }),
517 )
518 .menu(move |cx| Self::render_vcs_popover(workspace.clone(), cx)),
519 )
520 }
521
522 #[allow(clippy::too_many_arguments)]
523 fn render_collaborator(
524 &self,
525 user: &Arc<User>,
526 peer_id: PeerId,
527 is_present: bool,
528 is_speaking: bool,
529 is_muted: bool,
530 leader_selection_color: Option<Hsla>,
531 room: &Room,
532 project_id: Option<u64>,
533 current_user: &Arc<User>,
534 cx: &ViewContext<Self>,
535 ) -> Option<Div> {
536 if room.role_for_user(user.id) == Some(proto::ChannelRole::Guest) {
537 return None;
538 }
539
540 const FACEPILE_LIMIT: usize = 3;
541 let followers = project_id.map_or(&[] as &[_], |id| room.followers_for(peer_id, id));
542 let extra_count = followers.len().saturating_sub(FACEPILE_LIMIT);
543
544 Some(
545 div()
546 .m_0p5()
547 .p_0p5()
548 // When the collaborator is not followed, still draw this wrapper div, but leave
549 // it transparent, so that it does not shift the layout when following.
550 .when_some(leader_selection_color, |div, color| {
551 div.rounded_md().bg(color)
552 })
553 .child(
554 FacePile::empty()
555 .child(
556 Avatar::new(user.avatar_uri.clone())
557 .grayscale(!is_present)
558 .border_color(if is_speaking {
559 cx.theme().status().info
560 } else {
561 // We draw the border in a transparent color rather to avoid
562 // the layout shift that would come with adding/removing the border.
563 gpui::transparent_black()
564 })
565 .when(is_muted, |avatar| {
566 avatar.indicator(
567 AvatarAudioStatusIndicator::new(ui::AudioStatus::Muted)
568 .tooltip({
569 let github_login = user.github_login.clone();
570 move |cx| {
571 Tooltip::text(
572 format!("{} is muted", github_login),
573 cx,
574 )
575 }
576 }),
577 )
578 }),
579 )
580 .children(followers.iter().take(FACEPILE_LIMIT).filter_map(
581 |follower_peer_id| {
582 let follower = room
583 .remote_participants()
584 .values()
585 .find_map(|p| {
586 (p.peer_id == *follower_peer_id).then_some(&p.user)
587 })
588 .or_else(|| {
589 (self.client.peer_id() == Some(*follower_peer_id))
590 .then_some(current_user)
591 })?
592 .clone();
593
594 Some(div().mt(-px(4.)).child(
595 Avatar::new(follower.avatar_uri.clone()).size(rems(0.75)),
596 ))
597 },
598 ))
599 .children(if extra_count > 0 {
600 Some(
601 div()
602 .ml_1()
603 .child(Label::new(format!("+{extra_count}")))
604 .into_any_element(),
605 )
606 } else {
607 None
608 }),
609 ),
610 )
611 }
612
613 fn window_activation_changed(&mut self, cx: &mut ViewContext<Self>) {
614 if cx.is_window_active() {
615 ActiveCall::global(cx)
616 .update(cx, |call, cx| call.set_location(Some(&self.project), cx))
617 .detach_and_log_err(cx);
618 } else if cx.active_window().is_none() {
619 ActiveCall::global(cx)
620 .update(cx, |call, cx| call.set_location(None, cx))
621 .detach_and_log_err(cx);
622 }
623 self.workspace
624 .update(cx, |workspace, cx| {
625 workspace.update_active_view_for_followers(cx);
626 })
627 .ok();
628 }
629
630 fn active_call_changed(&mut self, cx: &mut ViewContext<Self>) {
631 cx.notify();
632 }
633
634 fn share_project(&mut self, _: &ShareProject, cx: &mut ViewContext<Self>) {
635 let active_call = ActiveCall::global(cx);
636 let project = self.project.clone();
637 active_call
638 .update(cx, |call, cx| call.share_project(project, cx))
639 .detach_and_log_err(cx);
640 }
641
642 fn unshare_project(&mut self, _: &UnshareProject, cx: &mut ViewContext<Self>) {
643 let active_call = ActiveCall::global(cx);
644 let project = self.project.clone();
645 active_call
646 .update(cx, |call, cx| call.unshare_project(project, cx))
647 .log_err();
648 }
649
650 pub fn render_vcs_popover(
651 workspace: View<Workspace>,
652 cx: &mut WindowContext<'_>,
653 ) -> Option<View<BranchList>> {
654 let view = build_branch_list(workspace, cx).log_err()?;
655 let focus_handle = view.focus_handle(cx);
656 cx.focus(&focus_handle);
657 Some(view)
658 }
659
660 fn render_connection_status(
661 &self,
662 status: &client::Status,
663 cx: &mut ViewContext<Self>,
664 ) -> Option<AnyElement> {
665 match status {
666 client::Status::ConnectionError
667 | client::Status::ConnectionLost
668 | client::Status::Reauthenticating { .. }
669 | client::Status::Reconnecting { .. }
670 | client::Status::ReconnectionError { .. } => Some(
671 div()
672 .id("disconnected")
673 .child(Icon::new(IconName::Disconnected).size(IconSize::Small))
674 .tooltip(|cx| Tooltip::text("Disconnected", cx))
675 .into_any_element(),
676 ),
677 client::Status::UpgradeRequired => {
678 let auto_updater = auto_update::AutoUpdater::get(cx);
679 let label = match auto_updater.map(|auto_update| auto_update.read(cx).status()) {
680 Some(AutoUpdateStatus::Updated) => "Please restart Zed to Collaborate",
681 Some(AutoUpdateStatus::Installing)
682 | Some(AutoUpdateStatus::Downloading)
683 | Some(AutoUpdateStatus::Checking) => "Updating...",
684 Some(AutoUpdateStatus::Idle) | Some(AutoUpdateStatus::Errored) | None => {
685 "Please update Zed to Collaborate"
686 }
687 };
688
689 Some(
690 Button::new("connection-status", label)
691 .label_size(LabelSize::Small)
692 .on_click(|_, cx| {
693 if let Some(auto_updater) = auto_update::AutoUpdater::get(cx) {
694 if auto_updater.read(cx).status() == AutoUpdateStatus::Updated {
695 workspace::restart(&Default::default(), cx);
696 return;
697 }
698 }
699 auto_update::check(&Default::default(), cx);
700 })
701 .into_any_element(),
702 )
703 }
704 _ => None,
705 }
706 }
707
708 pub fn render_sign_in_button(&mut self, _: &mut ViewContext<Self>) -> Button {
709 let client = self.client.clone();
710 Button::new("sign_in", "Sign in")
711 .label_size(LabelSize::Small)
712 .on_click(move |_, cx| {
713 let client = client.clone();
714 cx.spawn(move |mut cx| async move {
715 client
716 .authenticate_and_connect(true, &cx)
717 .await
718 .notify_async_err(&mut cx);
719 })
720 .detach();
721 })
722 }
723
724 pub fn render_user_menu_button(&mut self, cx: &mut ViewContext<Self>) -> impl Element {
725 if let Some(user) = self.user_store.read(cx).current_user() {
726 popover_menu("user-menu")
727 .menu(|cx| {
728 ContextMenu::build(cx, |menu, _| {
729 menu.action("Settings", zed_actions::OpenSettings.boxed_clone())
730 .action("Extensions", extensions_ui::Extensions.boxed_clone())
731 .action("Themes...", theme_selector::Toggle::default().boxed_clone())
732 .separator()
733 .action("Sign Out", client::SignOut.boxed_clone())
734 })
735 .into()
736 })
737 .trigger(
738 ButtonLike::new("user-menu")
739 .child(
740 h_flex()
741 .gap_0p5()
742 .child(Avatar::new(user.avatar_uri.clone()))
743 .child(Icon::new(IconName::ChevronDown).color(Color::Muted)),
744 )
745 .style(ButtonStyle::Subtle)
746 .tooltip(move |cx| Tooltip::text("Toggle User Menu", cx)),
747 )
748 .anchor(gpui::AnchorCorner::TopRight)
749 } else {
750 popover_menu("user-menu")
751 .menu(|cx| {
752 ContextMenu::build(cx, |menu, _| {
753 menu.action("Settings", zed_actions::OpenSettings.boxed_clone())
754 .action("Extensions", extensions_ui::Extensions.boxed_clone())
755 .action("Themes...", theme_selector::Toggle::default().boxed_clone())
756 })
757 .into()
758 })
759 .trigger(
760 ButtonLike::new("user-menu")
761 .child(
762 h_flex()
763 .gap_0p5()
764 .child(Icon::new(IconName::ChevronDown).color(Color::Muted)),
765 )
766 .style(ButtonStyle::Subtle)
767 .tooltip(move |cx| Tooltip::text("Toggle User Menu", cx)),
768 )
769 }
770 }
771}