BlueGit

ict rusty-teams

feat(ui): scroll edge lines and header tabs inside the top bar

- scroll_edge::with_top_edge: 1 px border line over a scroll area's top edge, edge to edge, only while scrolled
- applied to chat list, channel list, activity, calls, saved, agents, settings body, call transcript
- conversation header: tabs (Posts/Shared/app tabs, Chat/Recap) inline after the title, 3 px accent indicator, one line under the whole top bar (Teams entity header border-bottom)
- narrow headers (< 560 px) put the tabs in a second row inside the top bar
- layout_guard: chat list line only while scrolled and spanning the sidebar, tabs sit right above the header line; call chat bubbles may be clipped vertically by the list
- deviation: the chat list line is ours, Teams draws none in the list pane (Look may differ)

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

metis Daniel Däschle · pushed by metis

Authored 2026-10-17 · 6 weeks ago

Hash
82b1df8e39603105ec01facfce4e46f58edef2eb
Parent
4bb89d42
14 files changed +374 −74
crates/app-ui-kit/src/channel_tabs.rs +41 −28
@@ -12,16 +12,16 @@ use teams_core::channel_tab_link;
12 12
13 13 use app_base::theme;
14 14
15 const BAR_HEIGHT: f32 = 36.;
16 const TAB_HEIGHT: f32 = 28.;
17 15 const TAB_GAP: f32 = 4.;
18 const TAB_PADDING: f32 = 12.;
19 const TAB_TEXT_SIZE: f32 = 12.5;
20 const BAR_PADDING: f32 = 20.;
21 const CHAR_WIDTH: f32 = 6.5;
16 const TAB_PADDING: f32 = 10.;
17 const TAB_TEXT_SIZE: f32 = 14.;
18 const INDICATOR_HEIGHT: f32 = 3.;
19 const CHAR_WIDTH: f32 = 7.5;
22 20 const ARROW_WIDTH: f32 = 14.;
23 21 const OVERFLOW_WIDTH: f32 = 44.;
24 22 const EXTERNAL_ARROW: &str = "\u{2197}";
23 const TITLE_CHAR_WIDTH: f32 = 8.;
24 pub const HEADER_TITLE_MAX_WIDTH: f32 = 240.;
25 25
26 26 pub const POSTS_LABEL: &str = "Posts";
27 27 pub const SHARED_LABEL: &str = "Shared";
@@ -68,6 +68,10 @@ fn label_width(label: &str, external: bool) -> f32 {
68 68 + if external { ARROW_WIDTH } else { 0. }
69 69 }
70 70
71 pub fn header_title_width(title: &str) -> f32 {
72 (title.chars().count() as f32 * TITLE_CHAR_WIDTH).min(HEADER_TITLE_MAX_WIDTH)
73 }
74
71 75 pub fn visible_tab_count(tabs: &[ChannelTabRecord], available_width: f32) -> usize {
72 76 let fixed = label_width(POSTS_LABEL, false) + TAB_GAP + label_width(SHARED_LABEL, false);
73 77 let widths: Vec<f32> = tabs
@@ -102,14 +106,13 @@ fn tab_label(
102 106 };
103 107 h_flex()
104 108 .id(id)
105 .h(px(TAB_HEIGHT))
109 .relative()
110 .h_full()
106 111 .flex_none()
107 112 .items_center()
108 113 .gap(px(4.))
109 114 .px(px(TAB_PADDING))
110 .rounded(px(7.))
111 115 .cursor_pointer()
112 .when(active, |tab| tab.bg(theme::surface_raised()))
113 116 .text_size(px(TAB_TEXT_SIZE))
114 117 .font_weight(if active {
115 118 FontWeight::SEMIBOLD
@@ -123,6 +126,22 @@ fn tab_label(
123 126 .when(external, |tab| {
124 127 tab.child(div().text_color(theme::text_faint()).child(EXTERNAL_ARROW))
125 128 })
129 .when(active, |tab| tab.child(indicator()))
130 }
131
132 fn indicator() -> Div {
133 div()
134 .absolute()
135 .bottom_0()
136 .left(px(TAB_PADDING))
137 .right(px(TAB_PADDING))
138 .h(px(INDICATOR_HEIGHT))
139 .rounded_full()
140 .bg(theme::accent())
141 }
142
143 fn header_tab_row() -> Div {
144 h_flex().h_full().gap(px(TAB_GAP)).items_center()
126 145 }
127 146
128 147 fn overflow_button(hidden: &[(usize, String)], actions: &TabBarActions) -> impl IntoElement {
@@ -149,7 +168,7 @@ pub fn render_tab_bar(
149 168 available_width: f32,
150 169 actions: &TabBarActions,
151 170 ) -> AnyElement {
152 let visible = visible_tab_count(tabs, available_width - 2. * BAR_PADDING);
171 let visible = visible_tab_count(tabs, available_width);
153 172 let select = actions.select.clone();
154 173 let posts = tab_label(
155 174 "channel-tab-posts".into(),
@@ -184,13 +203,7 @@ pub fn render_tab_bar(
184 203 .skip(visible)
185 204 .map(|(index, tab)| (index, tab.name.clone()))
186 205 .collect();
187 h_flex()
188 .w_full()
189 .h(px(BAR_HEIGHT))
190 .flex_none()
191 .px(px(BAR_PADDING))
192 .gap(px(TAB_GAP))
193 .items_center()
206 header_tab_row()
194 207 .child(posts)
195 208 .child(shared)
196 209 .children(configured)
@@ -219,23 +232,17 @@ pub fn render_meeting_bar(pane: ChannelPane, select: SelectPane) -> AnyElement {
219 232 move |_, cx| select(ChannelPane::Recap, cx),
220 233 )
221 234 .debug_selector(|| "shell/islands/main/recap-tab".into());
222 h_flex()
223 .w_full()
224 .h(px(BAR_HEIGHT))
225 .flex_none()
226 .px(px(BAR_PADDING))
227 .gap(px(TAB_GAP))
228 .items_center()
229 .child(chat)
230 .child(recap)
231 .into_any_element()
235 header_tab_row().child(chat).child(recap).into_any_element()
232 236 }
233 237
234 238 #[cfg(test)]
235 239 mod tests {
236 240 use store::ChannelTabRecord;
237 241
238 use super::{TabAction, fallback_tab_link, tab_action, visible_tab_count};
242 use super::{
243 HEADER_TITLE_MAX_WIDTH, TabAction, fallback_tab_link, header_title_width, tab_action,
244 visible_tab_count,
245 };
239 246
240 247 fn tab(name: &str, open_url: Option<&str>) -> ChannelTabRecord {
241 248 ChannelTabRecord {
@@ -288,6 +295,12 @@ mod tests {
288 295 );
289 296 }
290 297
298 #[test]
299 fn long_header_titles_are_capped() {
300 assert_eq!(header_title_width("General"), 56.);
301 assert_eq!(header_title_width(&"x".repeat(80)), HEADER_TITLE_MAX_WIDTH);
302 }
303
291 304 #[test]
292 305 fn every_tab_stays_visible_while_it_fits() {
293 306 let tabs = [tab("Docs", None), tab("Planner", None)];
@@ -12,16 +12,16 @@ use teams_core::channel_tab_link;
12
12
13use app_base::theme;
13use app_base::theme;
14
14
15const BAR_HEIGHT: f32 = 36.;
16const TAB_HEIGHT: f32 = 28.;
17const TAB_GAP: f32 = 4.;
15const TAB_GAP: f32 = 4.;
18const TAB_PADDING: f32 = 12.;
16const TAB_PADDING: f32 = 10.;
19const TAB_TEXT_SIZE: f32 = 12.5;
17const TAB_TEXT_SIZE: f32 = 14.;
20const BAR_PADDING: f32 = 20.;
18const INDICATOR_HEIGHT: f32 = 3.;
21const CHAR_WIDTH: f32 = 6.5;
19const CHAR_WIDTH: f32 = 7.5;
22const ARROW_WIDTH: f32 = 14.;
20const ARROW_WIDTH: f32 = 14.;
23const OVERFLOW_WIDTH: f32 = 44.;
21const OVERFLOW_WIDTH: f32 = 44.;
24const EXTERNAL_ARROW: &str = "\u{2197}";
22const EXTERNAL_ARROW: &str = "\u{2197}";
23const TITLE_CHAR_WIDTH: f32 = 8.;
24pub const HEADER_TITLE_MAX_WIDTH: f32 = 240.;
25
25
26pub const POSTS_LABEL: &str = "Posts";
26pub const POSTS_LABEL: &str = "Posts";
27pub const SHARED_LABEL: &str = "Shared";
27pub const SHARED_LABEL: &str = "Shared";
@@ -68,6 +68,10 @@ fn label_width(label: &str, external: bool) -> f32 {
68 + if external { ARROW_WIDTH } else { 0. }
68 + if external { ARROW_WIDTH } else { 0. }
69}
69}
70
70
71pub fn header_title_width(title: &str) -> f32 {
72 (title.chars().count() as f32 * TITLE_CHAR_WIDTH).min(HEADER_TITLE_MAX_WIDTH)
73}
74
71pub fn visible_tab_count(tabs: &[ChannelTabRecord], available_width: f32) -> usize {
75pub fn visible_tab_count(tabs: &[ChannelTabRecord], available_width: f32) -> usize {
72 let fixed = label_width(POSTS_LABEL, false) + TAB_GAP + label_width(SHARED_LABEL, false);
76 let fixed = label_width(POSTS_LABEL, false) + TAB_GAP + label_width(SHARED_LABEL, false);
73 let widths: Vec<f32> = tabs
77 let widths: Vec<f32> = tabs
@@ -102,14 +106,13 @@ fn tab_label(
102 };
106 };
103 h_flex()
107 h_flex()
104 .id(id)
108 .id(id)
105 .h(px(TAB_HEIGHT))
109 .relative()
110 .h_full()
106 .flex_none()
111 .flex_none()
107 .items_center()
112 .items_center()
108 .gap(px(4.))
113 .gap(px(4.))
109 .px(px(TAB_PADDING))
114 .px(px(TAB_PADDING))
110 .rounded(px(7.))
111 .cursor_pointer()
115 .cursor_pointer()
112 .when(active, |tab| tab.bg(theme::surface_raised()))
113 .text_size(px(TAB_TEXT_SIZE))
116 .text_size(px(TAB_TEXT_SIZE))
114 .font_weight(if active {
117 .font_weight(if active {
115 FontWeight::SEMIBOLD
118 FontWeight::SEMIBOLD
@@ -123,6 +126,22 @@ fn tab_label(
123 .when(external, |tab| {
126 .when(external, |tab| {
124 tab.child(div().text_color(theme::text_faint()).child(EXTERNAL_ARROW))
127 tab.child(div().text_color(theme::text_faint()).child(EXTERNAL_ARROW))
125 })
128 })
129 .when(active, |tab| tab.child(indicator()))
130}
131
132fn indicator() -> Div {
133 div()
134 .absolute()
135 .bottom_0()
136 .left(px(TAB_PADDING))
137 .right(px(TAB_PADDING))
138 .h(px(INDICATOR_HEIGHT))
139 .rounded_full()
140 .bg(theme::accent())
141}
142
143fn header_tab_row() -> Div {
144 h_flex().h_full().gap(px(TAB_GAP)).items_center()
126}
145}
127
146
128fn overflow_button(hidden: &[(usize, String)], actions: &TabBarActions) -> impl IntoElement {
147fn overflow_button(hidden: &[(usize, String)], actions: &TabBarActions) -> impl IntoElement {
@@ -149,7 +168,7 @@ pub fn render_tab_bar(
149 available_width: f32,
168 available_width: f32,
150 actions: &TabBarActions,
169 actions: &TabBarActions,
151) -> AnyElement {
170) -> AnyElement {
152 let visible = visible_tab_count(tabs, available_width - 2. * BAR_PADDING);
171 let visible = visible_tab_count(tabs, available_width);
153 let select = actions.select.clone();
172 let select = actions.select.clone();
154 let posts = tab_label(
173 let posts = tab_label(
155 "channel-tab-posts".into(),
174 "channel-tab-posts".into(),
@@ -184,13 +203,7 @@ pub fn render_tab_bar(
184 .skip(visible)
203 .skip(visible)
185 .map(|(index, tab)| (index, tab.name.clone()))
204 .map(|(index, tab)| (index, tab.name.clone()))
186 .collect();
205 .collect();
187 h_flex()
206 header_tab_row()
188 .w_full()
189 .h(px(BAR_HEIGHT))
190 .flex_none()
191 .px(px(BAR_PADDING))
192 .gap(px(TAB_GAP))
193 .items_center()
194 .child(posts)
207 .child(posts)
195 .child(shared)
208 .child(shared)
196 .children(configured)
209 .children(configured)
@@ -219,23 +232,17 @@ pub fn render_meeting_bar(pane: ChannelPane, select: SelectPane) -> AnyElement {
219 move |_, cx| select(ChannelPane::Recap, cx),
232 move |_, cx| select(ChannelPane::Recap, cx),
220 )
233 )
221 .debug_selector(|| "shell/islands/main/recap-tab".into());
234 .debug_selector(|| "shell/islands/main/recap-tab".into());
222 h_flex()
235 header_tab_row().child(chat).child(recap).into_any_element()
223 .w_full()
224 .h(px(BAR_HEIGHT))
225 .flex_none()
226 .px(px(BAR_PADDING))
227 .gap(px(TAB_GAP))
228 .items_center()
229 .child(chat)
230 .child(recap)
231 .into_any_element()
232}
236}
233
237
234#[cfg(test)]
238#[cfg(test)]
235mod tests {
239mod tests {
236 use store::ChannelTabRecord;
240 use store::ChannelTabRecord;
237
241
238 use super::{TabAction, fallback_tab_link, tab_action, visible_tab_count};
242 use super::{
243 HEADER_TITLE_MAX_WIDTH, TabAction, fallback_tab_link, header_title_width, tab_action,
244 visible_tab_count,
245 };
239
246
240 fn tab(name: &str, open_url: Option<&str>) -> ChannelTabRecord {
247 fn tab(name: &str, open_url: Option<&str>) -> ChannelTabRecord {
241 ChannelTabRecord {
248 ChannelTabRecord {
@@ -288,6 +295,12 @@ mod tests {
288 );
295 );
289 }
296 }
290
297
298 #[test]
299 fn long_header_titles_are_capped() {
300 assert_eq!(header_title_width("General"), 56.);
301 assert_eq!(header_title_width(&"x".repeat(80)), HEADER_TITLE_MAX_WIDTH);
302 }
303
291 #[test]
304 #[test]
292 fn every_tab_stays_visible_while_it_fits() {
305 fn every_tab_stays_visible_while_it_fits() {
293 let tabs = [tab("Docs", None), tab("Planner", None)];
306 let tabs = [tab("Docs", None), tab("Planner", None)];
crates/app-ui-kit/src/lib.rs +1 −0
@@ -4,6 +4,7 @@ pub mod draft_style;
4 4 pub mod layout;
5 5 pub mod reaction_proposal_pill;
6 6 pub mod render;
7 pub mod scroll_edge;
7 8 pub mod settings_controls;
8 9 pub mod spinner;
9 10 pub mod widgets;
@@ -4,6 +4,7 @@ pub mod draft_style;
4pub mod layout;
4pub mod layout;
5pub mod reaction_proposal_pill;
5pub mod reaction_proposal_pill;
6pub mod render;
6pub mod render;
7pub mod scroll_edge;
7pub mod settings_controls;
8pub mod settings_controls;
8pub mod spinner;
9pub mod spinner;
9pub mod widgets;
10pub mod widgets;
crates/app-ui-kit/src/scroll_edge.rs added +82 −0
@@ -0,0 +1,82 @@
1 use gpui_kit::prelude::FluentBuilder as _;
2 use gpui_kit::*;
3
4 use app_base::theme;
5
6 pub const EDGE_THICKNESS: f32 = 1.;
7 const SCROLLED_THRESHOLD: f32 = 0.5;
8
9 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
10 pub enum EdgeRule {
11 Always,
12 WhenScrolled,
13 }
14
15 pub fn content_hidden_above(offset_y: Pixels) -> bool {
16 f32::from(offset_y) < -SCROLLED_THRESHOLD
17 }
18
19 pub fn edge_visible(rule: EdgeRule, offset_y: Pixels) -> bool {
20 match rule {
21 EdgeRule::Always => true,
22 EdgeRule::WhenScrolled => content_hidden_above(offset_y),
23 }
24 }
25
26 pub fn edge_divider(tag: &'static str) -> Div {
27 div()
28 .debug_selector(move || tag.into())
29 .w_full()
30 .h(px(EDGE_THICKNESS))
31 .flex_none()
32 .bg(theme::border())
33 }
34
35 pub fn with_top_edge(
36 scroll_area: impl IntoElement,
37 handle: &ScrollHandle,
38 tag: &'static str,
39 ) -> Div {
40 let visible = edge_visible(EdgeRule::WhenScrolled, handle.offset().y);
41 div()
42 .relative()
43 .flex()
44 .flex_col()
45 .flex_1()
46 .min_h_0()
47 .w_full()
48 .child(scroll_area)
49 .when(visible, |area| {
50 area.child(edge_divider(tag).absolute().top_0().left_0().right_0())
51 })
52 }
53
54 #[cfg(test)]
55 mod tests {
56 use gpui_kit::px;
57
58 use super::{EdgeRule, content_hidden_above, edge_visible};
59
60 #[test]
61 fn the_list_at_its_top_shows_no_line() {
62 assert!(!content_hidden_above(px(0.)));
63 assert!(!edge_visible(EdgeRule::WhenScrolled, px(0.)));
64 }
65
66 #[test]
67 fn subpixel_jitter_at_the_top_shows_no_line() {
68 assert!(!edge_visible(EdgeRule::WhenScrolled, px(-0.3)));
69 }
70
71 #[test]
72 fn a_scrolled_list_shows_the_line() {
73 assert!(edge_visible(EdgeRule::WhenScrolled, px(-1.)));
74 assert!(edge_visible(EdgeRule::WhenScrolled, px(-480.)));
75 }
76
77 #[test]
78 fn a_fixed_header_always_shows_the_line() {
79 assert!(edge_visible(EdgeRule::Always, px(0.)));
80 assert!(edge_visible(EdgeRule::Always, px(-20.)));
81 }
82 }
@@ -0,0 +1,82 @@
1use gpui_kit::prelude::FluentBuilder as _;
2use gpui_kit::*;
3
4use app_base::theme;
5
6pub const EDGE_THICKNESS: f32 = 1.;
7const SCROLLED_THRESHOLD: f32 = 0.5;
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum EdgeRule {
11 Always,
12 WhenScrolled,
13}
14
15pub fn content_hidden_above(offset_y: Pixels) -> bool {
16 f32::from(offset_y) < -SCROLLED_THRESHOLD
17}
18
19pub fn edge_visible(rule: EdgeRule, offset_y: Pixels) -> bool {
20 match rule {
21 EdgeRule::Always => true,
22 EdgeRule::WhenScrolled => content_hidden_above(offset_y),
23 }
24}
25
26pub fn edge_divider(tag: &'static str) -> Div {
27 div()
28 .debug_selector(move || tag.into())
29 .w_full()
30 .h(px(EDGE_THICKNESS))
31 .flex_none()
32 .bg(theme::border())
33}
34
35pub fn with_top_edge(
36 scroll_area: impl IntoElement,
37 handle: &ScrollHandle,
38 tag: &'static str,
39) -> Div {
40 let visible = edge_visible(EdgeRule::WhenScrolled, handle.offset().y);
41 div()
42 .relative()
43 .flex()
44 .flex_col()
45 .flex_1()
46 .min_h_0()
47 .w_full()
48 .child(scroll_area)
49 .when(visible, |area| {
50 area.child(edge_divider(tag).absolute().top_0().left_0().right_0())
51 })
52}
53
54#[cfg(test)]
55mod tests {
56 use gpui_kit::px;
57
58 use super::{EdgeRule, content_hidden_above, edge_visible};
59
60 #[test]
61 fn the_list_at_its_top_shows_no_line() {
62 assert!(!content_hidden_above(px(0.)));
63 assert!(!edge_visible(EdgeRule::WhenScrolled, px(0.)));
64 }
65
66 #[test]
67 fn subpixel_jitter_at_the_top_shows_no_line() {
68 assert!(!edge_visible(EdgeRule::WhenScrolled, px(-0.3)));
69 }
70
71 #[test]
72 fn a_scrolled_list_shows_the_line() {
73 assert!(edge_visible(EdgeRule::WhenScrolled, px(-1.)));
74 assert!(edge_visible(EdgeRule::WhenScrolled, px(-480.)));
75 }
76
77 #[test]
78 fn a_fixed_header_always_shows_the_line() {
79 assert!(edge_visible(EdgeRule::Always, px(0.)));
80 assert!(edge_visible(EdgeRule::Always, px(-20.)));
81 }
82}
crates/app/src/agents/agents_panel.rs +5 −2
@@ -6,8 +6,10 @@ use gpui_kit::*;
6 6 use super::runs::{AgentRun, AgentRuns, RunState};
7 7 use super::spinner::spinner;
8 8 use crate::theme;
9 use crate::views::scroll_edge::with_top_edge;
9 10 use crate::views::widgets::icon;
10 11
12 const AGENTS_SCROLL_DIVIDER: &str = "shell/islands/sidebar/agents/divider-scroll";
11 13 const DONE_LIMIT: usize = 50;
12 14 const HISTORY_WINDOW: usize = 60;
13 15 const EMPTY_TEXT: &str = "No agent runs yet. Hover a message and click the robot button.";
@@ -139,7 +141,7 @@ impl Render for AgentsPanel {
139 141 finished.into_iter().cloned().collect(),
140 142 );
141 143 let empty = running.is_empty() && finished.is_empty();
142 v_flex()
144 let list = v_flex()
143 145 .id("agents-list")
144 146 .debug_selector(|| "shell/islands/sidebar/agents".into())
145 147 .flex_1()
@@ -167,7 +169,8 @@ impl Render for AgentsPanel {
167 169 .text_color(theme::text_muted())
168 170 .child(EMPTY_TEXT),
169 171 )
170 })
172 });
173 with_top_edge(list, &self.scroll, AGENTS_SCROLL_DIVIDER)
171 174 }
172 175 }
173 176
@@ -6,8 +6,10 @@ use gpui_kit::*;
6use super::runs::{AgentRun, AgentRuns, RunState};
6use super::runs::{AgentRun, AgentRuns, RunState};
7use super::spinner::spinner;
7use super::spinner::spinner;
8use crate::theme;
8use crate::theme;
9use crate::views::scroll_edge::with_top_edge;
9use crate::views::widgets::icon;
10use crate::views::widgets::icon;
10
11
12const AGENTS_SCROLL_DIVIDER: &str = "shell/islands/sidebar/agents/divider-scroll";
11const DONE_LIMIT: usize = 50;
13const DONE_LIMIT: usize = 50;
12const HISTORY_WINDOW: usize = 60;
14const HISTORY_WINDOW: usize = 60;
13const EMPTY_TEXT: &str = "No agent runs yet. Hover a message and click the robot button.";
15const EMPTY_TEXT: &str = "No agent runs yet. Hover a message and click the robot button.";
@@ -139,7 +141,7 @@ impl Render for AgentsPanel {
139 finished.into_iter().cloned().collect(),
141 finished.into_iter().cloned().collect(),
140 );
142 );
141 let empty = running.is_empty() && finished.is_empty();
143 let empty = running.is_empty() && finished.is_empty();
142 v_flex()
144 let list = v_flex()
143 .id("agents-list")
145 .id("agents-list")
144 .debug_selector(|| "shell/islands/sidebar/agents".into())
146 .debug_selector(|| "shell/islands/sidebar/agents".into())
145 .flex_1()
147 .flex_1()
@@ -167,7 +169,8 @@ impl Render for AgentsPanel {
167 .text_color(theme::text_muted())
169 .text_color(theme::text_muted())
168 .child(EMPTY_TEXT),
170 .child(EMPTY_TEXT),
169 )
171 )
170 })
172 });
173 with_top_edge(list, &self.scroll, AGENTS_SCROLL_DIVIDER)
171 }
174 }
172}
175}
173
176
crates/app/src/layout_guard.rs +103 −2
@@ -177,7 +177,7 @@ mod frames {
177 177 use crate::views::call_transcript::TranscriptPanel;
178 178 use crate::views::call_view::CHAT_PANEL_TAG;
179 179 use crate::views::composer::{COMPOSER_BOX_TAG, COMPOSER_LEADING_TAG, COMPOSER_SEND_TAG};
180 use crate::views::conversation::MEMBERS_BUTTON;
180 use crate::views::conversation::{HEADER_DIVIDER, MEMBERS_BUTTON};
181 181 use crate::views::message_row::BUBBLE_TAGS;
182 182 use crate::views::proposal_card::{PROPOSAL_BUTTONS, PROPOSAL_CARD, PROPOSAL_THUMBNAILS};
183 183 use crate::views::reaction_proposal_pill::REACTION_PILL;
@@ -188,6 +188,7 @@ mod frames {
188 188 use crate::views::shortcuts::{
189 189 OpenActivity, OpenAgents, OpenCallsTab, OpenChannelsTab, OpenSaved,
190 190 };
191 use crate::views::sidebar::SIDEBAR_SCROLL_DIVIDER;
191 192
192 193 const GUARDED: &[&str] = &[
193 194 "shell",
@@ -270,6 +271,9 @@ mod frames {
270 271 const SETTINGS_CONTENT: &str = "settings/main/body/content";
271 272 const MEMBERS_TAGS: &[&str] = &["chat-members-popup", "chat-members-popup/divider"];
272 273 const MEMBERS_CHAT: &str = "demo-chat-release";
274 const SIDEBAR: &str = "shell/islands/sidebar";
275 const MAIN: &str = "shell/islands/main";
276 const EDGE_DIVIDERS: &[&str] = &[SIDEBAR_SCROLL_DIVIDER, HEADER_DIVIDER];
273 277 const DIVIDER_SEGMENT: &str = "divider";
274 278 const DIVIDER_THICKNESS: f32 = 1.;
275 279 const INSET_TOLERANCE: f32 = 1.;
@@ -558,6 +562,7 @@ mod frames {
558 562 .chain(&AGENT_TAGS)
559 563 .chain(SETTINGS_TAGS)
560 564 .chain(MEMBERS_TAGS)
565 .chain(EDGE_DIVIDERS)
561 566 .filter_map(|path| visual.debug_bounds(path).map(|bounds| (*path, bounds)))
562 567 .collect()
563 568 }
@@ -1031,7 +1036,9 @@ mod frames {
1031 1036 assert!(!bubbles.is_empty(), "no bubbles rendered in the call chat");
1032 1037 let found: Vec<String> = bubbles
1033 1038 .into_iter()
1034 .filter(|(_, bounds)| !contains(panel, *bounds))
1039 .filter(|(_, bounds)| {
1040 !inside_horizontally(panel, *bounds) || !overlaps(panel, *bounds)
1041 })
1035 1042 .map(|(index, bounds)| {
1036 1043 format!(
1037 1044 "call-chat@{width}x{height}: bubble {index} {} leaves the chat panel {}",
@@ -1050,6 +1057,100 @@ mod frames {
1050 1057 }
1051 1058 }
1052 1059
1060 fn inside_horizontally(outer: Bounds<Pixels>, inner: Bounds<Pixels>) -> bool {
1061 let tolerance = px(TOLERANCE);
1062 inner.left() >= outer.left() - tolerance && inner.right() <= outer.right() + tolerance
1063 }
1064
1065 fn scroll_sidebar(visual: &mut VisualTestContext, delta: f32) {
1066 let sidebar = visual.debug_bounds(SIDEBAR).expect("sidebar rendered");
1067 visual.simulate_event(ScrollWheelEvent {
1068 position: sidebar.center(),
1069 delta: ScrollDelta::Pixels(point(px(0.), px(delta))),
1070 ..Default::default()
1071 });
1072 }
1073
1074 #[gpui_kit::test]
1075 fn chat_list_line_shows_only_while_scrolled(cx: &mut TestAppContext) {
1076 let (handle, _) = mount(cx);
1077 let mut visual = VisualTestContext::from_window(handle, cx);
1078 for (width, height) in SIZES {
1079 visual.simulate_resize(size(px(width), px(height)));
1080 let window = Bounds {
1081 origin: point(px(0.), px(0.)),
1082 size: size(px(width), px(height)),
1083 };
1084 collect(&mut visual, None);
1085 scroll_sidebar(&mut visual, 100_000.);
1086 let tags = collect(&mut visual, None);
1087 assert!(
1088 visual.debug_bounds(SIDEBAR_SCROLL_DIVIDER).is_none(),
1089 "chat list at its top must not show the line at {width}x{height}"
1090 );
1091 scroll_sidebar(&mut visual, -120.);
1092 let scrolled = collect(&mut visual, Some(SIDEBAR_SCROLL_DIVIDER));
1093 let sidebar = visual.debug_bounds(SIDEBAR).expect("sidebar rendered");
1094 let line = visual
1095 .debug_bounds(SIDEBAR_SCROLL_DIVIDER)
1096 .expect("scrolled chat list shows the line");
1097 assert!(
1098 line.top() > sidebar.top() + px(TOLERANCE),
1099 "the line sits under the Chats header, not on the island edge: {} in {}",
1100 describe(line),
1101 describe(sidebar)
1102 );
1103 let found: Vec<String> = violations(&scrolled, window, &[SIDEBAR_SCROLL_DIVIDER])
1104 .into_iter()
1105 .chain(violations(&tags, window, &[]))
1106 .map(|(key, message)| format!("chat-list@{width}x{height}:{key}: {message}"))
1107 .collect();
1108 assert!(found.is_empty(), "{}", found.join("\n"));
1109 scroll_sidebar(&mut visual, 100_000.);
1110 collect(&mut visual, None);
1111 assert!(
1112 visual.debug_bounds(SIDEBAR_SCROLL_DIVIDER).is_none(),
1113 "the line goes away once the chat list is back at its top"
1114 );
1115 }
1116 }
1117
1118 #[gpui_kit::test]
1119 fn header_tabs_sit_above_the_header_line(cx: &mut TestAppContext) {
1120 let (handle, state) = mount(cx);
1121 let mut visual = VisualTestContext::from_window(handle, cx);
1122 for (width, height) in SIZES {
1123 visual.simulate_resize(size(px(width), px(height)));
1124 let window = Bounds {
1125 origin: point(px(0.), px(0.)),
1126 size: size(px(width), px(height)),
1127 };
1128 visual.update(|_, cx| {
1129 state.update(cx, |state, cx| {
1130 state.select(Selection::Chat(RECAP_MEETING_CHAT.to_owned()), cx)
1131 })
1132 });
1133 let tags = collect(&mut visual, Some(RECAP_TAB));
1134 let main = visual.debug_bounds(MAIN).expect("main island rendered");
1135 let tab = visual.debug_bounds(RECAP_TAB).expect("recap tab rendered");
1136 let line = visual
1137 .debug_bounds(HEADER_DIVIDER)
1138 .expect("the header line is always shown");
1139 let near = |first: Pixels, second: Pixels| f32::from(first - second).abs() <= TOLERANCE;
1140 assert!(
1141 tab.top() >= main.top() && near(tab.bottom(), line.top()),
1142 "tab {} must sit in the top bar above the line {}",
1143 describe(tab),
1144 describe(line)
1145 );
1146 let found: Vec<String> = violations(&tags, window, &[HEADER_DIVIDER, RECAP_TAB])
1147 .into_iter()
1148 .map(|(key, message)| format!("header@{width}x{height}:{key}: {message}"))
1149 .collect();
1150 assert!(found.is_empty(), "{}", found.join("\n"));
1151 }
1152 }
1153
1053 1154 #[gpui_kit::test]
1054 1155 fn recap_tab_stays_inside_the_main_island(cx: &mut TestAppContext) {
1055 1156 let (handle, state) = mount(cx);
@@ -177,7 +177,7 @@ mod frames {
177 use crate::views::call_transcript::TranscriptPanel;
177 use crate::views::call_transcript::TranscriptPanel;
178 use crate::views::call_view::CHAT_PANEL_TAG;
178 use crate::views::call_view::CHAT_PANEL_TAG;
179 use crate::views::composer::{COMPOSER_BOX_TAG, COMPOSER_LEADING_TAG, COMPOSER_SEND_TAG};
179 use crate::views::composer::{COMPOSER_BOX_TAG, COMPOSER_LEADING_TAG, COMPOSER_SEND_TAG};
180 use crate::views::conversation::MEMBERS_BUTTON;
180 use crate::views::conversation::{HEADER_DIVIDER, MEMBERS_BUTTON};
181 use crate::views::message_row::BUBBLE_TAGS;
181 use crate::views::message_row::BUBBLE_TAGS;
182 use crate::views::proposal_card::{PROPOSAL_BUTTONS, PROPOSAL_CARD, PROPOSAL_THUMBNAILS};
182 use crate::views::proposal_card::{PROPOSAL_BUTTONS, PROPOSAL_CARD, PROPOSAL_THUMBNAILS};
183 use crate::views::reaction_proposal_pill::REACTION_PILL;
183 use crate::views::reaction_proposal_pill::REACTION_PILL;
@@ -188,6 +188,7 @@ mod frames {
188 use crate::views::shortcuts::{
188 use crate::views::shortcuts::{
189 OpenActivity, OpenAgents, OpenCallsTab, OpenChannelsTab, OpenSaved,
189 OpenActivity, OpenAgents, OpenCallsTab, OpenChannelsTab, OpenSaved,
190 };
190 };
191 use crate::views::sidebar::SIDEBAR_SCROLL_DIVIDER;
191
192
192 const GUARDED: &[&str] = &[
193 const GUARDED: &[&str] = &[
193 "shell",
194 "shell",
@@ -270,6 +271,9 @@ mod frames {
270 const SETTINGS_CONTENT: &str = "settings/main/body/content";
271 const SETTINGS_CONTENT: &str = "settings/main/body/content";
271 const MEMBERS_TAGS: &[&str] = &["chat-members-popup", "chat-members-popup/divider"];
272 const MEMBERS_TAGS: &[&str] = &["chat-members-popup", "chat-members-popup/divider"];
272 const MEMBERS_CHAT: &str = "demo-chat-release";
273 const MEMBERS_CHAT: &str = "demo-chat-release";
274 const SIDEBAR: &str = "shell/islands/sidebar";
275 const MAIN: &str = "shell/islands/main";
276 const EDGE_DIVIDERS: &[&str] = &[SIDEBAR_SCROLL_DIVIDER, HEADER_DIVIDER];
273 const DIVIDER_SEGMENT: &str = "divider";
277 const DIVIDER_SEGMENT: &str = "divider";
274 const DIVIDER_THICKNESS: f32 = 1.;
278 const DIVIDER_THICKNESS: f32 = 1.;
275 const INSET_TOLERANCE: f32 = 1.;
279 const INSET_TOLERANCE: f32 = 1.;
@@ -558,6 +562,7 @@ mod frames {
558 .chain(&AGENT_TAGS)
562 .chain(&AGENT_TAGS)
559 .chain(SETTINGS_TAGS)
563 .chain(SETTINGS_TAGS)
560 .chain(MEMBERS_TAGS)
564 .chain(MEMBERS_TAGS)
565 .chain(EDGE_DIVIDERS)
561 .filter_map(|path| visual.debug_bounds(path).map(|bounds| (*path, bounds)))
566 .filter_map(|path| visual.debug_bounds(path).map(|bounds| (*path, bounds)))
562 .collect()
567 .collect()
563 }
568 }
@@ -1031,7 +1036,9 @@ mod frames {
1031 assert!(!bubbles.is_empty(), "no bubbles rendered in the call chat");
1036 assert!(!bubbles.is_empty(), "no bubbles rendered in the call chat");
1032 let found: Vec<String> = bubbles
1037 let found: Vec<String> = bubbles
1033 .into_iter()
1038 .into_iter()
1034 .filter(|(_, bounds)| !contains(panel, *bounds))
1039 .filter(|(_, bounds)| {
1040 !inside_horizontally(panel, *bounds) || !overlaps(panel, *bounds)
1041 })
1035 .map(|(index, bounds)| {
1042 .map(|(index, bounds)| {
1036 format!(
1043 format!(
1037 "call-chat@{width}x{height}: bubble {index} {} leaves the chat panel {}",
1044 "call-chat@{width}x{height}: bubble {index} {} leaves the chat panel {}",
@@ -1050,6 +1057,100 @@ mod frames {
1050 }
1057 }
1051 }
1058 }
1052
1059
1060 fn inside_horizontally(outer: Bounds<Pixels>, inner: Bounds<Pixels>) -> bool {
1061 let tolerance = px(TOLERANCE);
1062 inner.left() >= outer.left() - tolerance && inner.right() <= outer.right() + tolerance
1063 }
1064
1065 fn scroll_sidebar(visual: &mut VisualTestContext, delta: f32) {
1066 let sidebar = visual.debug_bounds(SIDEBAR).expect("sidebar rendered");
1067 visual.simulate_event(ScrollWheelEvent {
1068 position: sidebar.center(),
1069 delta: ScrollDelta::Pixels(point(px(0.), px(delta))),
1070 ..Default::default()
1071 });
1072 }
1073
1074 #[gpui_kit::test]
1075 fn chat_list_line_shows_only_while_scrolled(cx: &mut TestAppContext) {
1076 let (handle, _) = mount(cx);
1077 let mut visual = VisualTestContext::from_window(handle, cx);
1078 for (width, height) in SIZES {
1079 visual.simulate_resize(size(px(width), px(height)));
1080 let window = Bounds {
1081 origin: point(px(0.), px(0.)),
1082 size: size(px(width), px(height)),
1083 };
1084 collect(&mut visual, None);
1085 scroll_sidebar(&mut visual, 100_000.);
1086 let tags = collect(&mut visual, None);
1087 assert!(
1088 visual.debug_bounds(SIDEBAR_SCROLL_DIVIDER).is_none(),
1089 "chat list at its top must not show the line at {width}x{height}"
1090 );
1091 scroll_sidebar(&mut visual, -120.);
1092 let scrolled = collect(&mut visual, Some(SIDEBAR_SCROLL_DIVIDER));
1093 let sidebar = visual.debug_bounds(SIDEBAR).expect("sidebar rendered");
1094 let line = visual
1095 .debug_bounds(SIDEBAR_SCROLL_DIVIDER)
1096 .expect("scrolled chat list shows the line");
1097 assert!(
1098 line.top() > sidebar.top() + px(TOLERANCE),
1099 "the line sits under the Chats header, not on the island edge: {} in {}",
1100 describe(line),
1101 describe(sidebar)
1102 );
1103 let found: Vec<String> = violations(&scrolled, window, &[SIDEBAR_SCROLL_DIVIDER])
1104 .into_iter()
1105 .chain(violations(&tags, window, &[]))
1106 .map(|(key, message)| format!("chat-list@{width}x{height}:{key}: {message}"))
1107 .collect();
1108 assert!(found.is_empty(), "{}", found.join("\n"));
1109 scroll_sidebar(&mut visual, 100_000.);
1110 collect(&mut visual, None);
1111 assert!(
1112 visual.debug_bounds(SIDEBAR_SCROLL_DIVIDER).is_none(),
1113 "the line goes away once the chat list is back at its top"
1114 );
1115 }
1116 }
1117
1118 #[gpui_kit::test]
1119 fn header_tabs_sit_above_the_header_line(cx: &mut TestAppContext) {
1120 let (handle, state) = mount(cx);
1121 let mut visual = VisualTestContext::from_window(handle, cx);
1122 for (width, height) in SIZES {
1123 visual.simulate_resize(size(px(width), px(height)));
1124 let window = Bounds {
1125 origin: point(px(0.), px(0.)),
1126 size: size(px(width), px(height)),
1127 };
1128 visual.update(|_, cx| {
1129 state.update(cx, |state, cx| {
1130 state.select(Selection::Chat(RECAP_MEETING_CHAT.to_owned()), cx)
1131 })
1132 });
1133 let tags = collect(&mut visual, Some(RECAP_TAB));
1134 let main = visual.debug_bounds(MAIN).expect("main island rendered");
1135 let tab = visual.debug_bounds(RECAP_TAB).expect("recap tab rendered");
1136 let line = visual
1137 .debug_bounds(HEADER_DIVIDER)
1138 .expect("the header line is always shown");
1139 let near = |first: Pixels, second: Pixels| f32::from(first - second).abs() <= TOLERANCE;
1140 assert!(
1141 tab.top() >= main.top() && near(tab.bottom(), line.top()),
1142 "tab {} must sit in the top bar above the line {}",
1143 describe(tab),
1144 describe(line)
1145 );
1146 let found: Vec<String> = violations(&tags, window, &[HEADER_DIVIDER, RECAP_TAB])
1147 .into_iter()
1148 .map(|(key, message)| format!("header@{width}x{height}:{key}: {message}"))
1149 .collect();
1150 assert!(found.is_empty(), "{}", found.join("\n"));
1151 }
1152 }
1153
1053 #[gpui_kit::test]
1154 #[gpui_kit::test]
1054 fn recap_tab_stays_inside_the_main_island(cx: &mut TestAppContext) {
1155 fn recap_tab_stays_inside_the_main_island(cx: &mut TestAppContext) {
1055 let (handle, state) = mount(cx);
1156 let (handle, state) = mount(cx);
crates/app/src/settings/dialog.rs +9 −1
@@ -13,8 +13,10 @@ use crate::app_state::AppState;
13 13 use crate::notify::NotificationCenter;
14 14 use crate::settings_section::SettingsSection;
15 15 use crate::theme::{self, ElevatedSurface as _};
16 use crate::views::scroll_edge::with_top_edge;
16 17 use crate::views::widgets::icon;
17 18
19 pub const BODY_SCROLL_DIVIDER: &str = "settings/main/body/divider-scroll";
18 20 const BACKDROP_OPACITY: f32 = 0.55;
19 21 pub(super) const PANEL_RADIUS: f32 = 10.;
20 22 const CONTENT_MAX_WIDTH: f32 = 744.;
@@ -59,6 +61,7 @@ pub struct SettingsDialog {
59 61 devices: Option<Entity<DevicesView>>,
60 62 mcp: Option<Entity<McpView>>,
61 63 agents: Option<Entity<AgentsSettings>>,
64 body_scroll: ScrollHandle,
62 65 focus_handle: FocusHandle,
63 66 _subscriptions: [Subscription; 2],
64 67 }
@@ -86,6 +89,7 @@ impl SettingsDialog {
86 89 devices: None,
87 90 mcp: None,
88 91 agents: None,
92 body_scroll: ScrollHandle::new(),
89 93 focus_handle,
90 94 _subscriptions: subscriptions,
91 95 };
@@ -95,6 +99,9 @@ impl SettingsDialog {
95 99
96 100 pub fn show(&mut self, section: SettingsSection, window: &mut Window, cx: &mut Context<Self>) {
97 101 let section = available(section, crate::agents::runs_handle(cx).is_some());
102 if section != self.section {
103 self.body_scroll = ScrollHandle::new();
104 }
98 105 self.section = section;
99 106 if section == SettingsSection::Devices {
100 107 if self.devices.is_none() {
@@ -219,6 +226,7 @@ impl Render for SettingsDialog {
219 226 .flex_1()
220 227 .min_h_0()
221 228 .overflow_y_scroll()
229 .track_scroll(&self.body_scroll)
222 230 .px(px(body_inset.max(0.)))
223 231 .pb(px(metrics.padding))
224 232 .child(
@@ -269,7 +277,7 @@ impl Render for SettingsDialog {
269 277 .min_w_0()
270 278 .h_full()
271 279 .child(self.header(metrics, cx))
272 .child(body),
280 .child(with_top_edge(body, &self.body_scroll, BODY_SCROLL_DIVIDER)),
273 281 ),
274 282 )
275 283 }
@@ -13,8 +13,10 @@ use crate::app_state::AppState;
13use crate::notify::NotificationCenter;
13use crate::notify::NotificationCenter;
14use crate::settings_section::SettingsSection;
14use crate::settings_section::SettingsSection;
15use crate::theme::{self, ElevatedSurface as _};
15use crate::theme::{self, ElevatedSurface as _};
16use crate::views::scroll_edge::with_top_edge;
16use crate::views::widgets::icon;
17use crate::views::widgets::icon;
17
18
19pub const BODY_SCROLL_DIVIDER: &str = "settings/main/body/divider-scroll";
18const BACKDROP_OPACITY: f32 = 0.55;
20const BACKDROP_OPACITY: f32 = 0.55;
19pub(super) const PANEL_RADIUS: f32 = 10.;
21pub(super) const PANEL_RADIUS: f32 = 10.;
20const CONTENT_MAX_WIDTH: f32 = 744.;
22const CONTENT_MAX_WIDTH: f32 = 744.;
@@ -59,6 +61,7 @@ pub struct SettingsDialog {
59 devices: Option<Entity<DevicesView>>,
61 devices: Option<Entity<DevicesView>>,
60 mcp: Option<Entity<McpView>>,
62 mcp: Option<Entity<McpView>>,
61 agents: Option<Entity<AgentsSettings>>,
63 agents: Option<Entity<AgentsSettings>>,
64 body_scroll: ScrollHandle,
62 focus_handle: FocusHandle,
65 focus_handle: FocusHandle,
63 _subscriptions: [Subscription; 2],
66 _subscriptions: [Subscription; 2],
64}
67}
@@ -86,6 +89,7 @@ impl SettingsDialog {
86 devices: None,
89 devices: None,
87 mcp: None,
90 mcp: None,
88 agents: None,
91 agents: None,
92 body_scroll: ScrollHandle::new(),
89 focus_handle,
93 focus_handle,
90 _subscriptions: subscriptions,
94 _subscriptions: subscriptions,
91 };
95 };
@@ -95,6 +99,9 @@ impl SettingsDialog {
95
99
96 pub fn show(&mut self, section: SettingsSection, window: &mut Window, cx: &mut Context<Self>) {
100 pub fn show(&mut self, section: SettingsSection, window: &mut Window, cx: &mut Context<Self>) {
97 let section = available(section, crate::agents::runs_handle(cx).is_some());
101 let section = available(section, crate::agents::runs_handle(cx).is_some());
102 if section != self.section {
103 self.body_scroll = ScrollHandle::new();
104 }
98 self.section = section;
105 self.section = section;
99 if section == SettingsSection::Devices {
106 if section == SettingsSection::Devices {
100 if self.devices.is_none() {
107 if self.devices.is_none() {
@@ -219,6 +226,7 @@ impl Render for SettingsDialog {
219 .flex_1()
226 .flex_1()
220 .min_h_0()
227 .min_h_0()
221 .overflow_y_scroll()
228 .overflow_y_scroll()
229 .track_scroll(&self.body_scroll)
222 .px(px(body_inset.max(0.)))
230 .px(px(body_inset.max(0.)))
223 .pb(px(metrics.padding))
231 .pb(px(metrics.padding))
224 .child(
232 .child(
@@ -269,7 +277,7 @@ impl Render for SettingsDialog {
269 .min_w_0()
277 .min_w_0()
270 .h_full()
278 .h_full()
271 .child(self.header(metrics, cx))
279 .child(self.header(metrics, cx))
272 .child(body),
280 .child(with_top_edge(body, &self.body_scroll, BODY_SCROLL_DIVIDER)),
273 ),
281 ),
274 )
282 )
275 }
283 }
crates/app/src/views/activity_panel.rs +15 −10
@@ -8,6 +8,8 @@ use gpui_kit::*;
8 8 use store::Sidebar;
9 9
10 10 use super::avatar::person_avatar;
11 use super::scroll_edge::with_top_edge;
12 use super::sidebar::SIDEBAR_SCROLL_DIVIDER;
11 13 use super::widgets::{Corner, corner_badge, dot, icon};
12 14 use crate::activity::{ActivityCenter, Entry, Filter, Kind};
13 15 use crate::app_state::{AppState, chat_title};
@@ -433,16 +435,19 @@ impl Render for ActivityPanel {
433 435 .into_any_element(),
434 436 );
435 437 }
436 v_flex().flex_1().min_h_0().child(self.header(cx)).child(
437 v_flex()
438 .id("activity-list")
439 .flex_1()
440 .min_h_0()
441 .pb(px(12.))
442 .overflow_y_scroll()
443 .track_scroll(&self.scroll)
444 .children(rows),
445 )
438 let list = v_flex()
439 .id("activity-list")
440 .flex_1()
441 .min_h_0()
442 .pb(px(12.))
443 .overflow_y_scroll()
444 .track_scroll(&self.scroll)
445 .children(rows);
446 v_flex()
447 .flex_1()
448 .min_h_0()
449 .child(self.header(cx))
450 .child(with_top_edge(list, &self.scroll, SIDEBAR_SCROLL_DIVIDER))
446 451 }
447 452 }
448 453
@@ -8,6 +8,8 @@ use gpui_kit::*;
8use store::Sidebar;
8use store::Sidebar;
9
9
10use super::avatar::person_avatar;
10use super::avatar::person_avatar;
11use super::scroll_edge::with_top_edge;
12use super::sidebar::SIDEBAR_SCROLL_DIVIDER;
11use super::widgets::{Corner, corner_badge, dot, icon};
13use super::widgets::{Corner, corner_badge, dot, icon};
12use crate::activity::{ActivityCenter, Entry, Filter, Kind};
14use crate::activity::{ActivityCenter, Entry, Filter, Kind};
13use crate::app_state::{AppState, chat_title};
15use crate::app_state::{AppState, chat_title};
@@ -433,16 +435,19 @@ impl Render for ActivityPanel {
433 .into_any_element(),
435 .into_any_element(),
434 );
436 );
435 }
437 }
436 v_flex().flex_1().min_h_0().child(self.header(cx)).child(
438 let list = v_flex()
437 v_flex()
439 .id("activity-list")
438 .id("activity-list")
440 .flex_1()
439 .flex_1()
441 .min_h_0()
440 .min_h_0()
442 .pb(px(12.))
441 .pb(px(12.))
443 .overflow_y_scroll()
442 .overflow_y_scroll()
444 .track_scroll(&self.scroll)
443 .track_scroll(&self.scroll)
445 .children(rows);
444 .children(rows),
446 v_flex()
445 )
447 .flex_1()
448 .min_h_0()
449 .child(self.header(cx))
450 .child(with_top_edge(list, &self.scroll, SIDEBAR_SCROLL_DIVIDER))
446 }
451 }
447}
452}
448
453
crates/app/src/views/call_transcript.rs +3 −5
@@ -8,11 +8,13 @@ use gpui_kit::prelude::FluentBuilder as _;
8 8 use gpui_kit::*;
9 9
10 10 use super::call_view::side_panel;
11 use super::scroll_edge::with_top_edge;
11 12 use super::widgets::icon;
12 13 use crate::app_state::AppState;
13 14 use crate::call::clock_label;
14 15 use crate::theme;
15 16
17 const TRANSCRIPT_SCROLL_DIVIDER: &str = "shell/islands/main/call-transcript/divider-scroll";
16 18 const SEARCH_HEIGHT: f32 = 34.;
17 19 const AT_BOTTOM_SLACK: f32 = 4.;
18 20 const EMPTY_TEXT: &str = "Nothing said yet. Spoken words appear here.";
@@ -179,11 +181,7 @@ impl Render for TranscriptPanel {
179 181 .gap(px(8.))
180 182 .child(search)
181 183 .child(
182 div()
183 .relative()
184 .flex_1()
185 .min_h_0()
186 .child(list)
184 with_top_edge(list, &self.scroll, TRANSCRIPT_SCROLL_DIVIDER)
187 185 .when(!self.following, |area| area.child(self.jump_chip(cx))),
188 186 );
189 187 side_panel(
@@ -8,11 +8,13 @@ use gpui_kit::prelude::FluentBuilder as _;
8use gpui_kit::*;
8use gpui_kit::*;
9
9
10use super::call_view::side_panel;
10use super::call_view::side_panel;
11use super::scroll_edge::with_top_edge;
11use super::widgets::icon;
12use super::widgets::icon;
12use crate::app_state::AppState;
13use crate::app_state::AppState;
13use crate::call::clock_label;
14use crate::call::clock_label;
14use crate::theme;
15use crate::theme;
15
16
17const TRANSCRIPT_SCROLL_DIVIDER: &str = "shell/islands/main/call-transcript/divider-scroll";
16const SEARCH_HEIGHT: f32 = 34.;
18const SEARCH_HEIGHT: f32 = 34.;
17const AT_BOTTOM_SLACK: f32 = 4.;
19const AT_BOTTOM_SLACK: f32 = 4.;
18const EMPTY_TEXT: &str = "Nothing said yet. Spoken words appear here.";
20const EMPTY_TEXT: &str = "Nothing said yet. Spoken words appear here.";
@@ -179,11 +181,7 @@ impl Render for TranscriptPanel {
179 .gap(px(8.))
181 .gap(px(8.))
180 .child(search)
182 .child(search)
181 .child(
183 .child(
182 div()
184 with_top_edge(list, &self.scroll, TRANSCRIPT_SCROLL_DIVIDER)
183 .relative()
184 .flex_1()
185 .min_h_0()
186 .child(list)
187 .when(!self.following, |area| area.child(self.jump_chip(cx))),
185 .when(!self.following, |area| area.child(self.jump_chip(cx))),
188 );
186 );
189 side_panel(
187 side_panel(
crates/app/src/views/calls_tab.rs +6 −2
@@ -11,6 +11,8 @@ use gpui_kit::*;
11 11 use super::avatar::person_avatar;
12 12 use super::join_dialog::open_join_with_id;
13 13 use super::new_meeting_dialog::open_new_meeting;
14 use super::scroll_edge::with_top_edge;
15 use super::sidebar::SIDEBAR_SCROLL_DIVIDER;
14 16 use super::widgets::icon;
15 17 use crate::app_state::AppState;
16 18 use crate::call::{
@@ -456,7 +458,7 @@ pub fn calls_body(
456 458 .flex_1()
457 459 .min_h_0()
458 460 .child(join_buttons(state, app.meet_now_pending))
459 .child(
461 .child(with_top_edge(
460 462 div()
461 463 .id("calls-scroll")
462 464 .flex_1()
@@ -464,6 +466,8 @@ pub fn calls_body(
464 466 .overflow_y_scroll()
465 467 .track_scroll(scroll)
466 468 .child(list),
467 )
469 scroll,
470 SIDEBAR_SCROLL_DIVIDER,
471 ))
468 472 .into_any_element()
469 473 }
@@ -11,6 +11,8 @@ use gpui_kit::*;
11use super::avatar::person_avatar;
11use super::avatar::person_avatar;
12use super::join_dialog::open_join_with_id;
12use super::join_dialog::open_join_with_id;
13use super::new_meeting_dialog::open_new_meeting;
13use super::new_meeting_dialog::open_new_meeting;
14use super::scroll_edge::with_top_edge;
15use super::sidebar::SIDEBAR_SCROLL_DIVIDER;
14use super::widgets::icon;
16use super::widgets::icon;
15use crate::app_state::AppState;
17use crate::app_state::AppState;
16use crate::call::{
18use crate::call::{
@@ -456,7 +458,7 @@ pub fn calls_body(
456 .flex_1()
458 .flex_1()
457 .min_h_0()
459 .min_h_0()
458 .child(join_buttons(state, app.meet_now_pending))
460 .child(join_buttons(state, app.meet_now_pending))
459 .child(
461 .child(with_top_edge(
460 div()
462 div()
461 .id("calls-scroll")
463 .id("calls-scroll")
462 .flex_1()
464 .flex_1()
@@ -464,6 +466,8 @@ pub fn calls_body(
464 .overflow_y_scroll()
466 .overflow_y_scroll()
465 .track_scroll(scroll)
467 .track_scroll(scroll)
466 .child(list),
468 .child(list),
467 )
469 scroll,
470 SIDEBAR_SCROLL_DIVIDER,
471 ))
468 .into_any_element()
472 .into_any_element()
469}
473}
crates/app/src/views/conversation.rs +80 −11
@@ -36,7 +36,7 @@ use super::avatar::{
36 36 bot_tile, member_stack, person_avatar, spec_avatar, square_avatar, with_presence,
37 37 };
38 38 use super::call_controls::header_call_controls;
39 use super::channel_tabs::ChannelPane;
39 use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};
40 40 use super::chat_members::members_popover;
41 41 use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};
42 42 use super::message_actions::{Action, DelegateEntry, MessageMenu, QUICK_REACTION_COUNT};
@@ -47,8 +47,10 @@ use super::pin_banner::{pin_banner_inset, pin_banner_overlay};
47 47 use super::profile_card::opens_profile;
48 48 use super::reaction_picker::{PickHandler, ReactionPicker};
49 49 use super::reaction_pills::{ReactionControls, ReactionPopover};
50 use super::scroll_edge::edge_divider;
50 51 use super::toolbar_placement::{TimelineBounds, record_bounds};
51 52 use super::widgets::{icon, symbol};
53 use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
52 54 use crate::agents::{AgentRun, StartRequest};
53 55 use crate::app_state::{AppEvent, AppState, Selection, composer_name, selection_title};
54 56 use crate::backend::Engine;
@@ -87,6 +89,13 @@ use render_env::RenderEnv;
87 89 use shared::SharedState;
88 90
89 91 pub const MEMBERS_BUTTON: &str = "shell/islands/main/members-button";
92 pub const HEADER_DIVIDER: &str = "shell/islands/main/divider-header";
93 const HEADER_HEIGHT: f32 = 60.;
94 const HEADER_PADDING: f32 = 20.;
95 const HEADER_GAP: f32 = 12.;
96 const HEADER_LEAD_SIZE: f32 = 36.;
97 const TABS_INLINE_MIN_WIDTH: f32 = 560.;
98 const TABS_ROW_HEIGHT: f32 = 36.;
90 99 const CHAT_OPEN_LIMIT: usize = 60;
91 100 const CHANNEL_OPEN_LIMIT: usize = 300;
92 101 const GROWTH_HEADROOM: usize = 20;
@@ -194,6 +203,7 @@ pub struct ConversationView {
194 203 hovered_message: Option<String>,
195 204 toolbar_hovered: Option<String>,
196 205 timeline_bounds: TimelineBounds,
206 header_width: Rc<Cell<f32>>,
197 207 toolbar_pinned: Option<String>,
198 208 toolbar_suppressed: Option<String>,
199 209 recent: Entity<emoji::Recent>,
@@ -522,6 +532,7 @@ impl ConversationView {
522 532 hovered_message: None,
523 533 toolbar_hovered: None,
524 534 timeline_bounds: TimelineBounds::default(),
535 header_width: Rc::default(),
525 536 toolbar_pinned: None,
526 537 toolbar_suppressed: None,
527 538 recent,
@@ -3226,7 +3237,28 @@ impl ConversationView {
3226 3237 )
3227 3238 }
3228 3239
3229 fn render_header(&self, current: &Current, cx: &mut Context<Self>) -> impl IntoElement {
3240 fn header_width(&self, window: &Window) -> f32 {
3241 match self.header_width.get() {
3242 width if width > 0. => width,
3243 _ => {
3244 f32::from(window.viewport_size().width)
3245 - RAIL_WIDTH
3246 - SIDEBAR_WIDTH
3247 - 2. * ISLAND_GAP
3248 }
3249 }
3250 }
3251
3252 fn tabs_below_title(&self, window: &Window) -> bool {
3253 self.header_width(window) < TABS_INLINE_MIN_WIDTH
3254 }
3255
3256 fn render_header(
3257 &self,
3258 current: &Current,
3259 tabs: Option<AnyElement>,
3260 cx: &mut Context<Self>,
3261 ) -> impl IntoElement {
3230 3262 let app = self.app.read(cx);
3231 3263 let directory = &app.directory;
3232 3264 let me = directory.me.as_ref();
@@ -3294,10 +3326,10 @@ impl ConversationView {
3294 3326 }
3295 3327 let mut header = h_flex()
3296 3328 .w_full()
3297 .h(px(60.))
3329 .h(px(HEADER_HEIGHT))
3298 3330 .flex_none()
3299 .px(px(20.))
3300 .gap(px(12.))
3331 .px(px(HEADER_PADDING))
3332 .gap(px(HEADER_GAP))
3301 3333 .items_center();
3302 3334 if matches!(current.mode, ViewMode::Thread(_)) {
3303 3335 header = header.child(
@@ -3349,15 +3381,20 @@ impl ConversationView {
3349 3381 }
3350 3382 .to_owned();
3351 3383 }
3384 let inline_tabs = tabs.map(|tabs| h_flex().h_full().flex_1().child(tabs));
3352 3385 header
3353 3386 .relative()
3387 .child(record_width(&self.header_width))
3354 3388 .when(sync.shown_at.is_some() || loading_window, |header| {
3355 3389 header.child(progress_bar())
3356 3390 })
3357 3391 .children(lead)
3358 3392 .child(
3359 3393 v_flex()
3360 .flex_1()
3394 .map(|column| match inline_tabs {
3395 Some(_) => column.flex_shrink(1.).max_w(px(HEADER_TITLE_MAX_WIDTH)),
3396 None => column.flex_1(),
3397 })
3361 3398 .min_w_0()
3362 3399 .overflow_hidden()
3363 3400 .gap(px(1.))
@@ -3378,6 +3415,7 @@ impl ConversationView {
3378 3415 )
3379 3416 }),
3380 3417 )
3418 .children(inline_tabs)
3381 3419 .children(stack)
3382 3420 .children(call_controls)
3383 3421 }
@@ -3533,13 +3571,27 @@ impl Render for ConversationView {
3533 3571 .with_top_inset(pin_banner_inset(pin_banner.is_some()));
3534 3572
3535 3573 root = match self.current.as_ref().filter(|_| !drafting) {
3536 Some(current) => root.child(self.render_header(current, cx)),
3574 Some(current) => {
3575 let tab_bar = self
3576 .render_tab_bar(window, cx)
3577 .or_else(|| self.render_meeting_tab_bar(cx));
3578 let (inline_tabs, tabs_row) = match tab_bar {
3579 Some(tabs) if self.tabs_below_title(window) => (None, Some(tabs)),
3580 tabs => (tabs, None),
3581 };
3582 root.child(self.render_header(current, inline_tabs, cx))
3583 .children(tabs_row.map(|tabs| {
3584 h_flex()
3585 .w_full()
3586 .h(px(TABS_ROW_HEIGHT))
3587 .flex_none()
3588 .px(px(HEADER_PADDING))
3589 .child(tabs)
3590 }))
3591 .child(edge_divider(HEADER_DIVIDER))
3592 }
3537 3593 None => root.child(self.draft.clone()),
3538 3594 };
3539 let tab_bar = self
3540 .render_tab_bar(window, cx)
3541 .or_else(|| self.render_meeting_tab_bar(cx));
3542 root = root.children(tab_bar.filter(|_| !drafting));
3543 3595 let sync_failed = self
3544 3596 .current
3545 3597 .as_ref()
@@ -3657,6 +3709,23 @@ fn typing_dots() -> impl IntoElement {
3657 3709 }))
3658 3710 }
3659 3711
3712 fn record_width(width: &Rc<Cell<f32>>) -> impl IntoElement {
3713 let width = width.clone();
3714 canvas(
3715 move |bounds, window, _| {
3716 let measured = f32::from(bounds.size.width);
3717 if (measured - width.replace(measured)).abs() > 0.5 {
3718 window.request_animation_frame();
3719 }
3720 },
3721 |_, _, _, _| {},
3722 )
3723 .absolute()
3724 .top_0()
3725 .left_0()
3726 .size_full()
3727 }
3728
3660 3729 fn progress_bar() -> impl IntoElement {
3661 3730 div()
3662 3731 .absolute()
@@ -36,7 +36,7 @@ use super::avatar::{
36 bot_tile, member_stack, person_avatar, spec_avatar, square_avatar, with_presence,
36 bot_tile, member_stack, person_avatar, spec_avatar, square_avatar, with_presence,
37};
37};
38use super::call_controls::header_call_controls;
38use super::call_controls::header_call_controls;
39use super::channel_tabs::ChannelPane;
39use super::channel_tabs::{ChannelPane, HEADER_TITLE_MAX_WIDTH};
40use super::chat_members::members_popover;
40use super::chat_members::members_popover;
41use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};
41use super::composer::{Composer, ComposerEvent, EditPreview, Outgoing, ReplyPreview};
42use super::message_actions::{Action, DelegateEntry, MessageMenu, QUICK_REACTION_COUNT};
42use super::message_actions::{Action, DelegateEntry, MessageMenu, QUICK_REACTION_COUNT};
@@ -47,8 +47,10 @@ use super::pin_banner::{pin_banner_inset, pin_banner_overlay};
47use super::profile_card::opens_profile;
47use super::profile_card::opens_profile;
48use super::reaction_picker::{PickHandler, ReactionPicker};
48use super::reaction_picker::{PickHandler, ReactionPicker};
49use super::reaction_pills::{ReactionControls, ReactionPopover};
49use super::reaction_pills::{ReactionControls, ReactionPopover};
50use super::scroll_edge::edge_divider;
50use super::toolbar_placement::{TimelineBounds, record_bounds};
51use super::toolbar_placement::{TimelineBounds, record_bounds};
51use super::widgets::{icon, symbol};
52use super::widgets::{icon, symbol};
53use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
52use crate::agents::{AgentRun, StartRequest};
54use crate::agents::{AgentRun, StartRequest};
53use crate::app_state::{AppEvent, AppState, Selection, composer_name, selection_title};
55use crate::app_state::{AppEvent, AppState, Selection, composer_name, selection_title};
54use crate::backend::Engine;
56use crate::backend::Engine;
@@ -87,6 +89,13 @@ use render_env::RenderEnv;
87use shared::SharedState;
89use shared::SharedState;
88
90
89pub const MEMBERS_BUTTON: &str = "shell/islands/main/members-button";
91pub const MEMBERS_BUTTON: &str = "shell/islands/main/members-button";
92pub const HEADER_DIVIDER: &str = "shell/islands/main/divider-header";
93const HEADER_HEIGHT: f32 = 60.;
94const HEADER_PADDING: f32 = 20.;
95const HEADER_GAP: f32 = 12.;
96const HEADER_LEAD_SIZE: f32 = 36.;
97const TABS_INLINE_MIN_WIDTH: f32 = 560.;
98const TABS_ROW_HEIGHT: f32 = 36.;
90const CHAT_OPEN_LIMIT: usize = 60;
99const CHAT_OPEN_LIMIT: usize = 60;
91const CHANNEL_OPEN_LIMIT: usize = 300;
100const CHANNEL_OPEN_LIMIT: usize = 300;
92const GROWTH_HEADROOM: usize = 20;
101const GROWTH_HEADROOM: usize = 20;
@@ -194,6 +203,7 @@ pub struct ConversationView {
194 hovered_message: Option<String>,
203 hovered_message: Option<String>,
195 toolbar_hovered: Option<String>,
204 toolbar_hovered: Option<String>,
196 timeline_bounds: TimelineBounds,
205 timeline_bounds: TimelineBounds,
206 header_width: Rc<Cell<f32>>,
197 toolbar_pinned: Option<String>,
207 toolbar_pinned: Option<String>,
198 toolbar_suppressed: Option<String>,
208 toolbar_suppressed: Option<String>,
199 recent: Entity<emoji::Recent>,
209 recent: Entity<emoji::Recent>,
@@ -522,6 +532,7 @@ impl ConversationView {
522 hovered_message: None,
532 hovered_message: None,
523 toolbar_hovered: None,
533 toolbar_hovered: None,
524 timeline_bounds: TimelineBounds::default(),
534 timeline_bounds: TimelineBounds::default(),
535 header_width: Rc::default(),
525 toolbar_pinned: None,
536 toolbar_pinned: None,
526 toolbar_suppressed: None,
537 toolbar_suppressed: None,
527 recent,
538 recent,
@@ -3226,7 +3237,28 @@ impl ConversationView {
3226 )
3237 )
3227 }
3238 }
3228
3239
3229 fn render_header(&self, current: &Current, cx: &mut Context<Self>) -> impl IntoElement {
3240 fn header_width(&self, window: &Window) -> f32 {
3241 match self.header_width.get() {
3242 width if width > 0. => width,
3243 _ => {
3244 f32::from(window.viewport_size().width)
3245 - RAIL_WIDTH
3246 - SIDEBAR_WIDTH
3247 - 2. * ISLAND_GAP
3248 }
3249 }
3250 }
3251
3252 fn tabs_below_title(&self, window: &Window) -> bool {
3253 self.header_width(window) < TABS_INLINE_MIN_WIDTH
3254 }
3255
3256 fn render_header(
3257 &self,
3258 current: &Current,
3259 tabs: Option<AnyElement>,
3260 cx: &mut Context<Self>,
3261 ) -> impl IntoElement {
3230 let app = self.app.read(cx);
3262 let app = self.app.read(cx);
3231 let directory = &app.directory;
3263 let directory = &app.directory;
3232 let me = directory.me.as_ref();
3264 let me = directory.me.as_ref();
@@ -3294,10 +3326,10 @@ impl ConversationView {
3294 }
3326 }
3295 let mut header = h_flex()
3327 let mut header = h_flex()
3296 .w_full()
3328 .w_full()
3297 .h(px(60.))
3329 .h(px(HEADER_HEIGHT))
3298 .flex_none()
3330 .flex_none()
3299 .px(px(20.))
3331 .px(px(HEADER_PADDING))
3300 .gap(px(12.))
3332 .gap(px(HEADER_GAP))
3301 .items_center();
3333 .items_center();
3302 if matches!(current.mode, ViewMode::Thread(_)) {
3334 if matches!(current.mode, ViewMode::Thread(_)) {
3303 header = header.child(
3335 header = header.child(
@@ -3349,15 +3381,20 @@ impl ConversationView {
3349 }
3381 }
3350 .to_owned();
3382 .to_owned();
3351 }
3383 }
3384 let inline_tabs = tabs.map(|tabs| h_flex().h_full().flex_1().child(tabs));
3352 header
3385 header
3353 .relative()
3386 .relative()
3387 .child(record_width(&self.header_width))
3354 .when(sync.shown_at.is_some() || loading_window, |header| {
3388 .when(sync.shown_at.is_some() || loading_window, |header| {
3355 header.child(progress_bar())
3389 header.child(progress_bar())
3356 })
3390 })
3357 .children(lead)
3391 .children(lead)
3358 .child(
3392 .child(
3359 v_flex()
3393 v_flex()
3360 .flex_1()
3394 .map(|column| match inline_tabs {
3395 Some(_) => column.flex_shrink(1.).max_w(px(HEADER_TITLE_MAX_WIDTH)),
3396 None => column.flex_1(),
3397 })
3361 .min_w_0()
3398 .min_w_0()
3362 .overflow_hidden()
3399 .overflow_hidden()
3363 .gap(px(1.))
3400 .gap(px(1.))
@@ -3378,6 +3415,7 @@ impl ConversationView {
3378 )
3415 )
3379 }),
3416 }),
3380 )
3417 )
3418 .children(inline_tabs)
3381 .children(stack)
3419 .children(stack)
3382 .children(call_controls)
3420 .children(call_controls)
3383 }
3421 }
@@ -3533,13 +3571,27 @@ impl Render for ConversationView {
3533 .with_top_inset(pin_banner_inset(pin_banner.is_some()));
3571 .with_top_inset(pin_banner_inset(pin_banner.is_some()));
3534
3572
3535 root = match self.current.as_ref().filter(|_| !drafting) {
3573 root = match self.current.as_ref().filter(|_| !drafting) {
3536 Some(current) => root.child(self.render_header(current, cx)),
3574 Some(current) => {
3575 let tab_bar = self
3576 .render_tab_bar(window, cx)
3577 .or_else(|| self.render_meeting_tab_bar(cx));
3578 let (inline_tabs, tabs_row) = match tab_bar {
3579 Some(tabs) if self.tabs_below_title(window) => (None, Some(tabs)),
3580 tabs => (tabs, None),
3581 };
3582 root.child(self.render_header(current, inline_tabs, cx))
3583 .children(tabs_row.map(|tabs| {
3584 h_flex()
3585 .w_full()
3586 .h(px(TABS_ROW_HEIGHT))
3587 .flex_none()
3588 .px(px(HEADER_PADDING))
3589 .child(tabs)
3590 }))
3591 .child(edge_divider(HEADER_DIVIDER))
3592 }
3537 None => root.child(self.draft.clone()),
3593 None => root.child(self.draft.clone()),
3538 };
3594 };
3539 let tab_bar = self
3540 .render_tab_bar(window, cx)
3541 .or_else(|| self.render_meeting_tab_bar(cx));
3542 root = root.children(tab_bar.filter(|_| !drafting));
3543 let sync_failed = self
3595 let sync_failed = self
3544 .current
3596 .current
3545 .as_ref()
3597 .as_ref()
@@ -3657,6 +3709,23 @@ fn typing_dots() -> impl IntoElement {
3657 }))
3709 }))
3658}
3710}
3659
3711
3712fn record_width(width: &Rc<Cell<f32>>) -> impl IntoElement {
3713 let width = width.clone();
3714 canvas(
3715 move |bounds, window, _| {
3716 let measured = f32::from(bounds.size.width);
3717 if (measured - width.replace(measured)).abs() > 0.5 {
3718 window.request_animation_frame();
3719 }
3720 },
3721 |_, _, _, _| {},
3722 )
3723 .absolute()
3724 .top_0()
3725 .left_0()
3726 .size_full()
3727}
3728
3660fn progress_bar() -> impl IntoElement {
3729fn progress_bar() -> impl IntoElement {
3661 div()
3730 div()
3662 .absolute()
3731 .absolute()
crates/app/src/views/conversation/shared.rs +12 −4
@@ -18,13 +18,13 @@ use crate::notice::short_error;
18 18 use crate::runtime;
19 19 use crate::views::attachment_tray::{display_name, read_attachment};
20 20 use crate::views::channel_tabs::{
21 ChannelPane, TabAction, TabBarActions, fallback_tab_link, render_tab_bar, tab_action,
21 ChannelPane, TabAction, TabBarActions, fallback_tab_link, header_title_width, render_tab_bar,
22 tab_action,
22 23 };
23 24 use crate::views::shared_tab::{
24 25 LibraryView, Listing, MessagesView, SharedCommand, SharedRun, SharedScope, render_library,
25 26 render_messages,
26 27 };
27 use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
28 28
29 29 const LIBRARY_KEY: &str = "library";
30 30 const NEW_FOLDER_PLACEHOLDER: &str = "Folder name";
@@ -98,8 +98,16 @@ impl ConversationView {
98 98 cx: &mut Context<Self>,
99 99 ) -> Option<AnyElement> {
100 100 self.channel_id().filter(|_| self.in_feed())?;
101 let available =
102 f32::from(window.viewport_size().width) - RAIL_WIDTH - SIDEBAR_WIDTH - 2. * ISLAND_GAP;
101 let title = self
102 .current
103 .as_ref()
104 .map_or("", |current| current.title.as_str());
105 let row = self.header_width(window) - 2. * super::HEADER_PADDING;
106 let available = if self.tabs_below_title(window) {
107 row
108 } else {
109 row - super::HEADER_LEAD_SIZE - 2. * super::HEADER_GAP - header_title_width(title)
110 };
103 111 let view = cx.weak_entity();
104 112 let select = Rc::new(move |pane, cx: &mut App| {
105 113 view.update(cx, |this, cx| this.select_pane(pane, cx)).ok();
@@ -18,13 +18,13 @@ use crate::notice::short_error;
18use crate::runtime;
18use crate::runtime;
19use crate::views::attachment_tray::{display_name, read_attachment};
19use crate::views::attachment_tray::{display_name, read_attachment};
20use crate::views::channel_tabs::{
20use crate::views::channel_tabs::{
21 ChannelPane, TabAction, TabBarActions, fallback_tab_link, render_tab_bar, tab_action,
21 ChannelPane, TabAction, TabBarActions, fallback_tab_link, header_title_width, render_tab_bar,
22 tab_action,
22};
23};
23use crate::views::shared_tab::{
24use crate::views::shared_tab::{
24 LibraryView, Listing, MessagesView, SharedCommand, SharedRun, SharedScope, render_library,
25 LibraryView, Listing, MessagesView, SharedCommand, SharedRun, SharedScope, render_library,
25 render_messages,
26 render_messages,
26};
27};
27use app_ui_kit::layout::{ISLAND_GAP, RAIL_WIDTH, SIDEBAR_WIDTH};
28
28
29const LIBRARY_KEY: &str = "library";
29const LIBRARY_KEY: &str = "library";
30const NEW_FOLDER_PLACEHOLDER: &str = "Folder name";
30const NEW_FOLDER_PLACEHOLDER: &str = "Folder name";
@@ -98,8 +98,16 @@ impl ConversationView {
98 cx: &mut Context<Self>,
98 cx: &mut Context<Self>,
99 ) -> Option<AnyElement> {
99 ) -> Option<AnyElement> {
100 self.channel_id().filter(|_| self.in_feed())?;
100 self.channel_id().filter(|_| self.in_feed())?;
101 let available =
101 let title = self
102 f32::from(window.viewport_size().width) - RAIL_WIDTH - SIDEBAR_WIDTH - 2. * ISLAND_GAP;
102 .current
103 .as_ref()
104 .map_or("", |current| current.title.as_str());
105 let row = self.header_width(window) - 2. * super::HEADER_PADDING;
106 let available = if self.tabs_below_title(window) {
107 row
108 } else {
109 row - super::HEADER_LEAD_SIZE - 2. * super::HEADER_GAP - header_title_width(title)
110 };
103 let view = cx.weak_entity();
111 let view = cx.weak_entity();
104 let select = Rc::new(move |pane, cx: &mut App| {
112 let select = Rc::new(move |pane, cx: &mut App| {
105 view.update(cx, |this, cx| this.select_pane(pane, cx)).ok();
113 view.update(cx, |this, cx| this.select_pane(pane, cx)).ok();
crates/app/src/views/mod.rs +3 −1
@@ -78,4 +78,6 @@ pub mod toolbar_placement;
78 78 pub mod transfer_picker;
79 79 pub mod translation_line;
80 80
81 pub use app_ui_kit::{card_chart, channel_tabs, draft_style, reaction_proposal_pill, widgets};
81 pub use app_ui_kit::{
82 card_chart, channel_tabs, draft_style, reaction_proposal_pill, scroll_edge, widgets,
83 };
@@ -78,4 +78,6 @@ pub mod toolbar_placement;
78pub mod transfer_picker;
78pub mod transfer_picker;
79pub mod translation_line;
79pub mod translation_line;
80
80
81pub use app_ui_kit::{card_chart, channel_tabs, draft_style, reaction_proposal_pill, widgets};
81pub use app_ui_kit::{
82 card_chart, channel_tabs, draft_style, reaction_proposal_pill, scroll_edge, widgets,
83};
crates/app/src/views/saved_panel.rs +6 −2
@@ -5,6 +5,8 @@ use gpui_kit::*;
5 5 use teams_core::SavedMessage;
6 6
7 7 use super::avatar::person_avatar;
8 use super::scroll_edge::with_top_edge;
9 use super::sidebar::SIDEBAR_SCROLL_DIVIDER;
8 10 use super::widgets::icon;
9 11 use crate::app_state::{AppState, selection_for, selection_title};
10 12 use crate::format;
@@ -219,7 +221,7 @@ impl Render for SavedPanel {
219 221 .flex_1()
220 222 .min_h_0()
221 223 .child(self.header(items.len()))
222 .child(
224 .child(with_top_edge(
223 225 v_flex()
224 226 .id("saved-list")
225 227 .flex_1()
@@ -228,7 +230,9 @@ impl Render for SavedPanel {
228 230 .overflow_y_scroll()
229 231 .track_scroll(&self.scroll)
230 232 .children(rows),
231 )
233 &self.scroll,
234 SIDEBAR_SCROLL_DIVIDER,
235 ))
232 236 }
233 237 }
234 238
@@ -5,6 +5,8 @@ use gpui_kit::*;
5use teams_core::SavedMessage;
5use teams_core::SavedMessage;
6
6
7use super::avatar::person_avatar;
7use super::avatar::person_avatar;
8use super::scroll_edge::with_top_edge;
9use super::sidebar::SIDEBAR_SCROLL_DIVIDER;
8use super::widgets::icon;
10use super::widgets::icon;
9use crate::app_state::{AppState, selection_for, selection_title};
11use crate::app_state::{AppState, selection_for, selection_title};
10use crate::format;
12use crate::format;
@@ -219,7 +221,7 @@ impl Render for SavedPanel {
219 .flex_1()
221 .flex_1()
220 .min_h_0()
222 .min_h_0()
221 .child(self.header(items.len()))
223 .child(self.header(items.len()))
222 .child(
224 .child(with_top_edge(
223 v_flex()
225 v_flex()
224 .id("saved-list")
226 .id("saved-list")
225 .flex_1()
227 .flex_1()
@@ -228,7 +230,9 @@ impl Render for SavedPanel {
228 .overflow_y_scroll()
230 .overflow_y_scroll()
229 .track_scroll(&self.scroll)
231 .track_scroll(&self.scroll)
230 .children(rows),
232 .children(rows),
231 )
233 &self.scroll,
234 SIDEBAR_SCROLL_DIVIDER,
235 ))
232 }
236 }
233}
237}
234
238
crates/app/src/views/sidebar.rs +8 −6
@@ -19,6 +19,7 @@ use super::activity_panel::ActivityPanel;
19 19 use super::avatar::{spec_avatar, square_avatar, with_presence};
20 20 use super::calls_tab::calls_body;
21 21 use super::saved_panel::SavedPanel;
22 use super::scroll_edge::with_top_edge;
22 23 use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
23 24 use super::widgets::{count_badge, icon, page_header, unread_marker};
24 25 use crate::agents::AgentsPanel;
@@ -37,6 +38,7 @@ use crate::sidebar_model::{
37 38 use crate::theme;
38 39 use app_ui_kit::layout::SIDEBAR_WIDTH;
39 40
41 pub const SIDEBAR_SCROLL_DIVIDER: &str = "shell/islands/sidebar/divider-scroll";
40 42 const COLLAPSED_TEAMS_META_KEY: &str = "sidebar_collapsed_teams";
41 43 const ROW_HEIGHT: f32 = 54.;
42 44 const PROPOSAL_DOT_SIZE: f32 = 8.;
@@ -1181,14 +1183,14 @@ impl SidebarView {
1181 1183 }
1182 1184 list = with_spacer(list, &mut skipped_height);
1183 1185 self.request_lazy_data(faces, presence_users, cx);
1184 div()
1186 let scroll_area = div()
1185 1187 .id("chats-scroll")
1186 1188 .flex_1()
1187 1189 .min_h_0()
1188 1190 .overflow_y_scroll()
1189 1191 .track_scroll(&self.chats_scroll)
1190 .child(list)
1191 .into_any_element()
1192 .child(list);
1193 with_top_edge(scroll_area, &self.chats_scroll, SIDEBAR_SCROLL_DIVIDER).into_any_element()
1192 1194 }
1193 1195
1194 1196 fn request_lazy_data(
@@ -1583,14 +1585,14 @@ impl SidebarView {
1583 1585 }
1584 1586 }
1585 1587 }
1586 div()
1588 let scroll_area = div()
1587 1589 .id("channels-scroll")
1588 1590 .flex_1()
1589 1591 .min_h_0()
1590 1592 .overflow_y_scroll()
1591 1593 .track_scroll(&self.channels_scroll)
1592 .child(list)
1593 .into_any_element()
1594 .child(list);
1595 with_top_edge(scroll_area, &self.channels_scroll, SIDEBAR_SCROLL_DIVIDER).into_any_element()
1594 1596 }
1595 1597 }
1596 1598
@@ -19,6 +19,7 @@ use super::activity_panel::ActivityPanel;
19use super::avatar::{spec_avatar, square_avatar, with_presence};
19use super::avatar::{spec_avatar, square_avatar, with_presence};
20use super::calls_tab::calls_body;
20use super::calls_tab::calls_body;
21use super::saved_panel::SavedPanel;
21use super::saved_panel::SavedPanel;
22use super::scroll_edge::with_top_edge;
22use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
23use super::section_dialog::{SectionNameTarget, open_section_name_dialog};
23use super::widgets::{count_badge, icon, page_header, unread_marker};
24use super::widgets::{count_badge, icon, page_header, unread_marker};
24use crate::agents::AgentsPanel;
25use crate::agents::AgentsPanel;
@@ -37,6 +38,7 @@ use crate::sidebar_model::{
37use crate::theme;
38use crate::theme;
38use app_ui_kit::layout::SIDEBAR_WIDTH;
39use app_ui_kit::layout::SIDEBAR_WIDTH;
39
40
41pub const SIDEBAR_SCROLL_DIVIDER: &str = "shell/islands/sidebar/divider-scroll";
40const COLLAPSED_TEAMS_META_KEY: &str = "sidebar_collapsed_teams";
42const COLLAPSED_TEAMS_META_KEY: &str = "sidebar_collapsed_teams";
41const ROW_HEIGHT: f32 = 54.;
43const ROW_HEIGHT: f32 = 54.;
42const PROPOSAL_DOT_SIZE: f32 = 8.;
44const PROPOSAL_DOT_SIZE: f32 = 8.;
@@ -1181,14 +1183,14 @@ impl SidebarView {
1181 }
1183 }
1182 list = with_spacer(list, &mut skipped_height);
1184 list = with_spacer(list, &mut skipped_height);
1183 self.request_lazy_data(faces, presence_users, cx);
1185 self.request_lazy_data(faces, presence_users, cx);
1184 div()
1186 let scroll_area = div()
1185 .id("chats-scroll")
1187 .id("chats-scroll")
1186 .flex_1()
1188 .flex_1()
1187 .min_h_0()
1189 .min_h_0()
1188 .overflow_y_scroll()
1190 .overflow_y_scroll()
1189 .track_scroll(&self.chats_scroll)
1191 .track_scroll(&self.chats_scroll)
1190 .child(list)
1192 .child(list);
1191 .into_any_element()
1193 with_top_edge(scroll_area, &self.chats_scroll, SIDEBAR_SCROLL_DIVIDER).into_any_element()
1192 }
1194 }
1193
1195
1194 fn request_lazy_data(
1196 fn request_lazy_data(
@@ -1583,14 +1585,14 @@ impl SidebarView {
1583 }
1585 }
1584 }
1586 }
1585 }
1587 }
1586 div()
1588 let scroll_area = div()
1587 .id("channels-scroll")
1589 .id("channels-scroll")
1588 .flex_1()
1590 .flex_1()
1589 .min_h_0()
1591 .min_h_0()
1590 .overflow_y_scroll()
1592 .overflow_y_scroll()
1591 .track_scroll(&self.channels_scroll)
1593 .track_scroll(&self.channels_scroll)
1592 .child(list)
1594 .child(list);
1593 .into_any_element()
1595 with_top_edge(scroll_area, &self.channels_scroll, SIDEBAR_SCROLL_DIVIDER).into_any_element()
1594 }
1596 }
1595}
1597}
1596
1598