chore: update gpui

This commit is contained in:
2025-06-17 08:00:47 +07:00
parent 440f17af18
commit 5f8e886a34
6 changed files with 366 additions and 213 deletions

View File

@@ -360,7 +360,6 @@ impl Render for Compose {
)
.map(|this| {
let contacts = self.contacts.read(cx).clone();
let view = cx.entity();
if contacts.is_empty() {
this.child(
@@ -389,15 +388,15 @@ impl Render for Compose {
} else {
this.child(
uniform_list(
view,
"contacts",
contacts.len(),
move |this, range, _window, cx| {
cx.processor(move |this, range, _window, cx| {
let selected = this.selected.read(cx);
let mut items = Vec::new();
for ix in range {
let item = contacts.get(ix).unwrap().clone();
let profile: &Profile = contacts.get(ix).unwrap();
let item = profile.clone();
let is_select = selected.contains(&item.public_key());
items.push(
@@ -446,7 +445,7 @@ impl Render for Compose {
}
items
},
}),
)
.pb_4()
.min_h(px(280.)),

View File

@@ -226,45 +226,48 @@ impl Relays {
_window: &mut Window,
cx: &mut Context<Self>,
) -> UniformList {
let view = cx.entity();
let total = relays.len();
uniform_list(view, "relays", total, move |_, range, _window, cx| {
let mut items = Vec::new();
uniform_list(
"relays",
total,
cx.processor(move |_, range, _window, cx| {
let mut items = Vec::new();
for ix in range {
let item = relays.get(ix).unwrap().clone().to_string();
for ix in range {
let item = relays.get(ix).map(|i: &RelayUrl| i.to_string()).unwrap();
items.push(
div().group("").w_full().h_9().py_0p5().child(
div()
.px_2()
.h_full()
.w_full()
.flex()
.items_center()
.justify_between()
.rounded(cx.theme().radius)
.bg(cx.theme().elevated_surface_background)
.text_xs()
.child(item)
.child(
Button::new("remove_{ix}")
.icon(IconName::Close)
.xsmall()
.ghost()
.invisible()
.group_hover("", |this| this.visible())
.on_click(cx.listener(move |this, _, window, cx| {
this.remove(ix, window, cx)
})),
),
),
)
}
items.push(
div().group("").w_full().h_9().py_0p5().child(
div()
.px_2()
.h_full()
.w_full()
.flex()
.items_center()
.justify_between()
.rounded(cx.theme().radius)
.bg(cx.theme().elevated_surface_background)
.text_xs()
.child(item)
.child(
Button::new("remove_{ix}")
.icon(IconName::Close)
.xsmall()
.ghost()
.invisible()
.group_hover("", |this| this.visible())
.on_click(cx.listener(move |this, _, window, cx| {
this.remove(ix, window, cx)
})),
),
),
)
}
items
})
items
}),
)
.w_full()
.min_h(px(MIN_HEIGHT))
}

View File

@@ -410,7 +410,7 @@ impl Sidebar {
})
}
fn render_uniform_item(
fn list_items(
&self,
rooms: &[Entity<Room>],
range: Range<usize>,
@@ -634,12 +634,11 @@ impl Render for Sidebar {
})
.child(
uniform_list(
cx.entity(),
"rooms",
rooms.len(),
move |this, range, _window, cx| {
this.render_uniform_item(&rooms, range, cx)
},
cx.processor(move |this, range, _window, cx| {
this.list_items(&rooms, range, cx)
}),
)
.h_full(),
),