From 0d5bc286f75e7b84c382698e5a387820aa53b694 Mon Sep 17 00:00:00 2001 From: reya Date: Tue, 27 Jan 2026 15:40:36 +0700 Subject: [PATCH] . --- crates/chat/src/lib.rs | 2 ++ crates/coop/src/sidebar/list_item.rs | 12 ++++++++++-- crates/coop/src/sidebar/mod.rs | 26 +++++++++++--------------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/crates/chat/src/lib.rs b/crates/chat/src/lib.rs index 16989a5..31bcd8e 100644 --- a/crates/chat/src/lib.rs +++ b/crates/chat/src/lib.rs @@ -121,6 +121,8 @@ impl ChatRegistry { // Track unwrapping progress this.tracking(cx); } + // Get chat rooms from the database on every identity change + this.get_rooms(cx); }), ); diff --git a/crates/coop/src/sidebar/list_item.rs b/crates/coop/src/sidebar/list_item.rs index b68369a..e5d3946 100644 --- a/crates/coop/src/sidebar/list_item.rs +++ b/crates/coop/src/sidebar/list_item.rs @@ -158,11 +158,19 @@ impl RenderOnce for RoomListItem { .child(name), ) .child( - div() + h_flex() + .gap_1p5() .flex_shrink_0() .text_xs() .text_color(cx.theme().text_placeholder) - .child(created_at), + .child(created_at) + .when_some(self.kind, |this, kind| { + this.when(kind == RoomKind::Request, |this| { + this.child( + div().size_1().rounded_full().bg(cx.theme().icon_accent), + ) + }) + }), ), ) .hover(|this| this.bg(cx.theme().elevated_surface_background)) diff --git a/crates/coop/src/sidebar/mod.rs b/crates/coop/src/sidebar/mod.rs index d5d6f14..a369a84 100644 --- a/crates/coop/src/sidebar/mod.rs +++ b/crates/coop/src/sidebar/mod.rs @@ -523,24 +523,20 @@ impl Sidebar { _window: &Window, cx: &Context, ) -> Vec { - let chat = ChatRegistry::global(cx); - - // Get all rooms from search results or chat registry - let all_rooms = match self.search_results.read(cx).as_ref() { + // Get rooms from search results first + let rooms = match self.search_results.read(cx).as_ref() { Some(results) => results, - None => chat.read(cx).rooms(cx), + None => { + // Fallback to chat registry if there are no search results + let chat = ChatRegistry::global(cx); + chat.read(cx).rooms(cx) + } }; - // If no rooms are found, return a placeholder element for each index in the range - let Some(visible_rooms) = all_rooms.get(range.clone()) else { - return range - .into_iter() - .map(|ix| RoomListItem::new(ix).into_any_element()) - .collect(); - }; - - visible_rooms - .iter() + rooms + .get(range.clone()) + .into_iter() + .flatten() .enumerate() .map(|(ix, item)| { let this = item.read(cx);