wip
This commit is contained in:
@@ -184,7 +184,7 @@ impl RenderOnce for MessageRow {
|
||||
.group("")
|
||||
.relative()
|
||||
.w_full()
|
||||
.py_1()
|
||||
.py_0p5()
|
||||
.when(show_author, |this| this.pt_2())
|
||||
.px_3()
|
||||
.refine_style(&style)
|
||||
@@ -209,7 +209,7 @@ impl RenderOnce for MessageRow {
|
||||
.min_w_0()
|
||||
.flex_initial()
|
||||
.overflow_hidden()
|
||||
.text_sm()
|
||||
.text_size(px(15.))
|
||||
.when(show_author, |this| {
|
||||
this.child(
|
||||
h_flex()
|
||||
|
||||
@@ -19,7 +19,7 @@ pub struct Nav {
|
||||
suffix: Option<AnyElement>,
|
||||
selected: bool,
|
||||
clickable: bool,
|
||||
gap: bool,
|
||||
center_prefix: bool,
|
||||
#[allow(clippy::type_complexity)]
|
||||
on_click: Option<Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>>,
|
||||
}
|
||||
@@ -39,7 +39,7 @@ impl Nav {
|
||||
suffix: None,
|
||||
selected: false,
|
||||
clickable: false,
|
||||
gap: true,
|
||||
center_prefix: false,
|
||||
on_click: None,
|
||||
}
|
||||
}
|
||||
@@ -50,9 +50,9 @@ impl Nav {
|
||||
self
|
||||
}
|
||||
|
||||
/// Whether to space the row's contents apart.
|
||||
pub fn gap(mut self, gap: bool) -> Self {
|
||||
self.gap = gap;
|
||||
/// Whether to center the prefix in the avatar-width column.
|
||||
pub fn center_prefix(mut self, center: bool) -> Self {
|
||||
self.center_prefix = center;
|
||||
self
|
||||
}
|
||||
|
||||
@@ -115,14 +115,13 @@ impl RenderOnce for Nav {
|
||||
.h_8()
|
||||
.w_full()
|
||||
.px_2()
|
||||
.when(self.gap, |this| this.gap_2())
|
||||
.gap_2()
|
||||
.rounded(cx.theme().radius)
|
||||
.when_some(self.prefix, |this, prefix| {
|
||||
this.child(
|
||||
h_flex()
|
||||
.w_6()
|
||||
.flex_shrink_0()
|
||||
.justify_center()
|
||||
.when(self.center_prefix, |this| this.w_6().justify_center())
|
||||
.child(prefix),
|
||||
)
|
||||
})
|
||||
|
||||
@@ -244,13 +244,13 @@ impl GreeterPanel {
|
||||
.seed(seed)
|
||||
.small(),
|
||||
)
|
||||
.child(div().min_w_0().truncate().text_xs().child(name))
|
||||
.child(div().min_w_0().truncate().text_sm().child(name))
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.truncate()
|
||||
.text_xs()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.italic()
|
||||
.child(preview),
|
||||
@@ -363,13 +363,13 @@ impl GreeterPanel {
|
||||
.seed(seed)
|
||||
.small(),
|
||||
)
|
||||
.child(div().min_w_0().truncate().text_xs().child(name))
|
||||
.child(div().min_w_0().truncate().text_sm().child(name))
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.truncate()
|
||||
.text_xs()
|
||||
.text_sm()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.italic()
|
||||
.child(preview),
|
||||
@@ -458,13 +458,9 @@ impl GreeterPanel {
|
||||
.w_full()
|
||||
.child(
|
||||
Nav::new("browse-group")
|
||||
.prefix(
|
||||
Icon::new(IconName::Compass)
|
||||
.small()
|
||||
.text_color(cx.theme().muted_foreground),
|
||||
)
|
||||
.prefix(Icon::new(IconName::Compass))
|
||||
.label("Browse Public Groups")
|
||||
.text_xs()
|
||||
.text_sm()
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
let panel = browse::init(this.dock.clone(), window, cx);
|
||||
add_panel_to(
|
||||
@@ -478,9 +474,9 @@ impl GreeterPanel {
|
||||
)
|
||||
.child(
|
||||
Nav::new("browse-posts")
|
||||
.prefix(Icon::new(IconName::Link).small())
|
||||
.prefix(Icon::new(IconName::Link))
|
||||
.label("Browse Nostr via Jumble")
|
||||
.text_xs()
|
||||
.text_sm()
|
||||
.on_click(|_, _, cx| {
|
||||
cx.open_url(JUMBLE_URL);
|
||||
}),
|
||||
|
||||
@@ -131,6 +131,7 @@ impl Sidebar {
|
||||
.child(
|
||||
Nav::new("sidebar-settings")
|
||||
.prefix(Icon::new(IconName::Settings).small())
|
||||
.center_prefix(true)
|
||||
.label("Settings")
|
||||
.text_sm()
|
||||
.on_click(|_, window, cx| {
|
||||
|
||||
@@ -193,9 +193,8 @@ impl Sidebar {
|
||||
.h_20()
|
||||
.w_full()
|
||||
.px_4()
|
||||
.border_t_1()
|
||||
.border_color(cx.theme().border)
|
||||
.bg(cx.theme().background)
|
||||
.bg(cx.theme().sidebar)
|
||||
.text_color(cx.theme().sidebar_foreground)
|
||||
.child(
|
||||
Button::new("create-chat")
|
||||
.label(if self.selected_contacts.len() > 1 {
|
||||
@@ -213,7 +212,9 @@ impl Sidebar {
|
||||
.gap_1()
|
||||
.text_xs()
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.child("Selected")
|
||||
.text_center()
|
||||
.justify_center()
|
||||
.child("Selected:")
|
||||
.child(
|
||||
div()
|
||||
.font_semibold()
|
||||
|
||||
@@ -44,9 +44,9 @@ impl Sidebar {
|
||||
let create_button = contacts_open && !self.selected_contacts.is_empty();
|
||||
|
||||
let (list_id, title) = if contacts_open {
|
||||
("sidebar-contacts", Some(("Contacts", IconName::Book)))
|
||||
("sidebar-contacts", Some("Contacts"))
|
||||
} else if requests_open {
|
||||
("sidebar-requests", Some(("Requests", IconName::Invite)))
|
||||
("sidebar-requests", Some("Requests"))
|
||||
} else {
|
||||
("sidebar-list", None)
|
||||
};
|
||||
@@ -119,7 +119,6 @@ impl Sidebar {
|
||||
Nav::new("contacts")
|
||||
.prefix(Icon::new(IconName::Book).small())
|
||||
.label("Contacts")
|
||||
.gap(false)
|
||||
.text_sm()
|
||||
.when(contacts_open, |this| this.bg(cx.theme().list_active))
|
||||
.on_click(cx.listener(|this, _event, window, cx| {
|
||||
@@ -127,21 +126,17 @@ impl Sidebar {
|
||||
})),
|
||||
),
|
||||
)
|
||||
.when_some(title, |this, (title, title_icon)| {
|
||||
.when_some(title, |this, title| {
|
||||
this.child(
|
||||
h_flex()
|
||||
.px_4()
|
||||
.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)),
|
||||
),
|
||||
.text_color(cx.theme().muted_foreground)
|
||||
.text_xs()
|
||||
.font_semibold()
|
||||
.child(title),
|
||||
)
|
||||
})
|
||||
.child(
|
||||
|
||||
@@ -292,6 +292,7 @@ impl Render for Sidebar {
|
||||
|
||||
let group = self.group.clone().and_then(|group| group.upgrade());
|
||||
let searching = self.search_open && !self.find_input.read(cx).value().is_empty();
|
||||
let picking_contacts = self.contacts_open && !self.requests_open;
|
||||
|
||||
v_flex()
|
||||
.image_cache(retain_all("sidebar"))
|
||||
@@ -341,7 +342,9 @@ impl Render for Sidebar {
|
||||
_ => this.child(self.render_list(cx)),
|
||||
}),
|
||||
)
|
||||
.when(logged_in, |this| this.child(self.render_footer(cx)))
|
||||
.when(logged_in && !picking_contacts, |this| {
|
||||
this.child(self.render_footer(cx))
|
||||
})
|
||||
.when(loading && logged_in, |this| {
|
||||
this.child(
|
||||
div()
|
||||
|
||||
@@ -99,7 +99,7 @@ impl Sidebar {
|
||||
.map(|(offset, row)| {
|
||||
let index = range.start + offset;
|
||||
|
||||
match row {
|
||||
let element = match row {
|
||||
SidebarRow::Section(section) => {
|
||||
let section = *section;
|
||||
let label = section.label();
|
||||
@@ -394,7 +394,9 @@ impl Sidebar {
|
||||
})
|
||||
.into_any_element()
|
||||
}
|
||||
}
|
||||
};
|
||||
// Keep a small gap between rows so selected rows read as pills.
|
||||
div().pb_0p5().child(element).into_any_element()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user