BlueGit

ict rusty-teams

feat(chat): Chat and Shared tabs in every chat header like Teams

- Chat / Shared tabs for all chats, Recap stays for meeting chats with a recording
- Shared in chats lists files and links from messages, without the library switch
- composer and proposal card hidden while Shared is open

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

metis Daniel Däschle · pushed by metis

Authored 2026-11-07 · 3 weeks ago

Hash
1b66b1e7d37017a7782eb84aeec0aa17bef790c8
Parent
8675fa6c
5 files changed +58 −20
crates/app-ui-kit/src/channel_tabs.rs +28 −9
@@ -27,6 +27,7 @@ pub const POSTS_LABEL: &str = "Posts";
27 27 pub const SHARED_LABEL: &str = "Shared";
28 28 pub const CHAT_LABEL: &str = "Chat";
29 29 pub const RECAP_LABEL: &str = "Recap";
30 pub const CHAT_SHARED_TAB_TAG: &str = "shell/islands/main/chat-shared-tab";
30 31
31 32 #[derive(Debug, Clone, Copy, PartialEq, Eq)]
32 33 pub enum ChannelPane {
@@ -213,9 +214,10 @@ pub fn render_tab_bar(
213 214 .into_any_element()
214 215 }
215 216
216 pub fn render_meeting_bar(pane: ChannelPane, select: SelectPane) -> AnyElement {
217 /// Chat, Shared and, for meeting chats with a recording, Recap.
218 pub fn render_chat_bar(pane: ChannelPane, with_recap: bool, select: SelectPane) -> AnyElement {
217 219 let chat = tab_label(
218 "meeting-tab-chat".into(),
220 "chat-tab-chat".into(),
219 221 CHAT_LABEL,
220 222 pane == ChannelPane::Posts,
221 223 false,
@@ -224,15 +226,32 @@ pub fn render_meeting_bar(pane: ChannelPane, select: SelectPane) -> AnyElement {
224 226 move |_, cx| select(ChannelPane::Posts, cx)
225 227 },
226 228 );
227 let recap = tab_label(
228 "meeting-tab-recap".into(),
229 RECAP_LABEL,
230 pane == ChannelPane::Recap,
229 let shared = tab_label(
230 "chat-tab-shared".into(),
231 SHARED_LABEL,
232 pane == ChannelPane::Shared,
231 233 false,
232 move |_, cx| select(ChannelPane::Recap, cx),
234 {
235 let select = select.clone();
236 move |_, cx| select(ChannelPane::Shared, cx)
237 },
233 238 )
234 .debug_selector(|| "shell/islands/main/recap-tab".into());
235 header_tab_row().child(chat).child(recap).into_any_element()
239 .debug_selector(|| CHAT_SHARED_TAB_TAG.into());
240 let recap = with_recap.then(|| {
241 tab_label(
242 "chat-tab-recap".into(),
243 RECAP_LABEL,
244 pane == ChannelPane::Recap,
245 false,
246 move |_, cx| select(ChannelPane::Recap, cx),
247 )
248 .debug_selector(|| "shell/islands/main/recap-tab".into())
249 });
250 header_tab_row()
251 .child(chat)
252 .child(shared)
253 .children(recap)
254 .into_any_element()
236 255 }
237 256
238 257 #[cfg(test)]
@@ -27,6 +27,7 @@ pub const POSTS_LABEL: &str = "Posts";
27pub const SHARED_LABEL: &str = "Shared";
27pub const SHARED_LABEL: &str = "Shared";
28pub const CHAT_LABEL: &str = "Chat";
28pub const CHAT_LABEL: &str = "Chat";
29pub const RECAP_LABEL: &str = "Recap";
29pub const RECAP_LABEL: &str = "Recap";
30pub const CHAT_SHARED_TAB_TAG: &str = "shell/islands/main/chat-shared-tab";
30
31
31#[derive(Debug, Clone, Copy, PartialEq, Eq)]
32#[derive(Debug, Clone, Copy, PartialEq, Eq)]
32pub enum ChannelPane {
33pub enum ChannelPane {
@@ -213,9 +214,10 @@ pub fn render_tab_bar(
213 .into_any_element()
214 .into_any_element()
214}
215}
215
216
216pub fn render_meeting_bar(pane: ChannelPane, select: SelectPane) -> AnyElement {
217/// Chat, Shared and, for meeting chats with a recording, Recap.
218pub fn render_chat_bar(pane: ChannelPane, with_recap: bool, select: SelectPane) -> AnyElement {
217 let chat = tab_label(
219 let chat = tab_label(
218 "meeting-tab-chat".into(),
220 "chat-tab-chat".into(),
219 CHAT_LABEL,
221 CHAT_LABEL,
220 pane == ChannelPane::Posts,
222 pane == ChannelPane::Posts,
221 false,
223 false,
@@ -224,15 +226,32 @@ pub fn render_meeting_bar(pane: ChannelPane, select: SelectPane) -> AnyElement {
224 move |_, cx| select(ChannelPane::Posts, cx)
226 move |_, cx| select(ChannelPane::Posts, cx)
225 },
227 },
226 );
228 );
227 let recap = tab_label(
229 let shared = tab_label(
228 "meeting-tab-recap".into(),
230 "chat-tab-shared".into(),
229 RECAP_LABEL,
231 SHARED_LABEL,
230 pane == ChannelPane::Recap,
232 pane == ChannelPane::Shared,
231 false,
233 false,
232 move |_, cx| select(ChannelPane::Recap, cx),
234 {
235 let select = select.clone();
236 move |_, cx| select(ChannelPane::Shared, cx)
237 },
233 )
238 )
234 .debug_selector(|| "shell/islands/main/recap-tab".into());
239 .debug_selector(|| CHAT_SHARED_TAB_TAG.into());
235 header_tab_row().child(chat).child(recap).into_any_element()
240 let recap = with_recap.then(|| {
241 tab_label(
242 "chat-tab-recap".into(),
243 RECAP_LABEL,
244 pane == ChannelPane::Recap,
245 false,
246 move |_, cx| select(ChannelPane::Recap, cx),
247 )
248 .debug_selector(|| "shell/islands/main/recap-tab".into())
249 });
250 header_tab_row()
251 .child(chat)
252 .child(shared)
253 .children(recap)
254 .into_any_element()
236}
255}
237
256
238#[cfg(test)]
257#[cfg(test)]
crates/app/src/views/conversation.rs +2 −2
@@ -3954,7 +3954,7 @@ impl Render for ConversationView {
3954 3954 Some(current) => {
3955 3955 let tab_bar = self
3956 3956 .render_tab_bar(window, cx)
3957 .or_else(|| self.render_meeting_tab_bar(cx));
3957 .or_else(|| self.render_chat_tab_bar(cx));
3958 3958 let (inline_tabs, tabs_row) = match tab_bar {
3959 3959 Some(tabs) if self.tabs_below_title(window) => (None, Some(tabs)),
3960 3960 tabs => (tabs, None),
@@ -4058,7 +4058,7 @@ impl Render for ConversationView {
4058 4058 )
4059 4059 .children(self.render_draft_error(cx).map(|error| runway(error, comfy)))
4060 4060 .when(
4061 !in_feed && !recap_active,
4061 !in_feed && !recap_active && !self.shared_active(),
4062 4062 |column| match &forward_selection {
4063 4063 Some(snapshot) => {
4064 4064 column.child(runway(self.render_forward_footer(snapshot, cx), comfy))
@@ -3954,7 +3954,7 @@ impl Render for ConversationView {
3954 Some(current) => {
3954 Some(current) => {
3955 let tab_bar = self
3955 let tab_bar = self
3956 .render_tab_bar(window, cx)
3956 .render_tab_bar(window, cx)
3957 .or_else(|| self.render_meeting_tab_bar(cx));
3957 .or_else(|| self.render_chat_tab_bar(cx));
3958 let (inline_tabs, tabs_row) = match tab_bar {
3958 let (inline_tabs, tabs_row) = match tab_bar {
3959 Some(tabs) if self.tabs_below_title(window) => (None, Some(tabs)),
3959 Some(tabs) if self.tabs_below_title(window) => (None, Some(tabs)),
3960 tabs => (tabs, None),
3960 tabs => (tabs, None),
@@ -4058,7 +4058,7 @@ impl Render for ConversationView {
4058 )
4058 )
4059 .children(self.render_draft_error(cx).map(|error| runway(error, comfy)))
4059 .children(self.render_draft_error(cx).map(|error| runway(error, comfy)))
4060 .when(
4060 .when(
4061 !in_feed && !recap_active,
4061 !in_feed && !recap_active && !self.shared_active(),
4062 |column| match &forward_selection {
4062 |column| match &forward_selection {
4063 Some(snapshot) => {
4063 Some(snapshot) => {
4064 column.child(runway(self.render_forward_footer(snapshot, cx), comfy))
4064 column.child(runway(self.render_forward_footer(snapshot, cx), comfy))
crates/app/src/views/conversation/recap.rs +5 −4
@@ -23,7 +23,7 @@ use crate::downloads::{self, DownloadState};
23 23 use crate::notice::short_error;
24 24 use crate::recap::{DELETE_QUESTION, Load, save_name};
25 25 use crate::runtime;
26 use crate::views::channel_tabs::{ChannelPane, render_meeting_bar};
26 use crate::views::channel_tabs::{ChannelPane, render_chat_bar};
27 27 use crate::views::recap_tab::{RecapCommand, RecapDownload, RecapRun, RecapView, render_recap};
28 28 use crate::views::shared_tab::{SharedCommand, SharedRun};
29 29
@@ -356,15 +356,16 @@ impl ConversationView {
356 356 .detach();
357 357 }
358 358
359 pub(super) fn render_meeting_tab_bar(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
360 if self.occurrences().is_empty() || !self.is_meeting_chat(cx) {
359 pub(super) fn render_chat_tab_bar(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
360 if !self.in_chat() {
361 361 return None;
362 362 }
363 let with_recap = !self.occurrences().is_empty() && self.is_meeting_chat(cx);
363 364 let view = cx.weak_entity();
364 365 let select = Rc::new(move |pane, cx: &mut App| {
365 366 view.update(cx, |this, cx| this.select_pane(pane, cx)).ok();
366 367 });
367 Some(render_meeting_bar(self.pane, select))
368 Some(render_chat_bar(self.pane, with_recap, select))
368 369 }
369 370
370 371 pub(super) fn render_recap(&self, cx: &mut Context<Self>) -> AnyElement {
@@ -23,7 +23,7 @@ use crate::downloads::{self, DownloadState};
23use crate::notice::short_error;
23use crate::notice::short_error;
24use crate::recap::{DELETE_QUESTION, Load, save_name};
24use crate::recap::{DELETE_QUESTION, Load, save_name};
25use crate::runtime;
25use crate::runtime;
26use crate::views::channel_tabs::{ChannelPane, render_meeting_bar};
26use crate::views::channel_tabs::{ChannelPane, render_chat_bar};
27use crate::views::recap_tab::{RecapCommand, RecapDownload, RecapRun, RecapView, render_recap};
27use crate::views::recap_tab::{RecapCommand, RecapDownload, RecapRun, RecapView, render_recap};
28use crate::views::shared_tab::{SharedCommand, SharedRun};
28use crate::views::shared_tab::{SharedCommand, SharedRun};
29
29
@@ -356,15 +356,16 @@ impl ConversationView {
356 .detach();
356 .detach();
357 }
357 }
358
358
359 pub(super) fn render_meeting_tab_bar(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
359 pub(super) fn render_chat_tab_bar(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
360 if self.occurrences().is_empty() || !self.is_meeting_chat(cx) {
360 if !self.in_chat() {
361 return None;
361 return None;
362 }
362 }
363 let with_recap = !self.occurrences().is_empty() && self.is_meeting_chat(cx);
363 let view = cx.weak_entity();
364 let view = cx.weak_entity();
364 let select = Rc::new(move |pane, cx: &mut App| {
365 let select = Rc::new(move |pane, cx: &mut App| {
365 view.update(cx, |this, cx| this.select_pane(pane, cx)).ok();
366 view.update(cx, |this, cx| this.select_pane(pane, cx)).ok();
366 });
367 });
367 Some(render_meeting_bar(self.pane, select))
368 Some(render_chat_bar(self.pane, with_recap, select))
368 }
369 }
369
370
370 pub(super) fn render_recap(&self, cx: &mut Context<Self>) -> AnyElement {
371 pub(super) fn render_recap(&self, cx: &mut Context<Self>) -> AnyElement {
crates/app/src/views/conversation/shared.rs +13 −2
@@ -67,7 +67,15 @@ impl ConversationView {
67 67 }
68 68
69 69 pub(super) fn shared_active(&self) -> bool {
70 self.pane == ChannelPane::Shared && self.in_feed()
70 self.pane == ChannelPane::Shared && (self.in_feed() || self.in_chat())
71 }
72
73 pub(super) fn in_chat(&self) -> bool {
74 !self.draft_active
75 && self
76 .current
77 .as_ref()
78 .is_some_and(|current| matches!(current.selection, Selection::Chat(_)))
71 79 }
72 80
73 81 pub(super) fn reset_channel_tabs(&mut self, cx: &mut Context<Self>) {
@@ -185,7 +193,9 @@ impl ConversationView {
185 193 self.pane = pane;
186 194 if pane == ChannelPane::Shared {
187 195 self.refresh_shared_items(cx);
188 if self.shared.path.is_none() {
196 if self.in_chat() {
197 self.shared.scope = SharedScope::Messages;
198 } else if self.shared.path.is_none() {
189 199 self.load_library(cx);
190 200 }
191 201 }
@@ -282,6 +292,7 @@ impl ConversationView {
282 292 items: &self.shared.items,
283 293 filter: self.shared.filter,
284 294 download_states: self.item_download_states(),
295 has_library: !self.in_chat(),
285 296 },
286 297 &run,
287 298 ),
@@ -67,7 +67,15 @@ impl ConversationView {
67 }
67 }
68
68
69 pub(super) fn shared_active(&self) -> bool {
69 pub(super) fn shared_active(&self) -> bool {
70 self.pane == ChannelPane::Shared && self.in_feed()
70 self.pane == ChannelPane::Shared && (self.in_feed() || self.in_chat())
71 }
72
73 pub(super) fn in_chat(&self) -> bool {
74 !self.draft_active
75 && self
76 .current
77 .as_ref()
78 .is_some_and(|current| matches!(current.selection, Selection::Chat(_)))
71 }
79 }
72
80
73 pub(super) fn reset_channel_tabs(&mut self, cx: &mut Context<Self>) {
81 pub(super) fn reset_channel_tabs(&mut self, cx: &mut Context<Self>) {
@@ -185,7 +193,9 @@ impl ConversationView {
185 self.pane = pane;
193 self.pane = pane;
186 if pane == ChannelPane::Shared {
194 if pane == ChannelPane::Shared {
187 self.refresh_shared_items(cx);
195 self.refresh_shared_items(cx);
188 if self.shared.path.is_none() {
196 if self.in_chat() {
197 self.shared.scope = SharedScope::Messages;
198 } else if self.shared.path.is_none() {
189 self.load_library(cx);
199 self.load_library(cx);
190 }
200 }
191 }
201 }
@@ -282,6 +292,7 @@ impl ConversationView {
282 items: &self.shared.items,
292 items: &self.shared.items,
283 filter: self.shared.filter,
293 filter: self.shared.filter,
284 download_states: self.item_download_states(),
294 download_states: self.item_download_states(),
295 has_library: !self.in_chat(),
285 },
296 },
286 &run,
297 &run,
287 ),
298 ),
crates/app/src/views/shared_tab.rs +10 −3
@@ -78,6 +78,7 @@ pub struct MessagesView<'a> {
78 78 pub items: &'a [SharedItem],
79 79 pub filter: MessageFilter,
80 80 pub download_states: Vec<Option<DownloadState>>,
81 pub has_library: bool,
81 82 }
82 83
83 84 pub fn download_label(state: Option<&DownloadState>) -> Option<String> {
@@ -156,7 +157,12 @@ fn tool_button(
156 157 .on_click(move |_, window, cx| run(command, window, cx))
157 158 }
158 159
159 fn header(scope: SharedScope, trailing: Option<AnyElement>, run: &SharedRun) -> Div {
160 fn header(
161 scope: SharedScope,
162 has_library: bool,
163 trailing: Option<AnyElement>,
164 run: &SharedRun,
165 ) -> Div {
160 166 h_flex()
161 167 .w_full()
162 168 .flex_none()
@@ -164,7 +170,7 @@ fn header(scope: SharedScope, trailing: Option<AnyElement>, run: &SharedRun) ->
164 170 .py(px(8.))
165 171 .gap(px(12.))
166 172 .items_center()
167 .child(switch(scope, run))
173 .when(has_library, |row| row.child(switch(scope, run)))
168 174 .children(trailing)
169 175 }
170 176
@@ -484,7 +490,7 @@ pub fn render_library(view: LibraryView, run: &SharedRun) -> AnyElement {
484 490 };
485 491 v_flex()
486 492 .size_full()
487 .child(header(SharedScope::Library, toolbar, run))
493 .child(header(SharedScope::Library, true, toolbar, run))
488 494 .children(view.new_folder.map(new_folder_row))
489 495 .children(view.status.map(|status| {
490 496 div()
@@ -674,6 +680,7 @@ pub fn render_messages(view: MessagesView, run: &SharedRun) -> AnyElement {
674 680 .size_full()
675 681 .child(header(
676 682 SharedScope::Messages,
683 view.has_library,
677 684 Some(chips(view.filter, run)),
678 685 run,
679 686 ))
@@ -78,6 +78,7 @@ pub struct MessagesView<'a> {
78 pub items: &'a [SharedItem],
78 pub items: &'a [SharedItem],
79 pub filter: MessageFilter,
79 pub filter: MessageFilter,
80 pub download_states: Vec<Option<DownloadState>>,
80 pub download_states: Vec<Option<DownloadState>>,
81 pub has_library: bool,
81}
82}
82
83
83pub fn download_label(state: Option<&DownloadState>) -> Option<String> {
84pub fn download_label(state: Option<&DownloadState>) -> Option<String> {
@@ -156,7 +157,12 @@ fn tool_button(
156 .on_click(move |_, window, cx| run(command, window, cx))
157 .on_click(move |_, window, cx| run(command, window, cx))
157}
158}
158
159
159fn header(scope: SharedScope, trailing: Option<AnyElement>, run: &SharedRun) -> Div {
160fn header(
161 scope: SharedScope,
162 has_library: bool,
163 trailing: Option<AnyElement>,
164 run: &SharedRun,
165) -> Div {
160 h_flex()
166 h_flex()
161 .w_full()
167 .w_full()
162 .flex_none()
168 .flex_none()
@@ -164,7 +170,7 @@ fn header(scope: SharedScope, trailing: Option<AnyElement>, run: &SharedRun) ->
164 .py(px(8.))
170 .py(px(8.))
165 .gap(px(12.))
171 .gap(px(12.))
166 .items_center()
172 .items_center()
167 .child(switch(scope, run))
173 .when(has_library, |row| row.child(switch(scope, run)))
168 .children(trailing)
174 .children(trailing)
169}
175}
170
176
@@ -484,7 +490,7 @@ pub fn render_library(view: LibraryView, run: &SharedRun) -> AnyElement {
484 };
490 };
485 v_flex()
491 v_flex()
486 .size_full()
492 .size_full()
487 .child(header(SharedScope::Library, toolbar, run))
493 .child(header(SharedScope::Library, true, toolbar, run))
488 .children(view.new_folder.map(new_folder_row))
494 .children(view.new_folder.map(new_folder_row))
489 .children(view.status.map(|status| {
495 .children(view.status.map(|status| {
490 div()
496 div()
@@ -674,6 +680,7 @@ pub fn render_messages(view: MessagesView, run: &SharedRun) -> AnyElement {
674 .size_full()
680 .size_full()
675 .child(header(
681 .child(header(
676 SharedScope::Messages,
682 SharedScope::Messages,
683 view.has_library,
677 Some(chips(view.filter, run)),
684 Some(chips(view.filter, run)),
678 run,
685 run,
679 ))
686 ))