update
This commit is contained in:
@@ -344,6 +344,14 @@ impl Sidebar {
|
||||
),
|
||||
),
|
||||
})
|
||||
.child(
|
||||
div()
|
||||
.px_4()
|
||||
.text_xs()
|
||||
.font_semibold()
|
||||
.text_color(cx.theme().text_placeholder)
|
||||
.child(active_tab.list_title()),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.min_h_0()
|
||||
@@ -510,44 +518,21 @@ impl Sidebar {
|
||||
match tab {
|
||||
SidebarTab::Inbox => {
|
||||
let chat = ChatRegistry::global(cx);
|
||||
let rooms = chat.read(cx).rooms(&RoomKind::Ongoing, cx);
|
||||
|
||||
let mut rows = vec![SidebarRow::Section {
|
||||
label: "Chats".into(),
|
||||
}];
|
||||
|
||||
if rooms.is_empty() {
|
||||
rows.push(SidebarRow::Hint {
|
||||
text: "No conversations yet".into(),
|
||||
});
|
||||
} else {
|
||||
rows.extend(rooms.into_iter().map(|room| SidebarRow::Room { room }));
|
||||
}
|
||||
|
||||
rows
|
||||
chat.read(cx)
|
||||
.rooms(&RoomKind::Ongoing, cx)
|
||||
.into_iter()
|
||||
.map(|room| SidebarRow::Room { room })
|
||||
.collect()
|
||||
}
|
||||
SidebarTab::Communities => {
|
||||
let registry = CommunityRegistry::global(cx);
|
||||
let communities = registry.read(cx).communities();
|
||||
|
||||
let mut rows = vec![SidebarRow::Section {
|
||||
label: "Communities".into(),
|
||||
}];
|
||||
|
||||
if communities.is_empty() {
|
||||
rows.push(SidebarRow::Hint {
|
||||
text: "No communities yet".into(),
|
||||
});
|
||||
} else {
|
||||
rows.extend(
|
||||
communities
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|community| SidebarRow::Community { community }),
|
||||
);
|
||||
}
|
||||
|
||||
rows
|
||||
registry
|
||||
.read(cx)
|
||||
.communities()
|
||||
.iter()
|
||||
.cloned()
|
||||
.map(|community| SidebarRow::Community { community })
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -566,12 +551,6 @@ impl Sidebar {
|
||||
let index = range.start + offset;
|
||||
|
||||
match row {
|
||||
SidebarRow::Section { label } => TreeRow::new(
|
||||
ElementId::NamedInteger("tree-row".into(), index as u64),
|
||||
TreeRowKind::Section,
|
||||
label.clone(),
|
||||
)
|
||||
.into_any_element(),
|
||||
SidebarRow::Room { room } => {
|
||||
let name = room.read(cx).display_name(cx);
|
||||
let picture = room.read(cx).display_image(cx);
|
||||
@@ -634,12 +613,6 @@ impl Sidebar {
|
||||
})
|
||||
.into_any_element()
|
||||
}
|
||||
SidebarRow::Hint { text } => TreeRow::new(
|
||||
ElementId::NamedInteger("tree-row".into(), index as u64),
|
||||
TreeRowKind::Hint,
|
||||
text.clone(),
|
||||
)
|
||||
.into_any_element(),
|
||||
}
|
||||
})
|
||||
.collect()
|
||||
|
||||
Reference in New Issue
Block a user