From 7d904ccdfaa51978d99ef6010818c8e8b4893d3a Mon Sep 17 00:00:00 2001 From: objz Date: Tue, 28 Jul 2026 19:59:20 +0200 Subject: [PATCH] fix(tui): simplify dependency cleanup dialog --- src/tui/tests/snapshots.rs | 9 ++++--- src/tui/widgets/popups/confirm.rs | 44 +++++++++++++------------------ 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/tui/tests/snapshots.rs b/src/tui/tests/snapshots.rs index 5f7b7dd..0bc3dd5 100644 --- a/src/tui/tests/snapshots.rs +++ b/src/tui/tests/snapshots.rs @@ -37,7 +37,7 @@ fn instance_delete_confirmation_renders_the_complete_frame() { } #[test] -fn orphan_dependency_confirmation_wraps_its_complete_message() { +fn orphan_dependency_confirmation_renders_simple_list() { let mut ui = UiHarness::new(); crate::tui::widgets::popups::confirm::set_pending_orphan_dependencies(vec![ "mods/sodium-fabric-0.9.1+mc26.2.jar".into(), @@ -47,8 +47,11 @@ fn orphan_dependency_confirmation_wraps_its_complete_message() { ui.draw(); let screen = ui.screen(); - assert!(screen.contains("needs these libraries anymore"), "{screen}"); - assert!(screen.contains('▣'), "{screen}"); + assert!( + !screen.contains("needs these libraries anymore"), + "{screen}" + ); + assert!(screen.contains('•'), "{screen}"); assert!( screen.contains("sodium-fabric-0.9.1+mc26.2.jar"), "{screen}" diff --git a/src/tui/widgets/popups/confirm.rs b/src/tui/widgets/popups/confirm.rs index 46f2206..1370fb9 100644 --- a/src/tui/widgets/popups/confirm.rs +++ b/src/tui/widgets/popups/confirm.rs @@ -47,7 +47,7 @@ pub enum ConfirmTarget { impl ConfirmTarget { fn title(&self) -> String { match self { - Self::OrphanDependencies { .. } => " ◇ Clean up libraries ".to_owned(), + Self::OrphanDependencies { .. } => " Remove unused libraries ".to_owned(), _ => format!(" Delete '{}' ", self.name()), } } @@ -63,10 +63,10 @@ impl ConfirmTarget { } ConfirmTarget::Content { dependents, .. } if !dependents.is_empty() => { format!( - "Still required by installed mods:\n\n{}\n\n! Deleting this library may break those mods.", + "Still required by installed mods:\n{}\n! Deleting this library may break those mods.", dependents .iter() - .map(|name| format!(" ▣ {name}")) + .map(|name| format!("• {name}")) .collect::>() .join("\n") ) @@ -74,21 +74,18 @@ impl ConfirmTarget { ConfirmTarget::Content { .. } => { "This will permanently remove the selected item".to_owned() } - ConfirmTarget::OrphanDependencies { paths } => { - format!( - "No installed mod needs these libraries anymore.\n\n{}", - paths - .iter() - .map(|path| format!( - " ▣ {}", - path.file_name() - .and_then(|name| name.to_str()) - .unwrap_or("library") - )) - .collect::>() - .join("\n") - ) - } + ConfirmTarget::OrphanDependencies { paths } => paths + .iter() + .map(|path| { + format!( + "• {}", + path.file_name() + .and_then(|name| name.to_str()) + .unwrap_or("library") + ) + }) + .collect::>() + .join("\n"), } } @@ -204,7 +201,7 @@ impl Widget for ConfirmPopup { let text_dim = theme.text_dim(); let error = theme.error(); let body = self.body; - let styled_list = body.contains("▣ "); + let styled_list = body.contains("• "); let popup = PopupFrame { title, border_color, @@ -215,13 +212,10 @@ impl Widget for ConfirmPopup { let lines = body .lines() .map(|line| { - if let Some(value) = line.trim_start().strip_prefix("▣ ") { + if let Some(value) = line.strip_prefix("• ") { Line::from(vec![ - Span::styled(" ▣ ", Style::default().fg(accent)), - Span::styled( - value.to_owned(), - Style::default().fg(text).add_modifier(Modifier::BOLD), - ), + Span::styled("• ", Style::default().fg(accent)), + Span::styled(value.to_owned(), Style::default().fg(text)), ]) } else if line.starts_with('!') { Line::styled(line.to_owned(), Style::default().fg(error))