BlueGit

ict rusty-teams

feat(calls): in-app mini view shows the speaker's video

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

metis Daniel Däschle · pushed by metis

Authored 2026-10-14 · 6 weeks ago

Hash
b345934a41c387847f83a502ed5d0bc480ca0855
Parent
36cd2191
7 files changed +275 −156
crates/app/src/call/actions.rs +3 −0
@@ -1088,6 +1088,9 @@ impl AppState {
1088 1088 meeting_data: None,
1089 1089 });
1090 1090 }
1091 if scene.minimized() {
1092 self.show_call(false, cx);
1093 }
1091 1094 if scene == DemoScene::Gallery {
1092 1095 self.queue_demo_bubbles(conversation_id, cx);
1093 1096 }
@@ -1088,6 +1088,9 @@ impl AppState {
1088 meeting_data: None,
1088 meeting_data: None,
1089 });
1089 });
1090 }
1090 }
1091 if scene.minimized() {
1092 self.show_call(false, cx);
1093 }
1091 if scene == DemoScene::Gallery {
1094 if scene == DemoScene::Gallery {
1092 self.queue_demo_bubbles(conversation_id, cx);
1095 self.queue_demo_bubbles(conversation_id, cx);
1093 }
1096 }
crates/app/src/call/demo.rs +24 −1
@@ -100,6 +100,9 @@ pub enum DemoScene {
100 100 Network,
101 101 Gallery,
102 102 Sharing,
103 Mini,
104 MiniOff,
105 MiniShare,
103 106 }
104 107
105 108 impl DemoScene {
@@ -116,6 +119,9 @@ impl DemoScene {
116 119 "network" => DemoScene::Network,
117 120 "gallery" => DemoScene::Gallery,
118 121 "sharing" => DemoScene::Sharing,
122 "mini" => DemoScene::Mini,
123 "mini-off" => DemoScene::MiniOff,
124 "mini-share" => DemoScene::MiniShare,
119 125 _ => return None,
120 126 })
121 127 }
@@ -123,10 +129,21 @@ impl DemoScene {
123 129 pub fn is_one_to_one(self) -> bool {
124 130 matches!(
125 131 self,
126 DemoScene::Call | DemoScene::Hold | DemoScene::Held | DemoScene::Consult | DemoScene::Network
132 DemoScene::Call
133 | DemoScene::Hold
134 | DemoScene::Held
135 | DemoScene::Consult
136 | DemoScene::Network
137 | DemoScene::Mini
138 | DemoScene::MiniOff
139 | DemoScene::MiniShare
127 140 )
128 141 }
129 142
143 pub fn minimized(self) -> bool {
144 matches!(self, DemoScene::Mini | DemoScene::MiniOff | DemoScene::MiniShare)
145 }
146
130 147 pub fn guests(self) -> Option<usize> {
131 148 match self {
132 149 DemoScene::Gallery => Some(DEMO_GALLERY_GUESTS),
@@ -138,6 +155,7 @@ impl DemoScene {
138 155 fn cameras(self) -> usize {
139 156 match self {
140 157 DemoScene::Gallery => GALLERY_CAMERAS,
158 DemoScene::MiniOff => 0,
141 159 _ => DEMO_CAMERAS,
142 160 }
143 161 }
@@ -417,7 +435,12 @@ fn start_scene(control: &CallControl, scene: DemoScene) {
417 435 DemoScene::Hold => control.send(CallUpdate::Hold(HoldState::Local)),
418 436 DemoScene::Held => control.send(CallUpdate::Hold(HoldState::Remote)),
419 437 DemoScene::Network => control.send(CallUpdate::Health(poor_network_health())),
438 DemoScene::MiniShare => {
439 control.send(CallUpdate::LocalShare(Some("Entire screen".to_owned())))
440 }
420 441 DemoScene::Call
442 | DemoScene::Mini
443 | DemoScene::MiniOff
421 444 | DemoScene::Consult
422 445 | DemoScene::Breakout
423 446 | DemoScene::Whiteboard
@@ -100,6 +100,9 @@ pub enum DemoScene {
100 Network,
100 Network,
101 Gallery,
101 Gallery,
102 Sharing,
102 Sharing,
103 Mini,
104 MiniOff,
105 MiniShare,
103}
106}
104
107
105impl DemoScene {
108impl DemoScene {
@@ -116,6 +119,9 @@ impl DemoScene {
116 "network" => DemoScene::Network,
119 "network" => DemoScene::Network,
117 "gallery" => DemoScene::Gallery,
120 "gallery" => DemoScene::Gallery,
118 "sharing" => DemoScene::Sharing,
121 "sharing" => DemoScene::Sharing,
122 "mini" => DemoScene::Mini,
123 "mini-off" => DemoScene::MiniOff,
124 "mini-share" => DemoScene::MiniShare,
119 _ => return None,
125 _ => return None,
120 })
126 })
121 }
127 }
@@ -123,10 +129,21 @@ impl DemoScene {
123 pub fn is_one_to_one(self) -> bool {
129 pub fn is_one_to_one(self) -> bool {
124 matches!(
130 matches!(
125 self,
131 self,
126 DemoScene::Call | DemoScene::Hold | DemoScene::Held | DemoScene::Consult | DemoScene::Network
132 DemoScene::Call
133 | DemoScene::Hold
134 | DemoScene::Held
135 | DemoScene::Consult
136 | DemoScene::Network
137 | DemoScene::Mini
138 | DemoScene::MiniOff
139 | DemoScene::MiniShare
127 )
140 )
128 }
141 }
129
142
143 pub fn minimized(self) -> bool {
144 matches!(self, DemoScene::Mini | DemoScene::MiniOff | DemoScene::MiniShare)
145 }
146
130 pub fn guests(self) -> Option<usize> {
147 pub fn guests(self) -> Option<usize> {
131 match self {
148 match self {
132 DemoScene::Gallery => Some(DEMO_GALLERY_GUESTS),
149 DemoScene::Gallery => Some(DEMO_GALLERY_GUESTS),
@@ -138,6 +155,7 @@ impl DemoScene {
138 fn cameras(self) -> usize {
155 fn cameras(self) -> usize {
139 match self {
156 match self {
140 DemoScene::Gallery => GALLERY_CAMERAS,
157 DemoScene::Gallery => GALLERY_CAMERAS,
158 DemoScene::MiniOff => 0,
141 _ => DEMO_CAMERAS,
159 _ => DEMO_CAMERAS,
142 }
160 }
143 }
161 }
@@ -417,7 +435,12 @@ fn start_scene(control: &CallControl, scene: DemoScene) {
417 DemoScene::Hold => control.send(CallUpdate::Hold(HoldState::Local)),
435 DemoScene::Hold => control.send(CallUpdate::Hold(HoldState::Local)),
418 DemoScene::Held => control.send(CallUpdate::Hold(HoldState::Remote)),
436 DemoScene::Held => control.send(CallUpdate::Hold(HoldState::Remote)),
419 DemoScene::Network => control.send(CallUpdate::Health(poor_network_health())),
437 DemoScene::Network => control.send(CallUpdate::Health(poor_network_health())),
438 DemoScene::MiniShare => {
439 control.send(CallUpdate::LocalShare(Some("Entire screen".to_owned())))
440 }
420 DemoScene::Call
441 DemoScene::Call
442 | DemoScene::Mini
443 | DemoScene::MiniOff
421 | DemoScene::Consult
444 | DemoScene::Consult
422 | DemoScene::Breakout
445 | DemoScene::Breakout
423 | DemoScene::Whiteboard
446 | DemoScene::Whiteboard
crates/app/src/views/call_mini.rs +133 −91
@@ -1,120 +1,162 @@
1 1 use std::time::Instant;
2 2
3 3 use gpui_kit::assets::IconName;
4 use gpui_kit::component::{h_flex, v_flex};
5 use gpui_kit::prelude::FluentBuilder as _;
4 use gpui_kit::component::h_flex;
6 5 use gpui_kit::*;
7 6
8 use super::call_view::{leave_button, mute_button, status_line};
7 use super::call_mini_window::{
8 ControlIds, WINDOW_RADIUS, chip, controls_row, self_view, speaker_layer, speaker_name_chip,
9 speaker_speaking, tinted_chip,
10 };
11 use super::call_view::status_line;
12 use super::message_row::ROW_PADDING;
13 use super::toolbar_placement::TimelineBounds;
9 14 use super::widgets::icon;
10 15 use crate::app_state::AppState;
11 16 use crate::theme;
12 17
13 pub const MINI_WIDTH: f32 = 220.;
18 const MINI_WIDTH: f32 = 256.;
19 const MINI_HEIGHT: f32 = 144.;
14 20 const MINI_RIGHT: f32 = 16.;
15 21 const MINI_BOTTOM: f32 = 40.;
16 const MUTE_SIZE: f32 = 28.;
17 22
18 fn sharing_badge(app: &Entity<AppState>) -> Stateful<Div> {
23 pub struct CallMiniView {
24 app: Entity<AppState>,
25 timeline: TimelineBounds,
26 _app_subscription: Subscription,
27 _media_subscription: Option<Subscription>,
28 }
29
30 impl CallMiniView {
31 pub fn new(app: Entity<AppState>, timeline: TimelineBounds, cx: &mut Context<Self>) -> Self {
32 let app_subscription = cx.observe(&app, |_, _, cx| cx.notify());
33 let media_subscription = app
34 .read(cx)
35 .call_media
36 .clone()
37 .map(|media| cx.observe(&media, |_, _, cx| cx.notify()));
38 CallMiniView {
39 app,
40 timeline,
41 _app_subscription: app_subscription,
42 _media_subscription: media_subscription,
43 }
44 }
45 }
46
47 fn stop_sharing_pill(app: &Entity<AppState>) -> Stateful<Div> {
19 48 let stop_app = app.clone();
20 h_flex()
21 .id("call-mini-sharing")
22 .gap(px(8.))
49 div()
50 .id("call-mini-stop-sharing")
51 .absolute()
52 .top(px(8.))
53 .right(px(8.))
54 .h(px(24.))
55 .px(px(10.))
56 .flex()
23 57 .items_center()
24 .justify_between()
25 .child(
26 h_flex()
27 .gap(px(6.))
28 .items_center()
29 .text_size(px(12.))
30 .font_weight(FontWeight::SEMIBOLD)
31 .text_color(theme::red())
32 .child(icon(IconName::ScreenShare, 14., theme::red()))
33 .child("Sharing"),
34 )
35 .child(
36 div()
37 .id("call-mini-stop-sharing")
38 .h(px(24.))
39 .px(px(10.))
40 .flex()
41 .items_center()
42 .rounded_full()
43 .bg(theme::red())
44 .text_color(theme::white())
45 .text_size(px(12.))
46 .font_weight(FontWeight::SEMIBOLD)
47 .cursor_pointer()
48 .hover(|button| button.opacity(0.85))
49 .child("Stop")
50 .on_click(move |_, _, cx| {
51 cx.stop_propagation();
52 stop_app.update(cx, |state, cx| state.stop_call_share(cx));
53 }),
54 )
58 .gap(px(4.))
59 .rounded_full()
60 .bg(theme::red())
61 .text_color(theme::white())
62 .text_size(px(12.))
63 .font_weight(FontWeight::SEMIBOLD)
64 .cursor_pointer()
65 .hover(|button| button.opacity(0.85))
66 .child(icon(IconName::ScreenShare, 14., theme::white()))
67 .child("Stop")
68 .on_click(move |_, _, cx| {
69 cx.stop_propagation();
70 stop_app.update(cx, |state, cx| state.stop_call_share(cx));
71 })
55 72 }
56 73
57 pub fn render_call_mini(app: &Entity<AppState>, state: &AppState) -> Option<AnyElement> {
58 let call = state.call.as_ref().filter(|call| !call.viewing)?;
59 let model = &call.model;
60 let (status, status_color) = status_line(model, Instant::now());
61 let open_app = app.clone();
62 let speaking = model.remote_speaking;
63 Some(
64 v_flex()
74 impl Render for CallMiniView {
75 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
76 let state = self.app.read(cx);
77 let Some(call) = state.call.as_ref().filter(|call| !call.viewing) else {
78 return div().into_any_element();
79 };
80 let model = &call.model;
81 let now = Instant::now();
82 let (status, _) = status_line(model, now);
83 let viewport = window.viewport_size();
84 let (right, bottom) = self.timeline.get().map_or(
85 (px(MINI_RIGHT), px(MINI_BOTTOM)),
86 |timeline| {
87 (
88 viewport.width - timeline.right() + px(ROW_PADDING),
89 viewport.height - timeline.bottom() + px(MINI_RIGHT),
90 )
91 },
92 );
93 let sharing = model.local_share.is_some();
94 let open_app = self.app.clone();
95 let back_app = self.app.clone();
96 let speaker_name = speaker_name_chip(state, model, now);
97 let border = if sharing {
98 theme::red()
99 } else if speaker_speaking(model) {
100 theme::green()
101 } else {
102 theme::border_strong()
103 };
104 let top_left = if sharing {
105 tinted_chip("Sharing".to_owned(), theme::red())
106 } else {
107 chip(status)
108 };
109 div()
65 110 .id("call-mini")
111 .group("call-mini")
66 112 .occlude()
67 113 .absolute()
68 .right(px(MINI_RIGHT))
69 .bottom(px(MINI_BOTTOM))
114 .right(right)
115 .bottom(bottom)
70 116 .w(px(MINI_WIDTH))
71 .p(px(10.))
72 .gap(px(8.))
73 .rounded(px(10.))
74 .bg(theme::surface_raised())
75 .border_1()
76 .border_color(if speaking {
77 theme::green()
78 } else {
79 theme::border_strong()
80 })
117 .h(px(MINI_HEIGHT))
118 .overflow_hidden()
119 .rounded(px(WINDOW_RADIUS))
120 .bg(theme::surface())
121 .border_2()
122 .border_color(border)
123 .text_color(theme::text())
81 124 .shadow_lg()
82 125 .cursor_pointer()
83 126 .on_click(move |_, _, cx| {
84 127 open_app.update(cx, |state, cx| state.show_call(true, cx));
85 128 })
129 .child(speaker_layer(state, model, now))
86 130 .child(
87 h_flex()
88 .gap(px(8.))
89 .items_center()
90 .child(icon(IconName::Phone, 14., theme::accent_text()))
91 .child(
92 div()
93 .flex_1()
94 .min_w_0()
95 .truncate()
96 .text_size(px(13.))
97 .font_weight(FontWeight::SEMIBOLD)
98 .child(model.title.clone()),
99 )
100 .child(
101 div()
102 .text_size(px(12.))
103 .text_color(status_color)
104 .child(status),
105 ),
131 div()
132 .absolute()
133 .top(px(8.))
134 .left(px(8.))
135 .child(top_left),
106 136 )
107 .when(model.local_share.is_some(), |mini| {
108 mini.child(sharing_badge(app))
109 })
110 .child(
137 .children(speaker_name.map(|name| {
111 138 h_flex()
112 .gap(px(8.))
113 .items_center()
114 .justify_between()
115 .child(mute_button(app, model, "call-mini-mute", MUTE_SIZE))
116 .child(leave_button(app, model, "call-mini-leave", true)),
117 )
118 .into_any_element(),
119 )
139 .absolute()
140 .bottom(px(6.))
141 .left(px(8.))
142 .child(name)
143 }))
144 .children(if sharing {
145 Some(stop_sharing_pill(&self.app).into_any_element())
146 } else {
147 self_view(state, model, now)
148 })
149 .child(controls_row(
150 &self.app,
151 model,
152 ControlIds {
153 mute: "call-mini-mute",
154 back: "call-mini-back",
155 leave: "call-mini-leave",
156 },
157 "call-mini",
158 move |cx| back_app.update(cx, |state, cx| state.show_call(true, cx)),
159 ))
160 .into_any_element()
161 }
120 162 }
@@ -1,120 +1,162 @@
1use std::time::Instant;
1use std::time::Instant;
2
2
3use gpui_kit::assets::IconName;
3use gpui_kit::assets::IconName;
4use gpui_kit::component::{h_flex, v_flex};
4use gpui_kit::component::h_flex;
5use gpui_kit::prelude::FluentBuilder as _;
6use gpui_kit::*;
5use gpui_kit::*;
7
6
8use super::call_view::{leave_button, mute_button, status_line};
7use super::call_mini_window::{
8 ControlIds, WINDOW_RADIUS, chip, controls_row, self_view, speaker_layer, speaker_name_chip,
9 speaker_speaking, tinted_chip,
10};
11use super::call_view::status_line;
12use super::message_row::ROW_PADDING;
13use super::toolbar_placement::TimelineBounds;
9use super::widgets::icon;
14use super::widgets::icon;
10use crate::app_state::AppState;
15use crate::app_state::AppState;
11use crate::theme;
16use crate::theme;
12
17
13pub const MINI_WIDTH: f32 = 220.;
18const MINI_WIDTH: f32 = 256.;
19const MINI_HEIGHT: f32 = 144.;
14const MINI_RIGHT: f32 = 16.;
20const MINI_RIGHT: f32 = 16.;
15const MINI_BOTTOM: f32 = 40.;
21const MINI_BOTTOM: f32 = 40.;
16const MUTE_SIZE: f32 = 28.;
17
22
18fn sharing_badge(app: &Entity<AppState>) -> Stateful<Div> {
23pub struct CallMiniView {
24 app: Entity<AppState>,
25 timeline: TimelineBounds,
26 _app_subscription: Subscription,
27 _media_subscription: Option<Subscription>,
28}
29
30impl CallMiniView {
31 pub fn new(app: Entity<AppState>, timeline: TimelineBounds, cx: &mut Context<Self>) -> Self {
32 let app_subscription = cx.observe(&app, |_, _, cx| cx.notify());
33 let media_subscription = app
34 .read(cx)
35 .call_media
36 .clone()
37 .map(|media| cx.observe(&media, |_, _, cx| cx.notify()));
38 CallMiniView {
39 app,
40 timeline,
41 _app_subscription: app_subscription,
42 _media_subscription: media_subscription,
43 }
44 }
45}
46
47fn stop_sharing_pill(app: &Entity<AppState>) -> Stateful<Div> {
19 let stop_app = app.clone();
48 let stop_app = app.clone();
20 h_flex()
49 div()
21 .id("call-mini-sharing")
50 .id("call-mini-stop-sharing")
22 .gap(px(8.))
51 .absolute()
52 .top(px(8.))
53 .right(px(8.))
54 .h(px(24.))
55 .px(px(10.))
56 .flex()
23 .items_center()
57 .items_center()
24 .justify_between()
58 .gap(px(4.))
25 .child(
59 .rounded_full()
26 h_flex()
60 .bg(theme::red())
27 .gap(px(6.))
61 .text_color(theme::white())
28 .items_center()
62 .text_size(px(12.))
29 .text_size(px(12.))
63 .font_weight(FontWeight::SEMIBOLD)
30 .font_weight(FontWeight::SEMIBOLD)
64 .cursor_pointer()
31 .text_color(theme::red())
65 .hover(|button| button.opacity(0.85))
32 .child(icon(IconName::ScreenShare, 14., theme::red()))
66 .child(icon(IconName::ScreenShare, 14., theme::white()))
33 .child("Sharing"),
67 .child("Stop")
34 )
68 .on_click(move |_, _, cx| {
35 .child(
69 cx.stop_propagation();
36 div()
70 stop_app.update(cx, |state, cx| state.stop_call_share(cx));
37 .id("call-mini-stop-sharing")
71 })
38 .h(px(24.))
39 .px(px(10.))
40 .flex()
41 .items_center()
42 .rounded_full()
43 .bg(theme::red())
44 .text_color(theme::white())
45 .text_size(px(12.))
46 .font_weight(FontWeight::SEMIBOLD)
47 .cursor_pointer()
48 .hover(|button| button.opacity(0.85))
49 .child("Stop")
50 .on_click(move |_, _, cx| {
51 cx.stop_propagation();
52 stop_app.update(cx, |state, cx| state.stop_call_share(cx));
53 }),
54 )
55}
72}
56
73
57pub fn render_call_mini(app: &Entity<AppState>, state: &AppState) -> Option<AnyElement> {
74impl Render for CallMiniView {
58 let call = state.call.as_ref().filter(|call| !call.viewing)?;
75 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
59 let model = &call.model;
76 let state = self.app.read(cx);
60 let (status, status_color) = status_line(model, Instant::now());
77 let Some(call) = state.call.as_ref().filter(|call| !call.viewing) else {
61 let open_app = app.clone();
78 return div().into_any_element();
62 let speaking = model.remote_speaking;
79 };
63 Some(
80 let model = &call.model;
64 v_flex()
81 let now = Instant::now();
82 let (status, _) = status_line(model, now);
83 let viewport = window.viewport_size();
84 let (right, bottom) = self.timeline.get().map_or(
85 (px(MINI_RIGHT), px(MINI_BOTTOM)),
86 |timeline| {
87 (
88 viewport.width - timeline.right() + px(ROW_PADDING),
89 viewport.height - timeline.bottom() + px(MINI_RIGHT),
90 )
91 },
92 );
93 let sharing = model.local_share.is_some();
94 let open_app = self.app.clone();
95 let back_app = self.app.clone();
96 let speaker_name = speaker_name_chip(state, model, now);
97 let border = if sharing {
98 theme::red()
99 } else if speaker_speaking(model) {
100 theme::green()
101 } else {
102 theme::border_strong()
103 };
104 let top_left = if sharing {
105 tinted_chip("Sharing".to_owned(), theme::red())
106 } else {
107 chip(status)
108 };
109 div()
65 .id("call-mini")
110 .id("call-mini")
111 .group("call-mini")
66 .occlude()
112 .occlude()
67 .absolute()
113 .absolute()
68 .right(px(MINI_RIGHT))
114 .right(right)
69 .bottom(px(MINI_BOTTOM))
115 .bottom(bottom)
70 .w(px(MINI_WIDTH))
116 .w(px(MINI_WIDTH))
71 .p(px(10.))
117 .h(px(MINI_HEIGHT))
72 .gap(px(8.))
118 .overflow_hidden()
73 .rounded(px(10.))
119 .rounded(px(WINDOW_RADIUS))
74 .bg(theme::surface_raised())
120 .bg(theme::surface())
75 .border_1()
121 .border_2()
76 .border_color(if speaking {
122 .border_color(border)
77 theme::green()
123 .text_color(theme::text())
78 } else {
79 theme::border_strong()
80 })
81 .shadow_lg()
124 .shadow_lg()
82 .cursor_pointer()
125 .cursor_pointer()
83 .on_click(move |_, _, cx| {
126 .on_click(move |_, _, cx| {
84 open_app.update(cx, |state, cx| state.show_call(true, cx));
127 open_app.update(cx, |state, cx| state.show_call(true, cx));
85 })
128 })
129 .child(speaker_layer(state, model, now))
86 .child(
130 .child(
87 h_flex()
131 div()
88 .gap(px(8.))
132 .absolute()
89 .items_center()
133 .top(px(8.))
90 .child(icon(IconName::Phone, 14., theme::accent_text()))
134 .left(px(8.))
91 .child(
135 .child(top_left),
92 div()
93 .flex_1()
94 .min_w_0()
95 .truncate()
96 .text_size(px(13.))
97 .font_weight(FontWeight::SEMIBOLD)
98 .child(model.title.clone()),
99 )
100 .child(
101 div()
102 .text_size(px(12.))
103 .text_color(status_color)
104 .child(status),
105 ),
106 )
136 )
107 .when(model.local_share.is_some(), |mini| {
137 .children(speaker_name.map(|name| {
108 mini.child(sharing_badge(app))
109 })
110 .child(
111 h_flex()
138 h_flex()
112 .gap(px(8.))
139 .absolute()
113 .items_center()
140 .bottom(px(6.))
114 .justify_between()
141 .left(px(8.))
115 .child(mute_button(app, model, "call-mini-mute", MUTE_SIZE))
142 .child(name)
116 .child(leave_button(app, model, "call-mini-leave", true)),
143 }))
117 )
144 .children(if sharing {
118 .into_any_element(),
145 Some(stop_sharing_pill(&self.app).into_any_element())
119 )
146 } else {
147 self_view(state, model, now)
148 })
149 .child(controls_row(
150 &self.app,
151 model,
152 ControlIds {
153 mute: "call-mini-mute",
154 back: "call-mini-back",
155 leave: "call-mini-leave",
156 },
157 "call-mini",
158 move |cx| back_app.update(cx, |state, cx| state.show_call(true, cx)),
159 ))
160 .into_any_element()
161 }
120}
162}
crates/app/src/views/call_mini_window.rs +95 −60
@@ -12,9 +12,9 @@ use crate::app_state::AppState;
12 12 use crate::call::{CallModel, CallWindows, Tile, TileState};
13 13 use crate::theme;
14 14
15 const CONTROLS_HEIGHT: f32 = 44.;
16 const CONTROL_SIZE: f32 = 30.;
17 const WINDOW_RADIUS: f32 = 10.;
15 pub(super) const CONTROLS_HEIGHT: f32 = 44.;
16 pub(super) const CONTROL_SIZE: f32 = 30.;
17 pub(super) const WINDOW_RADIUS: f32 = 10.;
18 18 const SELF_VIEW_WIDTH: f32 = 80.;
19 19 const SELF_VIEW_HEIGHT: f32 = 45.;
20 20 const SPEAKER_AVATAR: f32 = 56.;
@@ -66,14 +66,18 @@ pub fn speaker_tile(model: &CallModel) -> Option<&Tile> {
66 66 .or_else(|| present.first().copied())
67 67 }
68 68
69 fn chip(text: String) -> Div {
69 pub(super) fn chip(text: String) -> Div {
70 tinted_chip(text, hsla(0., 0., 0., CHIP_BACKGROUND))
71 }
72
73 pub(super) fn tinted_chip(text: String, background: Hsla) -> Div {
70 74 div()
71 75 .max_w(px(180.))
72 76 .truncate()
73 77 .px(px(8.))
74 78 .py(px(3.))
75 79 .rounded(px(6.))
76 .bg(hsla(0., 0., 0., CHIP_BACKGROUND))
80 .bg(background)
77 81 .text_size(px(12.))
78 82 .font_weight(FontWeight::SEMIBOLD)
79 83 .text_color(theme::white())
@@ -86,10 +90,32 @@ fn cover(image: std::sync::Arc<RenderImage>) -> Img {
86 90 .object_fit(ObjectFit::Cover)
87 91 }
88 92
89 fn speaker_layer(state: &AppState, model: &CallModel, now: Instant) -> AnyElement {
90 let Some(call) = state.call.as_ref() else {
93 fn speaker_video(
94 state: &AppState,
95 model: &CallModel,
96 tile: &Tile,
97 now: Instant,
98 ) -> Option<std::sync::Arc<RenderImage>> {
99 let call = state.call.as_ref()?;
100 (tile.has_video || model.is_one_to_one())
101 .then(|| call.pictures.live(&VideoKey::Person(tile.mri.clone()), now))
102 .flatten()
103 }
104
105 pub(super) fn speaker_name_chip(
106 state: &AppState,
107 model: &CallModel,
108 now: Instant,
109 ) -> Option<Div> {
110 let tile = speaker_tile(model)?;
111 speaker_video(state, model, tile, now)?;
112 Some(chip(tile.name.clone()))
113 }
114
115 pub(super) fn speaker_layer(state: &AppState, model: &CallModel, now: Instant) -> AnyElement {
116 if state.call.is_none() {
91 117 return div().into_any_element();
92 };
118 }
93 119 let Some(tile) = speaker_tile(model) else {
94 120 return v_flex()
95 121 .size_full()
@@ -106,10 +132,7 @@ fn speaker_layer(state: &AppState, model: &CallModel, now: Instant) -> AnyElemen
106 132 )
107 133 .into_any_element();
108 134 };
109 let video = (tile.has_video || model.is_one_to_one())
110 .then(|| call.pictures.live(&VideoKey::Person(tile.mri.clone()), now))
111 .flatten();
112 match video {
135 match speaker_video(state, model, tile, now) {
113 136 Some(image) => cover(image).into_any_element(),
114 137 None => v_flex()
115 138 .size_full()
@@ -134,7 +157,7 @@ fn speaker_layer(state: &AppState, model: &CallModel, now: Instant) -> AnyElemen
134 157 }
135 158 }
136 159
137 fn self_view(state: &AppState, model: &CallModel, now: Instant) -> Option<AnyElement> {
160 pub(super) fn self_view(state: &AppState, model: &CallModel, now: Instant) -> Option<AnyElement> {
138 161 let image = state
139 162 .call
140 163 .as_ref()
@@ -156,6 +179,51 @@ fn self_view(state: &AppState, model: &CallModel, now: Instant) -> Option<AnyEle
156 179 )
157 180 }
158 181
182 pub(super) fn speaker_speaking(model: &CallModel) -> bool {
183 speaker_tile(model).is_some_and(|tile| model.tile_speaking(tile))
184 }
185
186 pub(super) struct ControlIds {
187 pub mute: &'static str,
188 pub back: &'static str,
189 pub leave: &'static str,
190 }
191
192 pub(super) fn controls_row(
193 app: &Entity<AppState>,
194 model: &CallModel,
195 ids: ControlIds,
196 group: &'static str,
197 on_back: impl Fn(&mut App) + 'static,
198 ) -> Div {
199 h_flex()
200 .absolute()
201 .left_0()
202 .right_0()
203 .bottom_0()
204 .h(px(CONTROLS_HEIGHT))
205 .gap(px(10.))
206 .items_center()
207 .justify_center()
208 .bg(hsla(0., 0., 0., SHADE_BACKGROUND))
209 .opacity(0.)
210 .group_hover(group, |controls| controls.opacity(1.))
211 .child(mute_button(app, model, ids.mute, CONTROL_SIZE))
212 .child(camera_button(app, model).size(px(CONTROL_SIZE)))
213 .child(
214 round_control(
215 ids.back,
216 IconName::Maximize2,
217 theme::surface_raised(),
218 theme::text(),
219 )
220 .size(px(CONTROL_SIZE))
221 .tooltip(|window, cx| Tooltip::new("Back to call").build(window, cx))
222 .on_click(move |_, _, cx| on_back(cx)),
223 )
224 .child(leave_button(app, model, ids.leave, true))
225 }
226
159 227 impl Render for MiniWindowView {
160 228 fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
161 229 let state = self.app.read(cx);
@@ -166,8 +234,8 @@ impl Render for MiniWindowView {
166 234 let now = Instant::now();
167 235 let (status, _) = status_line(model, now);
168 236 let windows = self.windows.clone();
169 let speaking = speaker_tile(model).is_some_and(|tile| model.tile_speaking(tile));
170 let speaker_name = speaker_tile(model).map(|tile| tile.name.clone());
237 let speaking = speaker_speaking(model);
238 let speaker_name = speaker_name_chip(state, model, now);
171 239 div()
172 240 .id("call-mini-window")
173 241 .group("call-mini-window")
@@ -202,54 +270,21 @@ impl Render for MiniWindowView {
202 270 .child(chip(status)),
203 271 )
204 272 .children(speaker_name.map(|name| {
205 div()
206 .absolute()
207 .bottom(px(6.))
208 .left(px(8.))
209 .child(chip(name))
273 div().absolute().bottom(px(6.)).left(px(8.)).child(name)
210 274 }))
211 275 .children(self_view(state, model, now)),
212 276 )
213 .child(
214 h_flex()
215 .absolute()
216 .left_0()
217 .right_0()
218 .bottom_0()
219 .h(px(CONTROLS_HEIGHT))
220 .gap(px(10.))
221 .items_center()
222 .justify_center()
223 .bg(hsla(0., 0., 0., SHADE_BACKGROUND))
224 .opacity(0.)
225 .group_hover("call-mini-window", |controls| controls.opacity(1.))
226 .child(mute_button(
227 &self.app,
228 model,
229 "call-mini-window-mute",
230 CONTROL_SIZE,
231 ))
232 .child(camera_button(&self.app, model).size(px(CONTROL_SIZE)))
233 .child(
234 round_control(
235 "call-mini-window-back",
236 IconName::Maximize2,
237 theme::surface_raised(),
238 theme::text(),
239 )
240 .size(px(CONTROL_SIZE))
241 .tooltip(|window, cx| Tooltip::new("Back to call").build(window, cx))
242 .on_click(move |_, _, cx| {
243 windows.update(cx, |windows, cx| windows.return_to_call(cx))
244 }),
245 )
246 .child(leave_button(
247 &self.app,
248 model,
249 "call-mini-window-leave",
250 true,
251 )),
252 )
277 .child(controls_row(
278 &self.app,
279 model,
280 ControlIds {
281 mute: "call-mini-window-mute",
282 back: "call-mini-window-back",
283 leave: "call-mini-window-leave",
284 },
285 "call-mini-window",
286 move |cx| windows.update(cx, |windows, cx| windows.return_to_call(cx)),
287 ))
253 288 .into_any_element()
254 289 }
255 290 }
@@ -12,9 +12,9 @@ use crate::app_state::AppState;
12use crate::call::{CallModel, CallWindows, Tile, TileState};
12use crate::call::{CallModel, CallWindows, Tile, TileState};
13use crate::theme;
13use crate::theme;
14
14
15const CONTROLS_HEIGHT: f32 = 44.;
15pub(super) const CONTROLS_HEIGHT: f32 = 44.;
16const CONTROL_SIZE: f32 = 30.;
16pub(super) const CONTROL_SIZE: f32 = 30.;
17const WINDOW_RADIUS: f32 = 10.;
17pub(super) const WINDOW_RADIUS: f32 = 10.;
18const SELF_VIEW_WIDTH: f32 = 80.;
18const SELF_VIEW_WIDTH: f32 = 80.;
19const SELF_VIEW_HEIGHT: f32 = 45.;
19const SELF_VIEW_HEIGHT: f32 = 45.;
20const SPEAKER_AVATAR: f32 = 56.;
20const SPEAKER_AVATAR: f32 = 56.;
@@ -66,14 +66,18 @@ pub fn speaker_tile(model: &CallModel) -> Option<&Tile> {
66 .or_else(|| present.first().copied())
66 .or_else(|| present.first().copied())
67}
67}
68
68
69fn chip(text: String) -> Div {
69pub(super) fn chip(text: String) -> Div {
70 tinted_chip(text, hsla(0., 0., 0., CHIP_BACKGROUND))
71}
72
73pub(super) fn tinted_chip(text: String, background: Hsla) -> Div {
70 div()
74 div()
71 .max_w(px(180.))
75 .max_w(px(180.))
72 .truncate()
76 .truncate()
73 .px(px(8.))
77 .px(px(8.))
74 .py(px(3.))
78 .py(px(3.))
75 .rounded(px(6.))
79 .rounded(px(6.))
76 .bg(hsla(0., 0., 0., CHIP_BACKGROUND))
80 .bg(background)
77 .text_size(px(12.))
81 .text_size(px(12.))
78 .font_weight(FontWeight::SEMIBOLD)
82 .font_weight(FontWeight::SEMIBOLD)
79 .text_color(theme::white())
83 .text_color(theme::white())
@@ -86,10 +90,32 @@ fn cover(image: std::sync::Arc<RenderImage>) -> Img {
86 .object_fit(ObjectFit::Cover)
90 .object_fit(ObjectFit::Cover)
87}
91}
88
92
89fn speaker_layer(state: &AppState, model: &CallModel, now: Instant) -> AnyElement {
93fn speaker_video(
90 let Some(call) = state.call.as_ref() else {
94 state: &AppState,
95 model: &CallModel,
96 tile: &Tile,
97 now: Instant,
98) -> Option<std::sync::Arc<RenderImage>> {
99 let call = state.call.as_ref()?;
100 (tile.has_video || model.is_one_to_one())
101 .then(|| call.pictures.live(&VideoKey::Person(tile.mri.clone()), now))
102 .flatten()
103}
104
105pub(super) fn speaker_name_chip(
106 state: &AppState,
107 model: &CallModel,
108 now: Instant,
109) -> Option<Div> {
110 let tile = speaker_tile(model)?;
111 speaker_video(state, model, tile, now)?;
112 Some(chip(tile.name.clone()))
113}
114
115pub(super) fn speaker_layer(state: &AppState, model: &CallModel, now: Instant) -> AnyElement {
116 if state.call.is_none() {
91 return div().into_any_element();
117 return div().into_any_element();
92 };
118 }
93 let Some(tile) = speaker_tile(model) else {
119 let Some(tile) = speaker_tile(model) else {
94 return v_flex()
120 return v_flex()
95 .size_full()
121 .size_full()
@@ -106,10 +132,7 @@ fn speaker_layer(state: &AppState, model: &CallModel, now: Instant) -> AnyElemen
106 )
132 )
107 .into_any_element();
133 .into_any_element();
108 };
134 };
109 let video = (tile.has_video || model.is_one_to_one())
135 match speaker_video(state, model, tile, now) {
110 .then(|| call.pictures.live(&VideoKey::Person(tile.mri.clone()), now))
111 .flatten();
112 match video {
113 Some(image) => cover(image).into_any_element(),
136 Some(image) => cover(image).into_any_element(),
114 None => v_flex()
137 None => v_flex()
115 .size_full()
138 .size_full()
@@ -134,7 +157,7 @@ fn speaker_layer(state: &AppState, model: &CallModel, now: Instant) -> AnyElemen
134 }
157 }
135}
158}
136
159
137fn self_view(state: &AppState, model: &CallModel, now: Instant) -> Option<AnyElement> {
160pub(super) fn self_view(state: &AppState, model: &CallModel, now: Instant) -> Option<AnyElement> {
138 let image = state
161 let image = state
139 .call
162 .call
140 .as_ref()
163 .as_ref()
@@ -156,6 +179,51 @@ fn self_view(state: &AppState, model: &CallModel, now: Instant) -> Option<AnyEle
156 )
179 )
157}
180}
158
181
182pub(super) fn speaker_speaking(model: &CallModel) -> bool {
183 speaker_tile(model).is_some_and(|tile| model.tile_speaking(tile))
184}
185
186pub(super) struct ControlIds {
187 pub mute: &'static str,
188 pub back: &'static str,
189 pub leave: &'static str,
190}
191
192pub(super) fn controls_row(
193 app: &Entity<AppState>,
194 model: &CallModel,
195 ids: ControlIds,
196 group: &'static str,
197 on_back: impl Fn(&mut App) + 'static,
198) -> Div {
199 h_flex()
200 .absolute()
201 .left_0()
202 .right_0()
203 .bottom_0()
204 .h(px(CONTROLS_HEIGHT))
205 .gap(px(10.))
206 .items_center()
207 .justify_center()
208 .bg(hsla(0., 0., 0., SHADE_BACKGROUND))
209 .opacity(0.)
210 .group_hover(group, |controls| controls.opacity(1.))
211 .child(mute_button(app, model, ids.mute, CONTROL_SIZE))
212 .child(camera_button(app, model).size(px(CONTROL_SIZE)))
213 .child(
214 round_control(
215 ids.back,
216 IconName::Maximize2,
217 theme::surface_raised(),
218 theme::text(),
219 )
220 .size(px(CONTROL_SIZE))
221 .tooltip(|window, cx| Tooltip::new("Back to call").build(window, cx))
222 .on_click(move |_, _, cx| on_back(cx)),
223 )
224 .child(leave_button(app, model, ids.leave, true))
225}
226
159impl Render for MiniWindowView {
227impl Render for MiniWindowView {
160 fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
228 fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
161 let state = self.app.read(cx);
229 let state = self.app.read(cx);
@@ -166,8 +234,8 @@ impl Render for MiniWindowView {
166 let now = Instant::now();
234 let now = Instant::now();
167 let (status, _) = status_line(model, now);
235 let (status, _) = status_line(model, now);
168 let windows = self.windows.clone();
236 let windows = self.windows.clone();
169 let speaking = speaker_tile(model).is_some_and(|tile| model.tile_speaking(tile));
237 let speaking = speaker_speaking(model);
170 let speaker_name = speaker_tile(model).map(|tile| tile.name.clone());
238 let speaker_name = speaker_name_chip(state, model, now);
171 div()
239 div()
172 .id("call-mini-window")
240 .id("call-mini-window")
173 .group("call-mini-window")
241 .group("call-mini-window")
@@ -202,54 +270,21 @@ impl Render for MiniWindowView {
202 .child(chip(status)),
270 .child(chip(status)),
203 )
271 )
204 .children(speaker_name.map(|name| {
272 .children(speaker_name.map(|name| {
205 div()
273 div().absolute().bottom(px(6.)).left(px(8.)).child(name)
206 .absolute()
207 .bottom(px(6.))
208 .left(px(8.))
209 .child(chip(name))
210 }))
274 }))
211 .children(self_view(state, model, now)),
275 .children(self_view(state, model, now)),
212 )
276 )
213 .child(
277 .child(controls_row(
214 h_flex()
278 &self.app,
215 .absolute()
279 model,
216 .left_0()
280 ControlIds {
217 .right_0()
281 mute: "call-mini-window-mute",
218 .bottom_0()
282 back: "call-mini-window-back",
219 .h(px(CONTROLS_HEIGHT))
283 leave: "call-mini-window-leave",
220 .gap(px(10.))
284 },
221 .items_center()
285 "call-mini-window",
222 .justify_center()
286 move |cx| windows.update(cx, |windows, cx| windows.return_to_call(cx)),
223 .bg(hsla(0., 0., 0., SHADE_BACKGROUND))
287 ))
224 .opacity(0.)
225 .group_hover("call-mini-window", |controls| controls.opacity(1.))
226 .child(mute_button(
227 &self.app,
228 model,
229 "call-mini-window-mute",
230 CONTROL_SIZE,
231 ))
232 .child(camera_button(&self.app, model).size(px(CONTROL_SIZE)))
233 .child(
234 round_control(
235 "call-mini-window-back",
236 IconName::Maximize2,
237 theme::surface_raised(),
238 theme::text(),
239 )
240 .size(px(CONTROL_SIZE))
241 .tooltip(|window, cx| Tooltip::new("Back to call").build(window, cx))
242 .on_click(move |_, _, cx| {
243 windows.update(cx, |windows, cx| windows.return_to_call(cx))
244 }),
245 )
246 .child(leave_button(
247 &self.app,
248 model,
249 "call-mini-window-leave",
250 true,
251 )),
252 )
253 .into_any_element()
288 .into_any_element()
254 }
289 }
255}
290}
crates/app/src/views/conversation.rs +4 −0
@@ -437,6 +437,10 @@ impl ConversationView {
437 437 Self::build(app, None, window, cx)
438 438 }
439 439
440 pub fn timeline_bounds(&self) -> TimelineBounds {
441 self.timeline_bounds.clone()
442 }
443
440 444 pub fn pinned_to(
441 445 app: Entity<AppState>,
442 446 selection: Selection,
@@ -437,6 +437,10 @@ impl ConversationView {
437 Self::build(app, None, window, cx)
437 Self::build(app, None, window, cx)
438 }
438 }
439
439
440 pub fn timeline_bounds(&self) -> TimelineBounds {
441 self.timeline_bounds.clone()
442 }
443
440 pub fn pinned_to(
444 pub fn pinned_to(
441 app: Entity<AppState>,
445 app: Entity<AppState>,
442 selection: Selection,
446 selection: Selection,
crates/app/src/views/message_row.rs +1 −1
@@ -47,7 +47,7 @@ const SERIES_START_GAP: f32 = 8.;
47 47 pub(super) const BODY_SIZE: f32 = 13.5;
48 48 const MAX_WIDTH_RATIO: f32 = 0.7;
49 49 const NARROW_BUBBLE_WIDTH: f32 = 300.;
50 const ROW_PADDING: f32 = 20.;
50 pub(super) const ROW_PADDING: f32 = 20.;
51 51 const REACTION_FOOTER_HEIGHT: f32 = 24.;
52 52 const META_SIZE: f32 = 11.;
53 53 const META_CHECK_SIZE: f32 = 15.;
@@ -47,7 +47,7 @@ const SERIES_START_GAP: f32 = 8.;
47pub(super) const BODY_SIZE: f32 = 13.5;
47pub(super) const BODY_SIZE: f32 = 13.5;
48const MAX_WIDTH_RATIO: f32 = 0.7;
48const MAX_WIDTH_RATIO: f32 = 0.7;
49const NARROW_BUBBLE_WIDTH: f32 = 300.;
49const NARROW_BUBBLE_WIDTH: f32 = 300.;
50const ROW_PADDING: f32 = 20.;
50pub(super) const ROW_PADDING: f32 = 20.;
51const REACTION_FOOTER_HEIGHT: f32 = 24.;
51const REACTION_FOOTER_HEIGHT: f32 = 24.;
52const META_SIZE: f32 = 11.;
52const META_SIZE: f32 = 11.;
53const META_CHECK_SIZE: f32 = 15.;
53const META_CHECK_SIZE: f32 = 15.;
crates/app/src/views/shell.rs +15 −3
@@ -4,7 +4,7 @@ use gpui_kit::component::{h_flex, v_flex};
4 4 use gpui_kit::*;
5 5
6 6 use super::activity_panel::{ActivityPanel, ActivityPanelEvent};
7 use super::call_mini::render_call_mini;
7 use super::call_mini::CallMiniView;
8 8 use super::call_stage::{render_call_overlay, render_stage_overlay};
9 9 use super::call_view::{CHAT_PANEL_WIDTH, OVERLAY_BELOW as CALL_COLUMN_MIN, render_call_view};
10 10 use super::conversation::{ConversationView, ReplyToHovered};
@@ -110,6 +110,7 @@ pub struct AppShell {
110 110 update: UpdateStatus,
111 111 user_input: Arc<UserInput>,
112 112 _subscription: Subscription,
113 call_mini: Entity<CallMiniView>,
113 114 _call_media_observation: Subscription,
114 115 _panel_subscriptions: [Subscription; 2],
115 116 _agent_subscription: Option<Subscription>,
@@ -158,7 +159,11 @@ impl AppShell {
158 159 ) -> Self {
159 160 let call_media = cx.new(|_| CallMedia);
160 161 state.update(cx, |state, _| state.call_media = Some(call_media.clone()));
161 let call_media_observation = cx.observe(&call_media, |_, _, cx| cx.notify());
162 let call_media_observation = cx.observe(&call_media, |this, _, cx| {
163 if this.state.read(cx).viewing_call() {
164 cx.notify();
165 }
166 });
162 167 let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
163 168 let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
164 169 let saved_panel = cx.new(|cx| SavedPanel::new(state.clone(), cx));
@@ -201,6 +206,8 @@ impl AppShell {
201 206 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, saved_panel, cx));
202 207 let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
203 208 let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
209 let timeline = conversation.read(cx).timeline_bounds();
210 let call_mini = cx.new(|cx| CallMiniView::new(state.clone(), timeline, cx));
204 211 let subscription =
205 212 cx.subscribe_in(&state, window, |this, _, event: &AppEvent, window, cx| {
206 213 if matches!(event, AppEvent::Sidebar | AppEvent::Status) {
@@ -270,6 +277,7 @@ impl AppShell {
270 277 update: UpdateStatus::UpToDate,
271 278 user_input,
272 279 _subscription: subscription,
280 call_mini,
273 281 _call_media_observation: call_media_observation,
274 282 _panel_subscriptions: panel_subscriptions,
275 283 _agent_subscription: agent_subscription,
@@ -768,7 +776,11 @@ impl Render for AppShell {
768 776 view => (view, None),
769 777 };
770 778 self.sync_window_fullscreen(call_fullscreen, window);
771 let call_mini = render_call_mini(&self.state, state);
779 let call_mini = state
780 .call
781 .as_ref()
782 .is_some_and(|call| !call.viewing)
783 .then(|| self.call_mini.clone());
772 784 let stage_overlay = render_stage_overlay(&self.state, state);
773 785 let status = render_status_bar(
774 786 state,
@@ -4,7 +4,7 @@ use gpui_kit::component::{h_flex, v_flex};
4use gpui_kit::*;
4use gpui_kit::*;
5
5
6use super::activity_panel::{ActivityPanel, ActivityPanelEvent};
6use super::activity_panel::{ActivityPanel, ActivityPanelEvent};
7use super::call_mini::render_call_mini;
7use super::call_mini::CallMiniView;
8use super::call_stage::{render_call_overlay, render_stage_overlay};
8use super::call_stage::{render_call_overlay, render_stage_overlay};
9use super::call_view::{CHAT_PANEL_WIDTH, OVERLAY_BELOW as CALL_COLUMN_MIN, render_call_view};
9use super::call_view::{CHAT_PANEL_WIDTH, OVERLAY_BELOW as CALL_COLUMN_MIN, render_call_view};
10use super::conversation::{ConversationView, ReplyToHovered};
10use super::conversation::{ConversationView, ReplyToHovered};
@@ -110,6 +110,7 @@ pub struct AppShell {
110 update: UpdateStatus,
110 update: UpdateStatus,
111 user_input: Arc<UserInput>,
111 user_input: Arc<UserInput>,
112 _subscription: Subscription,
112 _subscription: Subscription,
113 call_mini: Entity<CallMiniView>,
113 _call_media_observation: Subscription,
114 _call_media_observation: Subscription,
114 _panel_subscriptions: [Subscription; 2],
115 _panel_subscriptions: [Subscription; 2],
115 _agent_subscription: Option<Subscription>,
116 _agent_subscription: Option<Subscription>,
@@ -158,7 +159,11 @@ impl AppShell {
158 ) -> Self {
159 ) -> Self {
159 let call_media = cx.new(|_| CallMedia);
160 let call_media = cx.new(|_| CallMedia);
160 state.update(cx, |state, _| state.call_media = Some(call_media.clone()));
161 state.update(cx, |state, _| state.call_media = Some(call_media.clone()));
161 let call_media_observation = cx.observe(&call_media, |_, _, cx| cx.notify());
162 let call_media_observation = cx.observe(&call_media, |this, _, cx| {
163 if this.state.read(cx).viewing_call() {
164 cx.notify();
165 }
166 });
162 let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
167 let activity = cx.new(|cx| ActivityCenter::new(state.clone(), window, cx));
163 let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
168 let activity_panel = cx.new(|cx| ActivityPanel::new(state.clone(), activity.clone(), cx));
164 let saved_panel = cx.new(|cx| SavedPanel::new(state.clone(), cx));
169 let saved_panel = cx.new(|cx| SavedPanel::new(state.clone(), cx));
@@ -201,6 +206,8 @@ impl AppShell {
201 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, saved_panel, cx));
206 let sidebar = cx.new(|cx| SidebarView::new(state.clone(), activity_panel, saved_panel, cx));
202 let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
207 let rail = cx.new(|cx| RailView::new(state.clone(), activity.clone(), sidebar.clone(), cx));
203 let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
208 let conversation = cx.new(|cx| ConversationView::new(state.clone(), window, cx));
209 let timeline = conversation.read(cx).timeline_bounds();
210 let call_mini = cx.new(|cx| CallMiniView::new(state.clone(), timeline, cx));
204 let subscription =
211 let subscription =
205 cx.subscribe_in(&state, window, |this, _, event: &AppEvent, window, cx| {
212 cx.subscribe_in(&state, window, |this, _, event: &AppEvent, window, cx| {
206 if matches!(event, AppEvent::Sidebar | AppEvent::Status) {
213 if matches!(event, AppEvent::Sidebar | AppEvent::Status) {
@@ -270,6 +277,7 @@ impl AppShell {
270 update: UpdateStatus::UpToDate,
277 update: UpdateStatus::UpToDate,
271 user_input,
278 user_input,
272 _subscription: subscription,
279 _subscription: subscription,
280 call_mini,
273 _call_media_observation: call_media_observation,
281 _call_media_observation: call_media_observation,
274 _panel_subscriptions: panel_subscriptions,
282 _panel_subscriptions: panel_subscriptions,
275 _agent_subscription: agent_subscription,
283 _agent_subscription: agent_subscription,
@@ -768,7 +776,11 @@ impl Render for AppShell {
768 view => (view, None),
776 view => (view, None),
769 };
777 };
770 self.sync_window_fullscreen(call_fullscreen, window);
778 self.sync_window_fullscreen(call_fullscreen, window);
771 let call_mini = render_call_mini(&self.state, state);
779 let call_mini = state
780 .call
781 .as_ref()
782 .is_some_and(|call| !call.viewing)
783 .then(|| self.call_mini.clone());
772 let stage_overlay = render_stage_overlay(&self.state, state);
784 let stage_overlay = render_stage_overlay(&self.state, state);
773 let status = render_status_bar(
785 let status = render_status_bar(
774 state,
786 state,