fix(chat): narrow chat header keeps its title
- under 480 px header width Find, Copilot and chat details move into the More menu - no avatar, no divider and smaller gaps there, so the title and More stay visible Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@@ -122,6 +122,7 @@ const QUIET_RETRY_DELAYS: [Duration; 3] = [
122
122
const HEADER_HEIGHT: f32 = 60.;
123
123
const HEADER_PADDING: f32 = 20.;
124
124
const HEADER_GAP: f32 = 12.;
125
const HEADER_COMPACT_GAP: f32 = 4.;
125
126
const POP_IN_BUTTON_SIZE: f32 = 32.;
126
127
const HEADER_LEAD_SIZE: f32 = 36.;
127
128
const TABS_INLINE_MIN_WIDTH: f32 = 560.;
@@ -3761,7 +3762,9 @@ impl ConversationView {
3761
3762
.to_owned();
3762
3763
}
3763
3764
let inline_tabs = tabs.map(|tabs| h_flex().h_full().flex_1().child(tabs));
3764
let divided = matches!(current.selection, Selection::Chat(_))
3765
let overflow = self.header_overflows();
3766
let divided = !overflow
3767
&& matches!(current.selection, Selection::Chat(_))
3765
3768
&& (!call_controls.is_empty() || stack.is_some());
3766
3769
header
3767
3770
.relative()
@@ -3769,7 +3772,8 @@ impl ConversationView {
3769
3772
.when(sync.shown_at.is_some() || loading_window, |header| {
3770
3773
header.child(progress_bar())
3771
3774
})
3772
.children(lead)
3775
.when(overflow, |header| header.gap(px(HEADER_COMPACT_GAP)))
3776
.when(!overflow, |header| header.children(lead))
3773
3777
.child(
3774
3778
v_flex()
3775
3779
.map(|column| match inline_tabs {
@@ -3810,11 +3814,14 @@ impl ConversationView {
3810
3814
.children(call_controls)
3811
3815
.children(stack)
3812
3816
.when(divided, |header| header.child(header_divider()))
3813
.children(self.copilot_button(cx))
3814
.children(self.chat_find_button(cx))
3817
.when(!overflow, |header| {
3818
header
3819
.children(self.copilot_button(cx))
3820
.children(self.chat_find_button(cx))
3821
})
3815
3822
.children(self.channel_find_button(cx))
3816
.children(self.channel_details_button(cx))
3817
.children(self.chat_more_button(cx))
3823
.when(!overflow, |header| header.children(self.channel_details_button(cx)))
3824
.children(self.chat_more_button(overflow, cx))
3818
3825
.children(self.pop_in_button(current))
3819
3826
}
3820
3827
@@ -122,6 +122,7 @@ const QUIET_RETRY_DELAYS: [Duration; 3] = [122
const HEADER_HEIGHT: f32 = 60.;122
const HEADER_HEIGHT: f32 = 60.;123
const HEADER_PADDING: f32 = 20.;123
const HEADER_PADDING: f32 = 20.;124
const HEADER_GAP: f32 = 12.;124
const HEADER_GAP: f32 = 12.;125
const HEADER_COMPACT_GAP: f32 = 4.;125
const POP_IN_BUTTON_SIZE: f32 = 32.;126
const POP_IN_BUTTON_SIZE: f32 = 32.;126
const HEADER_LEAD_SIZE: f32 = 36.;127
const HEADER_LEAD_SIZE: f32 = 36.;127
const TABS_INLINE_MIN_WIDTH: f32 = 560.;128
const TABS_INLINE_MIN_WIDTH: f32 = 560.;@@ -3761,7 +3762,9 @@ impl ConversationView {3761
.to_owned();3762
.to_owned();3762
}3763
}3763
let inline_tabs = tabs.map(|tabs| h_flex().h_full().flex_1().child(tabs));3764
let inline_tabs = tabs.map(|tabs| h_flex().h_full().flex_1().child(tabs));3764
let divided = matches!(current.selection, Selection::Chat(_))3765
let overflow = self.header_overflows();3766
let divided = !overflow3767
&& matches!(current.selection, Selection::Chat(_))3765
&& (!call_controls.is_empty() || stack.is_some());3768
&& (!call_controls.is_empty() || stack.is_some());3766
header3769
header3767
.relative()3770
.relative()@@ -3769,7 +3772,8 @@ impl ConversationView {3769
.when(sync.shown_at.is_some() || loading_window, |header| {3772
.when(sync.shown_at.is_some() || loading_window, |header| {3770
header.child(progress_bar())3773
header.child(progress_bar())3771
})3774
})3772
.children(lead)3775
.when(overflow, |header| header.gap(px(HEADER_COMPACT_GAP)))3776
.when(!overflow, |header| header.children(lead))3773
.child(3777
.child(3774
v_flex()3778
v_flex()3775
.map(|column| match inline_tabs {3779
.map(|column| match inline_tabs {@@ -3810,11 +3814,14 @@ impl ConversationView {3810
.children(call_controls)3814
.children(call_controls)3811
.children(stack)3815
.children(stack)3812
.when(divided, |header| header.child(header_divider()))3816
.when(divided, |header| header.child(header_divider()))3813
.children(self.copilot_button(cx))3817
.when(!overflow, |header| {3814
.children(self.chat_find_button(cx))3818
header3819
.children(self.copilot_button(cx))3820
.children(self.chat_find_button(cx))3821
})3815
.children(self.channel_find_button(cx))3822
.children(self.channel_find_button(cx))3816
.children(self.channel_details_button(cx))3823
.when(!overflow, |header| header.children(self.channel_details_button(cx)))3817
.children(self.chat_more_button(cx))3824
.children(self.chat_more_button(overflow, cx))3818
.children(self.pop_in_button(current))3825
.children(self.pop_in_button(current))3819
}3826
}3820
3827
@@ -142,7 +142,7 @@ impl ConversationView {
142
142
}
143
143
}
144
144
145
fn details_labels(&self) -> (&'static str, &'static str) {
145
pub(super) fn details_labels(&self) -> (&'static str, &'static str) {
146
146
if self.details_channel_id().is_some() {
147
147
(OPEN_LABEL, CLOSE_LABEL)
148
148
} else {
@@ -180,20 +180,22 @@ impl ConversationView {
180
180
.size(px(BUTTON_SIZE))
181
181
.rounded(px(8.))
182
182
.tooltip(if open { close_label } else { open_label })
183
.on_click(cx.listener(|this, _, _, cx| {
184
this.channel_details_open = !this.channel_details_open;
185
this.pinned_posts_expanded = false;
186
if this.channel_details_open {
187
this.find_panel = None;
188
this.find_subscription = None;
189
this.refresh_shared_items(cx);
190
}
191
cx.notify();
192
}))
183
.on_click(cx.listener(|this, _, _, cx| this.toggle_details(cx)))
193
184
.into_any_element(),
194
185
)
195
186
}
196
187
188
pub(super) fn toggle_details(&mut self, cx: &mut Context<Self>) {
189
self.channel_details_open = !self.channel_details_open;
190
self.pinned_posts_expanded = false;
191
if self.channel_details_open {
192
self.find_panel = None;
193
self.find_subscription = None;
194
self.refresh_shared_items(cx);
195
}
196
cx.notify();
197
}
198
197
199
pub(super) fn render_channel_details(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
198
200
if !self.channel_details_open {
199
201
return None;
@@ -142,7 +142,7 @@ impl ConversationView {142
}142
}143
}143
}144
144
145
fn details_labels(&self) -> (&'static str, &'static str) {145
pub(super) fn details_labels(&self) -> (&'static str, &'static str) {146
if self.details_channel_id().is_some() {146
if self.details_channel_id().is_some() {147
(OPEN_LABEL, CLOSE_LABEL)147
(OPEN_LABEL, CLOSE_LABEL)148
} else {148
} else {@@ -180,20 +180,22 @@ impl ConversationView {180
.size(px(BUTTON_SIZE))180
.size(px(BUTTON_SIZE))181
.rounded(px(8.))181
.rounded(px(8.))182
.tooltip(if open { close_label } else { open_label })182
.tooltip(if open { close_label } else { open_label })183
.on_click(cx.listener(|this, _, _, cx| {183
.on_click(cx.listener(|this, _, _, cx| this.toggle_details(cx)))184
this.channel_details_open = !this.channel_details_open;185
this.pinned_posts_expanded = false;186
if this.channel_details_open {187
this.find_panel = None;188
this.find_subscription = None;189
this.refresh_shared_items(cx);190
}191
cx.notify();192
}))193
.into_any_element(),184
.into_any_element(),194
)185
)195
}186
}196
187
188
pub(super) fn toggle_details(&mut self, cx: &mut Context<Self>) {189
self.channel_details_open = !self.channel_details_open;190
self.pinned_posts_expanded = false;191
if self.channel_details_open {192
self.find_panel = None;193
self.find_subscription = None;194
self.refresh_shared_items(cx);195
}196
cx.notify();197
}198
197
pub(super) fn render_channel_details(&self, cx: &mut Context<Self>) -> Option<AnyElement> {199
pub(super) fn render_channel_details(&self, cx: &mut Context<Self>) -> Option<AnyElement> {198
if !self.channel_details_open {200
if !self.channel_details_open {199
return None;201
return None;@@ -21,6 +21,7 @@ use crate::views::widgets::{icon, menu_icon, symbol};
21
21
pub const CHAT_HEADER_MORE_TAG: &str = "chat-header-more";
22
22
const SCHEDULE_MEETING_LABEL: &str = "Schedule meeting";
23
23
const BUTTON_SIZE: f32 = 32.;
24
const HEADER_COMPACT_WIDTH: f32 = 480.;
24
25
const COUNT_GLYPH: f32 = 16.;
25
26
26
27
impl ConversationView {
@@ -45,12 +46,29 @@ impl ConversationView {
45
46
)
46
47
}
47
48
48
pub(super) fn chat_more_button(&self, cx: &App) -> Option<AnyElement> {
49
pub(super) fn header_overflows(&self) -> bool {
50
let width = self.header_width.get();
51
width > 0.
52
&& width < HEADER_COMPACT_WIDTH
53
&& !self.popped_out
54
&& !self.pinned
55
&& self.header_chat_id().is_some()
56
}
57
58
pub(super) fn chat_more_button(&self, overflow: bool, cx: &Context<Self>) -> Option<AnyElement> {
49
59
let chat_id = self
50
60
.header_chat_id()
51
61
.filter(|_| !self.popped_out && !self.pinned)?;
52
62
let target = ChatMenuTarget::for_chat(self.app.read(cx), chat_id)?;
53
63
let context = MenuContext::new(&self.app, cx);
64
let view = cx.entity().downgrade();
65
let (open_details, close_details) = self.details_labels();
66
let details_label = if self.channel_details_open {
67
close_details
68
} else {
69
open_details
70
};
71
let copilot_label = self.copilot_label();
54
72
Some(
55
73
Button::new(CHAT_HEADER_MORE_TAG)
56
74
.icon(IconName::Ellipsis)
@@ -60,6 +78,11 @@ impl ConversationView {
60
78
.tooltip("More chat options")
61
79
.debug_selector(|| CHAT_HEADER_MORE_TAG.into())
62
80
.dropdown_menu(move |popup, window, cx| {
81
let popup = if overflow {
82
overflow_items(popup, view.clone(), copilot_label, details_label)
83
} else {
84
popup
85
};
63
86
let popup = if is_notes_chat(&target.id) {
64
87
popup
65
88
} else {
@@ -72,6 +95,41 @@ impl ConversationView {
72
95
}
73
96
}
74
97
98
fn overflow_items(
99
popup: PopupMenu,
100
view: WeakEntity<ConversationView>,
101
copilot_label: &'static str,
102
details_label: &'static str,
103
) -> PopupMenu {
104
let (find_view, details_view) = (view.clone(), view.clone());
105
popup
106
.item(
107
PopupMenuItem::new(FIND_IN_CHAT)
108
.icon(menu_icon(IconName::Search))
109
.on_click(move |_, window, cx| {
110
find_view
111
.update(cx, |this, cx| this.open_find(window, cx))
112
.ok();
113
}),
114
)
115
.item(
116
PopupMenuItem::new(copilot_label)
117
.icon(menu_icon(IconName::Bot))
118
.on_click(move |_, window, cx| {
119
view.update(cx, |this, cx| this.toggle_copilot(window, cx))
120
.ok();
121
}),
122
)
123
.item(
124
PopupMenuItem::new(details_label)
125
.icon(menu_icon(IconName::PanelRight))
126
.on_click(move |_, _, cx| {
127
details_view.update(cx, |this, cx| this.toggle_details(cx)).ok();
128
}),
129
)
130
.separator()
131
}
132
75
133
fn schedule_meeting_item(popup: PopupMenu, context: &MenuContext, chat_id: &str) -> PopupMenu {
76
134
let (state, chat_id) = (context.state.clone(), chat_id.to_owned());
77
135
popup
@@ -21,6 +21,7 @@ use crate::views::widgets::{icon, menu_icon, symbol};21
pub const CHAT_HEADER_MORE_TAG: &str = "chat-header-more";21
pub const CHAT_HEADER_MORE_TAG: &str = "chat-header-more";22
const SCHEDULE_MEETING_LABEL: &str = "Schedule meeting";22
const SCHEDULE_MEETING_LABEL: &str = "Schedule meeting";23
const BUTTON_SIZE: f32 = 32.;23
const BUTTON_SIZE: f32 = 32.;24
const HEADER_COMPACT_WIDTH: f32 = 480.;24
const COUNT_GLYPH: f32 = 16.;25
const COUNT_GLYPH: f32 = 16.;25
26
26
impl ConversationView {27
impl ConversationView {@@ -45,12 +46,29 @@ impl ConversationView {45
)46
)46
}47
}47
48
48
pub(super) fn chat_more_button(&self, cx: &App) -> Option<AnyElement> {49
pub(super) fn header_overflows(&self) -> bool {50
let width = self.header_width.get();51
width > 0.52
&& width < HEADER_COMPACT_WIDTH53
&& !self.popped_out54
&& !self.pinned55
&& self.header_chat_id().is_some()56
}57
58
pub(super) fn chat_more_button(&self, overflow: bool, cx: &Context<Self>) -> Option<AnyElement> {49
let chat_id = self59
let chat_id = self50
.header_chat_id()60
.header_chat_id()51
.filter(|_| !self.popped_out && !self.pinned)?;61
.filter(|_| !self.popped_out && !self.pinned)?;52
let target = ChatMenuTarget::for_chat(self.app.read(cx), chat_id)?;62
let target = ChatMenuTarget::for_chat(self.app.read(cx), chat_id)?;53
let context = MenuContext::new(&self.app, cx);63
let context = MenuContext::new(&self.app, cx);64
let view = cx.entity().downgrade();65
let (open_details, close_details) = self.details_labels();66
let details_label = if self.channel_details_open {67
close_details68
} else {69
open_details70
};71
let copilot_label = self.copilot_label();54
Some(72
Some(55
Button::new(CHAT_HEADER_MORE_TAG)73
Button::new(CHAT_HEADER_MORE_TAG)56
.icon(IconName::Ellipsis)74
.icon(IconName::Ellipsis)@@ -60,6 +78,11 @@ impl ConversationView {60
.tooltip("More chat options")78
.tooltip("More chat options")61
.debug_selector(|| CHAT_HEADER_MORE_TAG.into())79
.debug_selector(|| CHAT_HEADER_MORE_TAG.into())62
.dropdown_menu(move |popup, window, cx| {80
.dropdown_menu(move |popup, window, cx| {81
let popup = if overflow {82
overflow_items(popup, view.clone(), copilot_label, details_label)83
} else {84
popup85
};63
let popup = if is_notes_chat(&target.id) {86
let popup = if is_notes_chat(&target.id) {64
popup87
popup65
} else {88
} else {@@ -72,6 +95,41 @@ impl ConversationView {72
}95
}73
}96
}74
97
98
fn overflow_items(99
popup: PopupMenu,100
view: WeakEntity<ConversationView>,101
copilot_label: &'static str,102
details_label: &'static str,103
) -> PopupMenu {104
let (find_view, details_view) = (view.clone(), view.clone());105
popup106
.item(107
PopupMenuItem::new(FIND_IN_CHAT)108
.icon(menu_icon(IconName::Search))109
.on_click(move |_, window, cx| {110
find_view111
.update(cx, |this, cx| this.open_find(window, cx))112
.ok();113
}),114
)115
.item(116
PopupMenuItem::new(copilot_label)117
.icon(menu_icon(IconName::Bot))118
.on_click(move |_, window, cx| {119
view.update(cx, |this, cx| this.toggle_copilot(window, cx))120
.ok();121
}),122
)123
.item(124
PopupMenuItem::new(details_label)125
.icon(menu_icon(IconName::PanelRight))126
.on_click(move |_, _, cx| {127
details_view.update(cx, |this, cx| this.toggle_details(cx)).ok();128
}),129
)130
.separator()131
}132
75
fn schedule_meeting_item(popup: PopupMenu, context: &MenuContext, chat_id: &str) -> PopupMenu {133
fn schedule_meeting_item(popup: PopupMenu, context: &MenuContext, chat_id: &str) -> PopupMenu {76
let (state, chat_id) = (context.state.clone(), chat_id.to_owned());134
let (state, chat_id) = (context.state.clone(), chat_id.to_owned());77
popup135
popup@@ -70,6 +70,10 @@ impl ConversationView {
70
70
}
71
71
}
72
72
73
pub(super) fn copilot_label(&self) -> &'static str {
74
if self.copilot.open { CLOSE_LABEL } else { OPEN_LABEL }
75
}
76
73
77
pub(super) fn copilot_button(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
74
78
self.copilot_chat_id()?;
75
79
let open = self.copilot.open;
@@ -86,7 +90,7 @@ impl ConversationView {
86
90
)
87
91
}
88
92
89
fn toggle_copilot(&mut self, window: &mut Window, cx: &mut Context<Self>) {
93
pub(super) fn toggle_copilot(&mut self, window: &mut Window, cx: &mut Context<Self>) {
90
94
self.copilot.open = !self.copilot.open;
91
95
if self.copilot.open && self.copilot.input.is_none() {
92
96
let input = cx.new(|cx| InputState::new(window, cx).placeholder(PLACEHOLDER));
@@ -70,6 +70,10 @@ impl ConversationView {70
}70
}71
}71
}72
72
73
pub(super) fn copilot_label(&self) -> &'static str {74
if self.copilot.open { CLOSE_LABEL } else { OPEN_LABEL }75
}76
73
pub(super) fn copilot_button(&self, cx: &mut Context<Self>) -> Option<AnyElement> {77
pub(super) fn copilot_button(&self, cx: &mut Context<Self>) -> Option<AnyElement> {74
self.copilot_chat_id()?;78
self.copilot_chat_id()?;75
let open = self.copilot.open;79
let open = self.copilot.open;@@ -86,7 +90,7 @@ impl ConversationView {86
)90
)87
}91
}88
92
89
fn toggle_copilot(&mut self, window: &mut Window, cx: &mut Context<Self>) {93
pub(super) fn toggle_copilot(&mut self, window: &mut Window, cx: &mut Context<Self>) {90
self.copilot.open = !self.copilot.open;94
self.copilot.open = !self.copilot.open;91
if self.copilot.open && self.copilot.input.is_none() {95
if self.copilot.open && self.copilot.input.is_none() {92
let input = cx.new(|cx| InputState::new(window, cx).placeholder(PLACEHOLDER));96
let input = cx.new(|cx| InputState::new(window, cx).placeholder(PLACEHOLDER));