fix(sidebar): filter pills Unread, Chats, Meeting chats like Teams
- no more-filters chevron; @Mentions and Muted show only while active (shortcuts) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -28,10 +28,10 @@ pub enum ChatFilterPill {
28
28
impl ChatFilterPill {
29
29
pub const PRIMARY: [ChatFilterPill; 3] = [
30
30
ChatFilterPill::Unread,
31
ChatFilterPill::Mentions,
32
31
ChatFilterPill::Chats,
32
ChatFilterPill::Meetings,
33
33
];
34
pub const OVERFLOW: [ChatFilterPill; 2] = [ChatFilterPill::Meetings, ChatFilterPill::Muted];
34
pub const OVERFLOW: [ChatFilterPill; 2] = [ChatFilterPill::Mentions, ChatFilterPill::Muted];
35
35
36
36
pub fn label(self) -> &'static str {
37
37
match self {
@@ -28,10 +28,10 @@ pub enum ChatFilterPill {28
impl ChatFilterPill {28
impl ChatFilterPill {29
pub const PRIMARY: [ChatFilterPill; 3] = [29
pub const PRIMARY: [ChatFilterPill; 3] = [30
ChatFilterPill::Unread,30
ChatFilterPill::Unread,31
ChatFilterPill::Mentions,32
ChatFilterPill::Chats,31
ChatFilterPill::Chats,32
ChatFilterPill::Meetings,33
];33
];34
pub const OVERFLOW: [ChatFilterPill; 2] = [ChatFilterPill::Meetings, ChatFilterPill::Muted];34
pub const OVERFLOW: [ChatFilterPill; 2] = [ChatFilterPill::Mentions, ChatFilterPill::Muted];35
35
36
pub fn label(self) -> &'static str {36
pub fn label(self) -> &'static str {37
match self {37
match self {@@ -358,7 +358,6 @@ pub struct SidebarView {
358
358
channel_filter_open: bool,
359
359
channel_filter_input: Option<Entity<InputState>>,
360
360
channel_filter_subscription: Option<Subscription>,
361
more_filters_open: bool,
362
361
filter_input: Option<Entity<InputState>>,
363
362
filter_subscription: Option<Subscription>,
364
363
last_views: LastViews,
@@ -483,7 +482,6 @@ impl SidebarView {
483
482
channel_filter_open: false,
484
483
channel_filter_input: None,
485
484
channel_filter_subscription: None,
486
more_filters_open: false,
487
485
filter_input: None,
488
486
filter_subscription: None,
489
487
last_views: LastViews::default(),
@@ -358,7 +358,6 @@ pub struct SidebarView {358
channel_filter_open: bool,358
channel_filter_open: bool,359
channel_filter_input: Option<Entity<InputState>>,359
channel_filter_input: Option<Entity<InputState>>,360
channel_filter_subscription: Option<Subscription>,360
channel_filter_subscription: Option<Subscription>,361
more_filters_open: bool,362
filter_input: Option<Entity<InputState>>,361
filter_input: Option<Entity<InputState>>,363
filter_subscription: Option<Subscription>,362
filter_subscription: Option<Subscription>,364
last_views: LastViews,363
last_views: LastViews,@@ -483,7 +482,6 @@ impl SidebarView {483
channel_filter_open: false,482
channel_filter_open: false,484
channel_filter_input: None,483
channel_filter_input: None,485
channel_filter_subscription: None,484
channel_filter_subscription: None,486
more_filters_open: false,487
filter_input: None,485
filter_input: None,488
filter_subscription: None,486
filter_subscription: None,489
last_views: LastViews::default(),487
last_views: LastViews::default(),@@ -9,8 +9,8 @@ use gpui_kit::*;
9
9
use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarTab, SidebarView};
10
10
use crate::app_state::Selection;
11
11
use crate::chat_filter::{
12
CLEAR_FILTER_TEXT, CLEAR_FILTERS, CLOSE_FILTER_TEXT, ChatFilterPill, FEWER_FILTERS,
13
FILTER_PLACEHOLDER, MORE_FILTERS, NO_MATCHES, SHOW_FILTER_TEXT, mentioned_conversations,
12
CLEAR_FILTER_TEXT, CLEAR_FILTERS, CLOSE_FILTER_TEXT, ChatFilterPill,
13
FILTER_PLACEHOLDER, NO_MATCHES, SHOW_FILTER_TEXT, mentioned_conversations,
14
14
};
15
15
use crate::theme;
16
16
use crate::views::widgets::icon;
@@ -198,24 +198,15 @@ impl SidebarView {
198
198
}
199
199
200
200
fn filter_pills(&self, cx: &mut Context<Self>) -> impl IntoElement {
201
let overflow_active = ChatFilterPill::OVERFLOW
202
.iter()
203
.any(|pill| self.chat_filter.has(*pill));
204
let show_overflow = self.more_filters_open || overflow_active;
205
let mut pills: Vec<AnyElement> = ChatFilterPill::PRIMARY
201
let pills: Vec<AnyElement> = ChatFilterPill::PRIMARY
206
202
.into_iter()
207
.map(|pill| self.filter_pill(pill, cx).into_any_element())
208
.collect();
209
if show_overflow {
210
pills.extend(
203
.chain(
211
204
ChatFilterPill::OVERFLOW
212
205
.into_iter()
213
.map(|pill| self.filter_pill(pill, cx).into_any_element()),
214
);
215
}
216
if !overflow_active {
217
pills.push(self.more_filters_button(cx).into_any_element());
218
}
206
.filter(|pill| self.chat_filter.has(*pill)),
207
)
208
.map(|pill| self.filter_pill(pill, cx).into_any_element())
209
.collect();
219
210
h_flex()
220
211
.debug_selector(|| FILTER_PILLS_TAG.into())
221
212
.px(px(SIDE_INSET))
@@ -257,36 +248,6 @@ impl SidebarView {
257
248
})
258
249
}
259
250
260
fn more_filters_button(&self, cx: &mut Context<Self>) -> impl IntoElement {
261
let open = self.more_filters_open;
262
let label = if open { FEWER_FILTERS } else { MORE_FILTERS };
263
div()
264
.id("chat-filter-more")
265
.size(px(PILL_HEIGHT))
266
.flex()
267
.flex_none()
268
.items_center()
269
.justify_center()
270
.rounded_full()
271
.cursor_pointer()
272
.bg(theme::surface_raised())
273
.hover(|chip| chip.bg(theme::border_strong()))
274
.tooltip(move |window, cx| Tooltip::new(label).build(window, cx))
275
.child(icon(
276
if open {
277
IconName::ChevronUp
278
} else {
279
IconName::ChevronDown
280
},
281
14.,
282
theme::text_soft(),
283
))
284
.on_click(cx.listener(|this, _, _, cx| {
285
this.more_filters_open = !this.more_filters_open;
286
cx.notify();
287
}))
288
}
289
290
251
pub(super) fn filter_empty_state(&self, cx: &mut Context<Self>) -> impl IntoElement {
291
252
v_flex()
292
253
.debug_selector(|| FILTER_EMPTY_TAG.into())
@@ -9,8 +9,8 @@ use gpui_kit::*;9
use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarTab, SidebarView};9
use super::{NEW_CHAT_BUTTON_SIZE, SidebarEvent, SidebarTab, SidebarView};10
use crate::app_state::Selection;10
use crate::app_state::Selection;11
use crate::chat_filter::{11
use crate::chat_filter::{12
CLEAR_FILTER_TEXT, CLEAR_FILTERS, CLOSE_FILTER_TEXT, ChatFilterPill, FEWER_FILTERS,12
CLEAR_FILTER_TEXT, CLEAR_FILTERS, CLOSE_FILTER_TEXT, ChatFilterPill,13
FILTER_PLACEHOLDER, MORE_FILTERS, NO_MATCHES, SHOW_FILTER_TEXT, mentioned_conversations,13
FILTER_PLACEHOLDER, NO_MATCHES, SHOW_FILTER_TEXT, mentioned_conversations,14
};14
};15
use crate::theme;15
use crate::theme;16
use crate::views::widgets::icon;16
use crate::views::widgets::icon;@@ -198,24 +198,15 @@ impl SidebarView {198
}198
}199
199
200
fn filter_pills(&self, cx: &mut Context<Self>) -> impl IntoElement {200
fn filter_pills(&self, cx: &mut Context<Self>) -> impl IntoElement {201
let overflow_active = ChatFilterPill::OVERFLOW201
let pills: Vec<AnyElement> = ChatFilterPill::PRIMARY202
.iter()203
.any(|pill| self.chat_filter.has(*pill));204
let show_overflow = self.more_filters_open || overflow_active;205
let mut pills: Vec<AnyElement> = ChatFilterPill::PRIMARY206
.into_iter()202
.into_iter()207
.map(|pill| self.filter_pill(pill, cx).into_any_element())203
.chain(208
.collect();209
if show_overflow {210
pills.extend(211
ChatFilterPill::OVERFLOW204
ChatFilterPill::OVERFLOW212
.into_iter()205
.into_iter()213
.map(|pill| self.filter_pill(pill, cx).into_any_element()),206
.filter(|pill| self.chat_filter.has(*pill)),214
);207
)215
}208
.map(|pill| self.filter_pill(pill, cx).into_any_element())216
if !overflow_active {209
.collect();217
pills.push(self.more_filters_button(cx).into_any_element());218
}219
h_flex()210
h_flex()220
.debug_selector(|| FILTER_PILLS_TAG.into())211
.debug_selector(|| FILTER_PILLS_TAG.into())221
.px(px(SIDE_INSET))212
.px(px(SIDE_INSET))@@ -257,36 +248,6 @@ impl SidebarView {257
})248
})258
}249
}259
250
260
fn more_filters_button(&self, cx: &mut Context<Self>) -> impl IntoElement {261
let open = self.more_filters_open;262
let label = if open { FEWER_FILTERS } else { MORE_FILTERS };263
div()264
.id("chat-filter-more")265
.size(px(PILL_HEIGHT))266
.flex()267
.flex_none()268
.items_center()269
.justify_center()270
.rounded_full()271
.cursor_pointer()272
.bg(theme::surface_raised())273
.hover(|chip| chip.bg(theme::border_strong()))274
.tooltip(move |window, cx| Tooltip::new(label).build(window, cx))275
.child(icon(276
if open {277
IconName::ChevronUp278
} else {279
IconName::ChevronDown280
},281
14.,282
theme::text_soft(),283
))284
.on_click(cx.listener(|this, _, _, cx| {285
this.more_filters_open = !this.more_filters_open;286
cx.notify();287
}))288
}289
290
pub(super) fn filter_empty_state(&self, cx: &mut Context<Self>) -> impl IntoElement {251
pub(super) fn filter_empty_state(&self, cx: &mut Context<Self>) -> impl IntoElement {291
v_flex()252
v_flex()292
.debug_selector(|| FILTER_EMPTY_TAG.into())253
.debug_selector(|| FILTER_EMPTY_TAG.into())