clean up nip29 logging and rework browse panel header

This commit is contained in:
2026-10-07 15:19:02 +07:00
parent e472077941
commit 586fea796d
2 changed files with 79 additions and 100 deletions
+18 -22
View File
@@ -16,7 +16,6 @@ use theme::ActiveTheme;
use ui::avatar::Avatar;
use ui::button::{Button, ButtonVariants};
use ui::dock::{DockArea, DockPlacement, Panel, PanelEvent, PanelHandle};
use ui::indicator::Indicator;
use ui::input::{Input, InputEvent, InputState};
use ui::notification::Notification;
use ui::scroll::Scrollbar;
@@ -214,10 +213,6 @@ impl BrowsePanel {
self.render_card_rows(cards, cx)
}
/// A row holds two group cards side by side.
///
/// The cards are the relative slice of the visible rows, so they pair up
/// in order, two per row.
fn render_card_rows(
&self,
cards: &[GroupCandidate],
@@ -235,8 +230,6 @@ impl BrowsePanel {
.p_2()
.gap_2()
.children(first.map(|card| self.render_card(card, cx)))
// Keep an odd last card in one column: an empty spacer
// takes the second slot so the card cannot stretch.
.child(match second {
Some(card) => self.render_card(card, cx),
None => div().flex_1().into_any_element(),
@@ -339,7 +332,7 @@ impl BrowsePanel {
.text_sm()
.text_color(cx.theme().text_muted)
.text_ellipsis()
.line_clamp(3)
.line_clamp(2)
.map(|this| {
if let Some(about) = about {
this.child(about)
@@ -458,28 +451,31 @@ impl Render for BrowsePanel {
v_flex()
.size_full()
.child(
h_flex()
.gap_2()
.px_2()
v_flex()
.h_32()
.flex_shrink_0()
.child(Input::new(&self.input).cleanable(true).flex_1())
.items_center()
.justify_center()
.bg(cx.theme().surface_background)
.child(
Button::new("browse-go")
.label("Go")
.primary()
.on_click(cx.listener(|this, _event, window, cx| {
this.browse(window, cx);
})),
)
.when(self.loading || (discover && discovering), |this| {
this.child(Indicator::new().small().color(cx.theme().icon_accent))
}),
h_flex()
.w_full()
.max_w_56()
.gap_1()
.child(Input::new(&self.input).cleanable(true).flex_1())
.child(Button::new("browse-go").label("Go").primary().on_click(
cx.listener(|this, _event, window, cx| {
this.browse(window, cx);
}),
)),
),
)
.child(
div()
.flex_1()
.min_h_0()
.relative()
.px_2()
.child(body)
.child(Scrollbar::vertical(&self.scroll_handle)),
)