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