wip
This commit is contained in:
@@ -7,8 +7,7 @@ use gpui::{
|
||||
};
|
||||
use gpui_kit::assets::IconName;
|
||||
use gpui_kit::base::StyledExt as _;
|
||||
use gpui_kit::component::scroll::Scrollbar;
|
||||
use gpui_kit::component::{ActiveTheme, Icon, h_flex, v_flex};
|
||||
use gpui_kit::component::{ActiveTheme, Icon, Sizable, h_flex, v_flex};
|
||||
use nip29::GroupsRegistry;
|
||||
use settings::AppSettings;
|
||||
|
||||
@@ -44,12 +43,15 @@ impl Sidebar {
|
||||
// Whether to show the create button for the contact picker
|
||||
let create_button = contacts_open && !self.selected_contacts.is_empty();
|
||||
|
||||
let (list_id, scroll_handle, list_title) = if contacts_open {
|
||||
("sidebar-contacts", &self.contacts_scroll, Some("Contacts"))
|
||||
let (list_id, title) = if contacts_open {
|
||||
("sidebar-contacts", Some(("Contacts", IconName::Book)))
|
||||
} else if requests_open {
|
||||
("sidebar-requests", &self.requests_scroll, Some("Requests"))
|
||||
(
|
||||
"sidebar-requests",
|
||||
Some(("Requests", IconName::UserRoundPlus)),
|
||||
)
|
||||
} else {
|
||||
("sidebar-list", &self.list_scroll, None)
|
||||
("sidebar-list", None)
|
||||
};
|
||||
|
||||
let request_count = ChatRegistry::global(cx)
|
||||
@@ -61,13 +63,15 @@ impl Sidebar {
|
||||
.flex_1()
|
||||
.min_h_0()
|
||||
.relative()
|
||||
.gap_2()
|
||||
.child(
|
||||
v_flex()
|
||||
.px_2()
|
||||
.gap_1()
|
||||
.items_start()
|
||||
.justify_start()
|
||||
.child(
|
||||
Nav::new("browse")
|
||||
.prefix(Icon::new(IconName::Compass))
|
||||
.prefix(Icon::new(IconName::Compass).small())
|
||||
.label("Browse")
|
||||
.text_sm()
|
||||
.on_click(|_, window, cx| {
|
||||
@@ -76,7 +80,7 @@ impl Sidebar {
|
||||
)
|
||||
.child(
|
||||
Nav::new("reqs")
|
||||
.prefix(Icon::new(IconName::UserRoundPlus))
|
||||
.prefix(Icon::new(IconName::UserRoundPlus).small())
|
||||
.label("Requests")
|
||||
.text_sm()
|
||||
.when(request_count > 0, |this| {
|
||||
@@ -117,7 +121,7 @@ impl Sidebar {
|
||||
)
|
||||
.child(
|
||||
Nav::new("contacts")
|
||||
.prefix(Icon::new(IconName::Book))
|
||||
.prefix(Icon::new(IconName::Book).small())
|
||||
.label("Contacts")
|
||||
.text_sm()
|
||||
.when(contacts_open, |this| this.bg(cx.theme().list_active))
|
||||
@@ -126,33 +130,34 @@ impl Sidebar {
|
||||
})),
|
||||
),
|
||||
)
|
||||
.when_some(list_title, |this, list_title| {
|
||||
.when_some(title, |this, (title, title_icon)| {
|
||||
this.child(
|
||||
div()
|
||||
.px_4()
|
||||
.text_xs()
|
||||
.font_semibold()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child(list_title),
|
||||
h_flex()
|
||||
.h_10()
|
||||
.w_full()
|
||||
.flex_shrink_0()
|
||||
.items_center()
|
||||
.child(
|
||||
h_flex()
|
||||
.px_2()
|
||||
.gap_2()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child(Icon::new(title_icon).small())
|
||||
.child(div().text_xs().font_semibold().child(title)),
|
||||
),
|
||||
)
|
||||
})
|
||||
.child(
|
||||
div()
|
||||
.min_h_0()
|
||||
.flex_1()
|
||||
.child(
|
||||
uniform_list(
|
||||
list_id,
|
||||
rows.len(),
|
||||
cx.processor(move |this, range, _window, cx| {
|
||||
this.render_rows(range, rows.as_slice(), cx)
|
||||
}),
|
||||
)
|
||||
.track_scroll(scroll_handle)
|
||||
.h_full()
|
||||
.px_2(),
|
||||
)
|
||||
.child(Scrollbar::vertical(scroll_handle)),
|
||||
uniform_list(
|
||||
list_id,
|
||||
rows.len(),
|
||||
cx.processor(move |this, range, _window, cx| {
|
||||
this.render_rows(range, rows.as_slice(), cx)
|
||||
}),
|
||||
)
|
||||
.min_h_0()
|
||||
.flex_1()
|
||||
.px_2(),
|
||||
)
|
||||
.when(create_button, |this| {
|
||||
this.child(self.render_create_overlay(cx))
|
||||
|
||||
Reference in New Issue
Block a user