.
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m42s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 5m42s
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m42s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 5m42s
This commit is contained in:
@@ -121,6 +121,8 @@ impl ChatRegistry {
|
|||||||
// Track unwrapping progress
|
// Track unwrapping progress
|
||||||
this.tracking(cx);
|
this.tracking(cx);
|
||||||
}
|
}
|
||||||
|
// Get chat rooms from the database on every identity change
|
||||||
|
this.get_rooms(cx);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -158,11 +158,19 @@ impl RenderOnce for RoomListItem {
|
|||||||
.child(name),
|
.child(name),
|
||||||
)
|
)
|
||||||
.child(
|
.child(
|
||||||
div()
|
h_flex()
|
||||||
|
.gap_1p5()
|
||||||
.flex_shrink_0()
|
.flex_shrink_0()
|
||||||
.text_xs()
|
.text_xs()
|
||||||
.text_color(cx.theme().text_placeholder)
|
.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))
|
.hover(|this| this.bg(cx.theme().elevated_surface_background))
|
||||||
|
|||||||
@@ -523,24 +523,20 @@ impl Sidebar {
|
|||||||
_window: &Window,
|
_window: &Window,
|
||||||
cx: &Context<Self>,
|
cx: &Context<Self>,
|
||||||
) -> Vec<impl IntoElement> {
|
) -> Vec<impl IntoElement> {
|
||||||
let chat = ChatRegistry::global(cx);
|
// Get rooms from search results first
|
||||||
|
let rooms = match self.search_results.read(cx).as_ref() {
|
||||||
// Get all rooms from search results or chat registry
|
|
||||||
let all_rooms = match self.search_results.read(cx).as_ref() {
|
|
||||||
Some(results) => results,
|
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
|
rooms
|
||||||
let Some(visible_rooms) = all_rooms.get(range.clone()) else {
|
.get(range.clone())
|
||||||
return range
|
.into_iter()
|
||||||
.into_iter()
|
.flatten()
|
||||||
.map(|ix| RoomListItem::new(ix).into_any_element())
|
|
||||||
.collect();
|
|
||||||
};
|
|
||||||
|
|
||||||
visible_rooms
|
|
||||||
.iter()
|
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.map(|(ix, item)| {
|
.map(|(ix, item)| {
|
||||||
let this = item.read(cx);
|
let this = item.read(cx);
|
||||||
|
|||||||
Reference in New Issue
Block a user