Tighten icon spacing in network cards

Let the metadata grid size its icon column to the glyphs and give the
values the remaining width. Use a three-point gutter for all five
fields on both desktop and Android.

Check the rendered gap on each row at desktop and phone widths. All 45
shared UI tests passed on macOS, along with formatting and workspace
Clippy. The full workspace suite passed on the preceding release commit.
This commit is contained in:
Aleksandr Bogomiakov committed 2026-11-26 02:01:24 +02:00
1 parent 43894612ee
commit 7dacc4517e
2 files changed
+33 -3

No files matched your search

+3 -3
View File
@@ -266,9 +266,9 @@ pub fn draw_network_details(
fn draw_metadata(ui: &mut egui::Ui, network: &NetworkReport, own_id: &str) { fn draw_metadata(ui: &mut egui::Ui, network: &NetworkReport, own_id: &str) {
egui::Grid::new(ui.id().with("metadata")) egui::Grid::new(ui.id().with("metadata"))
.num_columns(2) .num_columns(2)
.max_col_width((ui.available_width() - 30.).max(24.)) .min_col_width(0.)
.min_col_width(18.) .max_col_width(ui.available_width())
.spacing([6.0, 3.0]) .spacing([3.0, 3.0])
.show(ui, |ui| { .show(ui, |ui| {
widgets::field(ui, icon::TAG, "", "Network name"); widgets::field(ui, icon::TAG, "", "Network name");
format::copy_field(ui, &network.name, &network.name); format::copy_field(ui, &network.name, &network.name);
@@ -506,6 +506,36 @@ fn exit_users_scroll_a_row_inside_the_existing_card_and_disappear_on_deselection
draw(&network, 0.3, vec![press(title, false)]); draw(&network, 0.3, vec![press(title, false)]);
let (empty, baseline) = draw(&network, 0.4, vec![]); let (empty, baseline) = draw(&network, 0.4, vec![]);
assert!(label(&empty, "peer-00").is_none()); assert!(label(&empty, "peer-00").is_none());
let address_icon = if os == egui::os::OperatingSystem::Android {
icon::DEVICE_MOBILE
} else {
icon::LAPTOP
};
for (glyph, value) in [
(icon::TAG, "office"),
(icon::HASH, "lab"),
(icon::TREE_STRUCTURE, "10.2.3.0/24"),
(address_icon, "10.2.3.4"),
(icon::DEVICES, "12 online · 12 known"),
] {
let marker = label(&empty, glyph).unwrap();
let cell = empty
.shapes
.iter()
.filter_map(|s| match &s.shape {
egui::Shape::Text(t) if t.galley.text() == value => {
Some(t.visual_bounding_rect())
}
_ => None,
})
.find(|cell| (cell.center().y - marker.center().y).abs() < 5.)
.unwrap();
let gap = cell.left() - marker.right();
assert!(
(1.0..=7.0).contains(&gap),
"{value} has a {gap} pt icon gap"
);
}
network.peers[0].uses_our_exit = true; network.peers[0].uses_our_exit = true;
let (one, h) = draw(&network, 0.5, vec![]); let (one, h) = draw(&network, 0.5, vec![]);
assert!(label(&one, "1 exit user").is_some() && label(&one, "peer-00").is_some()); assert!(label(&one, "1 exit user").is_some() && label(&one, "peer-00").is_some());