BlueGit

ict rusty-teams

feat(channels): channel header and post card like Teams

- header title shows the channel name only
- "..." menu in the channel header (channel notifications, pin, hide, manage, copy link)
- Announcement button next to Post on the Post in channel card

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

metis Daniel Däschle · pushed by metis

Authored 2026-11-09 · 3 weeks ago

Hash
975710d8290a39b0ebf013dd90467b03945f7990
Parent
4faacace
7 files changed +101 −22
crates/app-state/src/channel_menu.rs +4 −4
@@ -40,7 +40,7 @@ pub enum MenuEntry<Item> {
40 40 impl ChannelMenuItem {
41 41 pub fn label(self) -> &'static str {
42 42 match self {
43 ChannelMenuItem::Notifications => "Notifications",
43 ChannelMenuItem::Notifications => "Channel notifications",
44 44 ChannelMenuItem::Pin => "Pin",
45 45 ChannelMenuItem::Unpin => "Unpin",
46 46 ChannelMenuItem::Show => "Show",
@@ -470,7 +470,7 @@ mod tests {
470 470 });
471 471 assert_eq!(
472 472 labels(&shown, ChannelMenuItem::label),
473 ["Notifications", "Pin", "Hide", "-", "Manage channel", "Copy link"]
473 ["Channel notifications", "Pin", "Hide", "-", "Manage channel", "Copy link"]
474 474 );
475 475 let hidden_pinned = channel_menu_entries(ChannelMenuState {
476 476 pinned: true,
@@ -479,7 +479,7 @@ mod tests {
479 479 });
480 480 assert_eq!(
481 481 labels(&hidden_pinned, ChannelMenuItem::label),
482 ["Notifications", "Unpin", "Show", "-", "Manage channel", "Copy link"]
482 ["Channel notifications", "Unpin", "Show", "-", "Manage channel", "Copy link"]
483 483 );
484 484 }
485 485
@@ -513,7 +513,7 @@ mod tests {
513 513 assert_eq!(
514 514 labels(&channel_menu_entries(admin), ChannelMenuItem::label),
515 515 [
516 "Notifications",
516 "Channel notifications",
517 517 "Pin",
518 518 "Hide",
519 519 "-",
@@ -40,7 +40,7 @@ pub enum MenuEntry<Item> {
40impl ChannelMenuItem {
40impl ChannelMenuItem {
41 pub fn label(self) -> &'static str {
41 pub fn label(self) -> &'static str {
42 match self {
42 match self {
43 ChannelMenuItem::Notifications => "Notifications",
43 ChannelMenuItem::Notifications => "Channel notifications",
44 ChannelMenuItem::Pin => "Pin",
44 ChannelMenuItem::Pin => "Pin",
45 ChannelMenuItem::Unpin => "Unpin",
45 ChannelMenuItem::Unpin => "Unpin",
46 ChannelMenuItem::Show => "Show",
46 ChannelMenuItem::Show => "Show",
@@ -470,7 +470,7 @@ mod tests {
470 });
470 });
471 assert_eq!(
471 assert_eq!(
472 labels(&shown, ChannelMenuItem::label),
472 labels(&shown, ChannelMenuItem::label),
473 ["Notifications", "Pin", "Hide", "-", "Manage channel", "Copy link"]
473 ["Channel notifications", "Pin", "Hide", "-", "Manage channel", "Copy link"]
474 );
474 );
475 let hidden_pinned = channel_menu_entries(ChannelMenuState {
475 let hidden_pinned = channel_menu_entries(ChannelMenuState {
476 pinned: true,
476 pinned: true,
@@ -479,7 +479,7 @@ mod tests {
479 });
479 });
480 assert_eq!(
480 assert_eq!(
481 labels(&hidden_pinned, ChannelMenuItem::label),
481 labels(&hidden_pinned, ChannelMenuItem::label),
482 ["Notifications", "Unpin", "Show", "-", "Manage channel", "Copy link"]
482 ["Channel notifications", "Unpin", "Show", "-", "Manage channel", "Copy link"]
483 );
483 );
484 }
484 }
485
485
@@ -513,7 +513,7 @@ mod tests {
513 assert_eq!(
513 assert_eq!(
514 labels(&channel_menu_entries(admin), ChannelMenuItem::label),
514 labels(&channel_menu_entries(admin), ChannelMenuItem::label),
515 [
515 [
516 "Notifications",
516 "Channel notifications",
517 "Pin",
517 "Pin",
518 "Hide",
518 "Hide",
519 "-",
519 "-",
crates/app/src/views/composer/post.rs +6 −0
@@ -144,6 +144,12 @@ impl Composer {
144 144 }
145 145 }
146 146
147 pub fn begin_announcement(&mut self, window: &mut Window, cx: &mut Context<Self>) {
148 if self.announcement.is_none() {
149 self.toggle_announcement(window, cx);
150 }
151 }
152
147 153 pub(super) fn toggle_announcement(&mut self, window: &mut Window, cx: &mut Context<Self>) {
148 154 if self.announcement.is_some() {
149 155 self.close_announcement(window, cx);
@@ -144,6 +144,12 @@ impl Composer {
144 }
144 }
145 }
145 }
146
146
147 pub fn begin_announcement(&mut self, window: &mut Window, cx: &mut Context<Self>) {
148 if self.announcement.is_none() {
149 self.toggle_announcement(window, cx);
150 }
151 }
152
147 pub(super) fn toggle_announcement(&mut self, window: &mut Window, cx: &mut Context<Self>) {
153 pub(super) fn toggle_announcement(&mut self, window: &mut Window, cx: &mut Context<Self>) {
148 if self.announcement.is_some() {
154 if self.announcement.is_some() {
149 self.close_announcement(window, cx);
155 self.close_announcement(window, cx);
crates/app/src/views/conversation.rs +8 −1
@@ -3628,6 +3628,7 @@ impl ConversationView {
3628 3628 let mut stack: Option<AnyElement> = None;
3629 3629 let mut rename: Option<AnyElement> = None;
3630 3630 let mut names_title: Option<Div> = None;
3631 let mut header_title = current.title.clone();
3631 3632 match &current.selection {
3632 3633 Selection::Chat(chat_id) => {
3633 3634 if let Some(chat) = app.sidebar.chats.iter().find(|chat| &chat.id == chat_id) {
@@ -3702,6 +3703,11 @@ impl ConversationView {
3702 3703 .avatar(&teams_core::team_avatar_key(&entry.team.id))
3703 3704 });
3704 3705 lead = Some(team_avatar(photo, name, key, 36., 9.));
3706 if let Some(channel) = team
3707 .and_then(|entry| entry.channels.iter().find(|channel| &channel.id == channel_id))
3708 {
3709 header_title = channel.name.clone();
3710 }
3705 3711 }
3706 3712 }
3707 3713 let mut header = h_flex()
@@ -3796,7 +3802,7 @@ impl ConversationView {
3796 3802 .text_color(theme::text())
3797 3803 .map(|title| match names_title {
3798 3804 Some(names) => title.child(names),
3799 None => title.child(current.title.clone()),
3805 None => title.child(header_title),
3800 3806 }),
3801 3807 )
3802 3808 .children(rename),
@@ -3821,6 +3827,7 @@ impl ConversationView {
3821 3827 })
3822 3828 .children(self.channel_find_button(cx))
3823 3829 .when(!overflow, |header| header.children(self.channel_details_button(cx)))
3830 .children(self.channel_more_button(cx))
3824 3831 .children(self.chat_more_button(overflow, cx))
3825 3832 .children(self.pop_in_button(current))
3826 3833 }
@@ -3628,6 +3628,7 @@ impl ConversationView {
3628 let mut stack: Option<AnyElement> = None;
3628 let mut stack: Option<AnyElement> = None;
3629 let mut rename: Option<AnyElement> = None;
3629 let mut rename: Option<AnyElement> = None;
3630 let mut names_title: Option<Div> = None;
3630 let mut names_title: Option<Div> = None;
3631 let mut header_title = current.title.clone();
3631 match &current.selection {
3632 match &current.selection {
3632 Selection::Chat(chat_id) => {
3633 Selection::Chat(chat_id) => {
3633 if let Some(chat) = app.sidebar.chats.iter().find(|chat| &chat.id == chat_id) {
3634 if let Some(chat) = app.sidebar.chats.iter().find(|chat| &chat.id == chat_id) {
@@ -3702,6 +3703,11 @@ impl ConversationView {
3702 .avatar(&teams_core::team_avatar_key(&entry.team.id))
3703 .avatar(&teams_core::team_avatar_key(&entry.team.id))
3703 });
3704 });
3704 lead = Some(team_avatar(photo, name, key, 36., 9.));
3705 lead = Some(team_avatar(photo, name, key, 36., 9.));
3706 if let Some(channel) = team
3707 .and_then(|entry| entry.channels.iter().find(|channel| &channel.id == channel_id))
3708 {
3709 header_title = channel.name.clone();
3710 }
3705 }
3711 }
3706 }
3712 }
3707 let mut header = h_flex()
3713 let mut header = h_flex()
@@ -3796,7 +3802,7 @@ impl ConversationView {
3796 .text_color(theme::text())
3802 .text_color(theme::text())
3797 .map(|title| match names_title {
3803 .map(|title| match names_title {
3798 Some(names) => title.child(names),
3804 Some(names) => title.child(names),
3799 None => title.child(current.title.clone()),
3805 None => title.child(header_title),
3800 }),
3806 }),
3801 )
3807 )
3802 .children(rename),
3808 .children(rename),
@@ -3821,6 +3827,7 @@ impl ConversationView {
3821 })
3827 })
3822 .children(self.channel_find_button(cx))
3828 .children(self.channel_find_button(cx))
3823 .when(!overflow, |header| header.children(self.channel_details_button(cx)))
3829 .when(!overflow, |header| header.children(self.channel_details_button(cx)))
3830 .children(self.channel_more_button(cx))
3824 .children(self.chat_more_button(overflow, cx))
3831 .children(self.chat_more_button(overflow, cx))
3825 .children(self.pop_in_button(current))
3832 .children(self.pop_in_button(current))
3826 }
3833 }
crates/app/src/views/conversation/chat_header_actions.rs +33 −0
@@ -13,12 +13,14 @@ use crate::data::Directory;
13 13 use crate::find_in_chat::FIND_IN_CHAT;
14 14 use crate::theme;
15 15 use crate::views::chat_menu::{ChatMenuTarget, MenuContext, chat_menu};
16 use crate::views::sidebar::channel_menu;
16 17 use crate::views::composer::plus_menu::chat_invitees;
17 18 use crate::views::new_meeting_dialog::open_new_meeting_with;
18 19 use crate::views::avatar::status_glyph;
19 20 use crate::views::widgets::{icon, menu_icon, symbol};
20 21
21 22 pub const CHAT_HEADER_MORE_TAG: &str = "chat-header-more";
23 pub const CHANNEL_HEADER_MORE_TAG: &str = "channel-header-more";
22 24 const SCHEDULE_MEETING_LABEL: &str = "Schedule meeting";
23 25 const BUTTON_SIZE: f32 = 32.;
24 26 const HEADER_COMPACT_WIDTH: f32 = 480.;
@@ -46,6 +48,37 @@ impl ConversationView {
46 48 )
47 49 }
48 50
51 pub(super) fn channel_more_button(&self, cx: &App) -> Option<AnyElement> {
52 let Selection::Channel(channel_id) = &self.current.as_ref()?.selection else {
53 return None;
54 };
55 if self.pinned || self.popped_out {
56 return None;
57 }
58 let notifications = self
59 .app
60 .read(cx)
61 .sidebar
62 .teams
63 .iter()
64 .find(|entry| entry.channels.iter().any(|channel| &channel.id == channel_id))?
65 .channel_notifications(channel_id);
66 let (state, channel_id) = (self.app.clone(), channel_id.clone());
67 Some(
68 Button::new(CHANNEL_HEADER_MORE_TAG)
69 .icon(IconName::Ellipsis)
70 .ghost()
71 .size(px(BUTTON_SIZE))
72 .rounded(px(8.))
73 .tooltip("More channel options")
74 .debug_selector(|| CHANNEL_HEADER_MORE_TAG.into())
75 .dropdown_menu(move |popup, window, cx| {
76 channel_menu(popup, window, cx, state.clone(), &channel_id, notifications)
77 })
78 .into_any_element(),
79 )
80 }
81
49 82 pub(super) fn header_overflows(&self) -> bool {
50 83 let width = self.header_width.get();
51 84 width > 0.
@@ -13,12 +13,14 @@ use crate::data::Directory;
13use crate::find_in_chat::FIND_IN_CHAT;
13use crate::find_in_chat::FIND_IN_CHAT;
14use crate::theme;
14use crate::theme;
15use crate::views::chat_menu::{ChatMenuTarget, MenuContext, chat_menu};
15use crate::views::chat_menu::{ChatMenuTarget, MenuContext, chat_menu};
16use crate::views::sidebar::channel_menu;
16use crate::views::composer::plus_menu::chat_invitees;
17use crate::views::composer::plus_menu::chat_invitees;
17use crate::views::new_meeting_dialog::open_new_meeting_with;
18use crate::views::new_meeting_dialog::open_new_meeting_with;
18use crate::views::avatar::status_glyph;
19use crate::views::avatar::status_glyph;
19use crate::views::widgets::{icon, menu_icon, symbol};
20use crate::views::widgets::{icon, menu_icon, symbol};
20
21
21pub const CHAT_HEADER_MORE_TAG: &str = "chat-header-more";
22pub const CHAT_HEADER_MORE_TAG: &str = "chat-header-more";
23pub const CHANNEL_HEADER_MORE_TAG: &str = "channel-header-more";
22const SCHEDULE_MEETING_LABEL: &str = "Schedule meeting";
24const SCHEDULE_MEETING_LABEL: &str = "Schedule meeting";
23const BUTTON_SIZE: f32 = 32.;
25const BUTTON_SIZE: f32 = 32.;
24const HEADER_COMPACT_WIDTH: f32 = 480.;
26const HEADER_COMPACT_WIDTH: f32 = 480.;
@@ -46,6 +48,37 @@ impl ConversationView {
46 )
48 )
47 }
49 }
48
50
51 pub(super) fn channel_more_button(&self, cx: &App) -> Option<AnyElement> {
52 let Selection::Channel(channel_id) = &self.current.as_ref()?.selection else {
53 return None;
54 };
55 if self.pinned || self.popped_out {
56 return None;
57 }
58 let notifications = self
59 .app
60 .read(cx)
61 .sidebar
62 .teams
63 .iter()
64 .find(|entry| entry.channels.iter().any(|channel| &channel.id == channel_id))?
65 .channel_notifications(channel_id);
66 let (state, channel_id) = (self.app.clone(), channel_id.clone());
67 Some(
68 Button::new(CHANNEL_HEADER_MORE_TAG)
69 .icon(IconName::Ellipsis)
70 .ghost()
71 .size(px(BUTTON_SIZE))
72 .rounded(px(8.))
73 .tooltip("More channel options")
74 .debug_selector(|| CHANNEL_HEADER_MORE_TAG.into())
75 .dropdown_menu(move |popup, window, cx| {
76 channel_menu(popup, window, cx, state.clone(), &channel_id, notifications)
77 })
78 .into_any_element(),
79 )
80 }
81
49 pub(super) fn header_overflows(&self) -> bool {
82 pub(super) fn header_overflows(&self) -> bool {
50 let width = self.header_width.get();
83 let width = self.header_width.get();
51 width > 0.
84 width > 0.
crates/app/src/views/conversation/feed.rs +13 −1
@@ -48,6 +48,12 @@ impl ConversationView {
48 48 .update(cx, |composer, cx| composer.focus(window, cx));
49 49 }
50 50
51 pub(super) fn open_new_announcement(&mut self, window: &mut Window, cx: &mut Context<Self>) {
52 self.mark_new_post_open(cx);
53 self.composer
54 .update(cx, |composer, cx| composer.begin_announcement(window, cx));
55 }
56
51 57 fn mark_new_post_open(&mut self, cx: &mut Context<Self>) {
52 58 self.new_post_open = true;
53 59 let subject = self.subject.clone();
@@ -270,9 +276,15 @@ impl ConversationView {
270 276 let proposal_card = self.render_proposal_card(cx);
271 277 if !self.new_post_open {
272 278 let view = cx.entity().downgrade();
279 let announce_view = view.clone();
273 280 let open: PostAction = Box::new(move |window, cx| {
274 281 view.update(cx, |this, cx| this.open_new_post(window, cx)).ok();
275 282 });
283 let announce: PostAction = Box::new(move |window, cx| {
284 announce_view
285 .update(cx, |this, cx| this.open_new_announcement(window, cx))
286 .ok();
287 });
276 288 return Some(
277 289 v_flex()
278 290 .w_full()
@@ -284,7 +296,7 @@ impl ConversationView {
284 296 .flex_none()
285 297 .px(px(20.))
286 298 .py(px(12.))
287 .child(post_in_channel_card(&self.app.read(cx).directory, open)),
299 .child(post_in_channel_card(&self.app.read(cx).directory, open, announce)),
288 300 )
289 301 .into_any_element(),
290 302 );
@@ -48,6 +48,12 @@ impl ConversationView {
48 .update(cx, |composer, cx| composer.focus(window, cx));
48 .update(cx, |composer, cx| composer.focus(window, cx));
49 }
49 }
50
50
51 pub(super) fn open_new_announcement(&mut self, window: &mut Window, cx: &mut Context<Self>) {
52 self.mark_new_post_open(cx);
53 self.composer
54 .update(cx, |composer, cx| composer.begin_announcement(window, cx));
55 }
56
51 fn mark_new_post_open(&mut self, cx: &mut Context<Self>) {
57 fn mark_new_post_open(&mut self, cx: &mut Context<Self>) {
52 self.new_post_open = true;
58 self.new_post_open = true;
53 let subject = self.subject.clone();
59 let subject = self.subject.clone();
@@ -270,9 +276,15 @@ impl ConversationView {
270 let proposal_card = self.render_proposal_card(cx);
276 let proposal_card = self.render_proposal_card(cx);
271 if !self.new_post_open {
277 if !self.new_post_open {
272 let view = cx.entity().downgrade();
278 let view = cx.entity().downgrade();
279 let announce_view = view.clone();
273 let open: PostAction = Box::new(move |window, cx| {
280 let open: PostAction = Box::new(move |window, cx| {
274 view.update(cx, |this, cx| this.open_new_post(window, cx)).ok();
281 view.update(cx, |this, cx| this.open_new_post(window, cx)).ok();
275 });
282 });
283 let announce: PostAction = Box::new(move |window, cx| {
284 announce_view
285 .update(cx, |this, cx| this.open_new_announcement(window, cx))
286 .ok();
287 });
276 return Some(
288 return Some(
277 v_flex()
289 v_flex()
278 .w_full()
290 .w_full()
@@ -284,7 +296,7 @@ impl ConversationView {
284 .flex_none()
296 .flex_none()
285 .px(px(20.))
297 .px(px(20.))
286 .py(px(12.))
298 .py(px(12.))
287 .child(post_in_channel_card(&self.app.read(cx).directory, open)),
299 .child(post_in_channel_card(&self.app.read(cx).directory, open, announce)),
288 )
300 )
289 .into_any_element(),
301 .into_any_element(),
290 );
302 );
crates/app/src/views/post_card.rs +36 −15
@@ -46,6 +46,8 @@ const NEW_BADGE_HEIGHT: f32 = 20.;
46 46 const NEW_LABEL: &str = "New";
47 47 const POST_IN_CHANNEL: &str = "Post in channel";
48 48 const POST_LABEL: &str = "Post";
49 const ANNOUNCEMENT_LABEL: &str = "Announcement";
50 pub const POST_IN_CHANNEL_ANNOUNCE_TAG: &str = "post-in-channel/announcement";
49 51 pub const POST_CARD_TAG: &str = "post-card";
50 52 pub const POST_AVATAR_TAG: &str = "post-card/avatar";
51 53 pub const POST_BODY_TAG: &str = "post-card/body";
@@ -453,7 +455,27 @@ fn reply_footer(
453 455 )
454 456 }
455 457
456 pub fn post_in_channel_card(directory: &Directory, open: PostAction) -> AnyElement {
458 fn card_action(label: &'static str, glyph: IconName, primary: bool) -> Div {
459 let color = if primary {
460 theme::accent_text()
461 } else {
462 theme::text()
463 };
464 h_flex()
465 .h(px(32.))
466 .px(px(12.))
467 .gap(px(6.))
468 .items_center()
469 .rounded(px(6.))
470 .when(primary, |action| action.bg(theme::reply_surface()))
471 .text_size(px(13.))
472 .font_weight(FontWeight::SEMIBOLD)
473 .text_color(color)
474 .child(icon(glyph, 14., color))
475 .child(label)
476 }
477
478 pub fn post_in_channel_card(directory: &Directory, open: PostAction, announce: PostAction) -> AnyElement {
457 479 let own_avatar = directory.me.as_ref().map(|me| {
458 480 div().flex_none().child(person_avatar(
459 481 directory,
@@ -486,20 +508,19 @@ pub fn post_in_channel_card(directory: &Directory, open: PostAction) -> AnyEleme
486 508 ),
487 509 )
488 510 .child(
489 h_flex().child(
490 h_flex()
491 .h(px(32.))
492 .px(px(12.))
493 .gap(px(6.))
494 .items_center()
495 .rounded(px(6.))
496 .bg(theme::reply_surface())
497 .text_size(px(13.))
498 .font_weight(FontWeight::SEMIBOLD)
499 .text_color(theme::accent_text())
500 .child(icon(IconName::MessageSquare, 14., theme::accent_text()))
501 .child(POST_LABEL),
502 ),
511 h_flex()
512 .gap(px(4.))
513 .child(card_action(POST_LABEL, IconName::MessageSquare, true))
514 .child(
515 card_action(ANNOUNCEMENT_LABEL, IconName::Megaphone, false)
516 .id(POST_IN_CHANNEL_ANNOUNCE_TAG)
517 .debug_selector(|| POST_IN_CHANNEL_ANNOUNCE_TAG.into())
518 .hover(|action| action.bg(theme::reply_surface()))
519 .on_click(move |_, window, cx| {
520 cx.stop_propagation();
521 announce(window, cx);
522 }),
523 ),
503 524 )
504 525 .into_any_element()
505 526 }
@@ -46,6 +46,8 @@ const NEW_BADGE_HEIGHT: f32 = 20.;
46const NEW_LABEL: &str = "New";
46const NEW_LABEL: &str = "New";
47const POST_IN_CHANNEL: &str = "Post in channel";
47const POST_IN_CHANNEL: &str = "Post in channel";
48const POST_LABEL: &str = "Post";
48const POST_LABEL: &str = "Post";
49const ANNOUNCEMENT_LABEL: &str = "Announcement";
50pub const POST_IN_CHANNEL_ANNOUNCE_TAG: &str = "post-in-channel/announcement";
49pub const POST_CARD_TAG: &str = "post-card";
51pub const POST_CARD_TAG: &str = "post-card";
50pub const POST_AVATAR_TAG: &str = "post-card/avatar";
52pub const POST_AVATAR_TAG: &str = "post-card/avatar";
51pub const POST_BODY_TAG: &str = "post-card/body";
53pub const POST_BODY_TAG: &str = "post-card/body";
@@ -453,7 +455,27 @@ fn reply_footer(
453 )
455 )
454}
456}
455
457
456pub fn post_in_channel_card(directory: &Directory, open: PostAction) -> AnyElement {
458fn card_action(label: &'static str, glyph: IconName, primary: bool) -> Div {
459 let color = if primary {
460 theme::accent_text()
461 } else {
462 theme::text()
463 };
464 h_flex()
465 .h(px(32.))
466 .px(px(12.))
467 .gap(px(6.))
468 .items_center()
469 .rounded(px(6.))
470 .when(primary, |action| action.bg(theme::reply_surface()))
471 .text_size(px(13.))
472 .font_weight(FontWeight::SEMIBOLD)
473 .text_color(color)
474 .child(icon(glyph, 14., color))
475 .child(label)
476}
477
478pub fn post_in_channel_card(directory: &Directory, open: PostAction, announce: PostAction) -> AnyElement {
457 let own_avatar = directory.me.as_ref().map(|me| {
479 let own_avatar = directory.me.as_ref().map(|me| {
458 div().flex_none().child(person_avatar(
480 div().flex_none().child(person_avatar(
459 directory,
481 directory,
@@ -486,20 +508,19 @@ pub fn post_in_channel_card(directory: &Directory, open: PostAction) -> AnyEleme
486 ),
508 ),
487 )
509 )
488 .child(
510 .child(
489 h_flex().child(
511 h_flex()
490 h_flex()
512 .gap(px(4.))
491 .h(px(32.))
513 .child(card_action(POST_LABEL, IconName::MessageSquare, true))
492 .px(px(12.))
514 .child(
493 .gap(px(6.))
515 card_action(ANNOUNCEMENT_LABEL, IconName::Megaphone, false)
494 .items_center()
516 .id(POST_IN_CHANNEL_ANNOUNCE_TAG)
495 .rounded(px(6.))
517 .debug_selector(|| POST_IN_CHANNEL_ANNOUNCE_TAG.into())
496 .bg(theme::reply_surface())
518 .hover(|action| action.bg(theme::reply_surface()))
497 .text_size(px(13.))
519 .on_click(move |_, window, cx| {
498 .font_weight(FontWeight::SEMIBOLD)
520 cx.stop_propagation();
499 .text_color(theme::accent_text())
521 announce(window, cx);
500 .child(icon(IconName::MessageSquare, 14., theme::accent_text()))
522 }),
501 .child(POST_LABEL),
523 ),
502 ),
503 )
524 )
504 .into_any_element()
525 .into_any_element()
505}
526}
crates/app/src/views/sidebar.rs +1 −1
@@ -1829,7 +1829,7 @@ fn notification_badge(level: ChannelNotificationLevel) -> Option<impl IntoElemen
1829 1829 Some(icon(name, NOTIFICATION_ICON_SIZE, theme::text_muted()))
1830 1830 }
1831 1831
1832 fn channel_menu(
1832 pub(crate) fn channel_menu(
1833 1833 popup: PopupMenu,
1834 1834 window: &mut Window,
1835 1835 cx: &mut Context<PopupMenu>,
@@ -1829,7 +1829,7 @@ fn notification_badge(level: ChannelNotificationLevel) -> Option<impl IntoElemen
1829 Some(icon(name, NOTIFICATION_ICON_SIZE, theme::text_muted()))
1829 Some(icon(name, NOTIFICATION_ICON_SIZE, theme::text_muted()))
1830}
1830}
1831
1831
1832fn channel_menu(
1832pub(crate) fn channel_menu(
1833 popup: PopupMenu,
1833 popup: PopupMenu,
1834 window: &mut Window,
1834 window: &mut Window,
1835 cx: &mut Context<PopupMenu>,
1835 cx: &mut Context<PopupMenu>,