From 7dacc4517ed53c28f5cc0211449b02cfa8b5d281 Mon Sep 17 00:00:00 2001 From: Aleksandr Bogomiakov Date: Thu, 26 Nov 2026 02:01:24 +0200 Subject: [PATCH] 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. --- crates/tsunagi-ui/src/home.rs | 6 ++--- crates/tsunagi-ui/src/presentation_tests.rs | 30 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/crates/tsunagi-ui/src/home.rs b/crates/tsunagi-ui/src/home.rs index 48aebbf..b1e7d63 100644 --- a/crates/tsunagi-ui/src/home.rs +++ b/crates/tsunagi-ui/src/home.rs @@ -266,9 +266,9 @@ pub fn draw_network_details( fn draw_metadata(ui: &mut egui::Ui, network: &NetworkReport, own_id: &str) { egui::Grid::new(ui.id().with("metadata")) .num_columns(2) - .max_col_width((ui.available_width() - 30.).max(24.)) - .min_col_width(18.) - .spacing([6.0, 3.0]) + .min_col_width(0.) + .max_col_width(ui.available_width()) + .spacing([3.0, 3.0]) .show(ui, |ui| { widgets::field(ui, icon::TAG, "", "Network name"); format::copy_field(ui, &network.name, &network.name); diff --git a/crates/tsunagi-ui/src/presentation_tests.rs b/crates/tsunagi-ui/src/presentation_tests.rs index 2698654..3dcd427 100644 --- a/crates/tsunagi-ui/src/presentation_tests.rs +++ b/crates/tsunagi-ui/src/presentation_tests.rs @@ -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)]); let (empty, baseline) = draw(&network, 0.4, vec![]); 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; let (one, h) = draw(&network, 0.5, vec![]); assert!(label(&one, "1 exit user").is_some() && label(&one, "peer-00").is_some());