refactor(ui): cleaner setup wizard and dashboard card visuals
- setup.rs: remove raw prefix/expected path labels from install view; hide URL input when official installer is pre-filled (show green tick instead), revealing an override field only when needed - gui.rs: drop raw exe path from scan result rows; add per-state colour to status indicator (green=running, blue=installed, grey=not installed) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+12
-11
@@ -775,13 +775,17 @@ fn launcher_card<'a>(
|
||||
scan_results: Option<&'a Vec<(String, String)>>,
|
||||
scan_busy: bool,
|
||||
) -> Element<'a, Message> {
|
||||
let status_label = if running {
|
||||
"● Running"
|
||||
let status_color = if running {
|
||||
Color::from_rgb(0.4, 0.9, 0.4)
|
||||
} else if installed {
|
||||
"○ Installed"
|
||||
Color::from_rgb(0.55, 0.75, 1.0)
|
||||
} else {
|
||||
"· Not installed"
|
||||
Color::from_rgb(0.5, 0.5, 0.5)
|
||||
};
|
||||
let status_str = if running { "● Running" } else if installed { "○ Installed" } else { "· Not installed" };
|
||||
let status_el: Element<Message> = text(status_str).size(12).style(move |_: &Theme| text::Style {
|
||||
color: Some(status_color),
|
||||
}).into();
|
||||
|
||||
let action: Element<Message> = {
|
||||
let n = l.name.clone();
|
||||
@@ -816,8 +820,8 @@ fn launcher_card<'a>(
|
||||
|
||||
let header = row![
|
||||
text(&l.display).size(15),
|
||||
text(" — ").size(12),
|
||||
text(status_label).size(12),
|
||||
text(" ").size(12),
|
||||
status_el,
|
||||
version_badge,
|
||||
iced::widget::horizontal_space(),
|
||||
action,
|
||||
@@ -867,11 +871,8 @@ fn launcher_card<'a>(
|
||||
rows.push(
|
||||
row![
|
||||
text(" ").size(12),
|
||||
text(format!("⊕ {display}")).size(12).style(|_: &Theme| text::Style {
|
||||
color: Some(Color::from_rgb(0.65, 0.65, 0.65)),
|
||||
}),
|
||||
text(format!(" {exe}")).size(10).style(|_: &Theme| text::Style {
|
||||
color: Some(Color::from_rgb(0.45, 0.45, 0.45)),
|
||||
text(display).size(12).style(|_: &Theme| text::Style {
|
||||
color: Some(Color::from_rgb(0.75, 0.75, 0.75)),
|
||||
}),
|
||||
iced::widget::horizontal_space(),
|
||||
add_btn,
|
||||
|
||||
+28
-19
@@ -424,25 +424,37 @@ fn view_install(state: &State) -> Element<'_, Message> {
|
||||
]
|
||||
.align_y(iced::Alignment::Center);
|
||||
|
||||
let prefix = text(format!("Prefix: {}", launcher.prefix_dir.display())).size(13);
|
||||
let expected = text(format!(
|
||||
"Expected: {}",
|
||||
launcher.full_exe_path().display()
|
||||
))
|
||||
.size(13);
|
||||
let is_official = launcher.installer_url.as_deref()
|
||||
.map(|u| state.source == u)
|
||||
.unwrap_or(false);
|
||||
|
||||
let source_label = if launcher.installer_url.is_some()
|
||||
&& state.source == launcher.installer_url.as_deref().unwrap_or("")
|
||||
{
|
||||
"✓ Official installer detected — or paste a custom URL:"
|
||||
let source_row: Element<Message> = if is_official && !matches!(state.stage, Stage::Idle) {
|
||||
// Already past the confirmation step — don't show the input again
|
||||
text("").into()
|
||||
} else if is_official {
|
||||
// Official URL pre-filled: show read-only info + small "use custom URL" toggle
|
||||
column![
|
||||
text("✓ Using official installer").size(12).style(|_: &Theme| text::Style {
|
||||
color: Some(Color::from_rgb(0.4, 0.85, 0.4)),
|
||||
}),
|
||||
text_input("Or paste a custom URL / local .exe path to override:", &state.source)
|
||||
.on_input(Message::SourceChanged)
|
||||
.padding(6)
|
||||
.size(12),
|
||||
]
|
||||
.spacing(4)
|
||||
.into()
|
||||
} else {
|
||||
"Installer URL or local .exe path:"
|
||||
column![
|
||||
text("Installer URL or local .exe path:").size(12),
|
||||
text_input("https://… or /path/to/installer.exe", &state.source)
|
||||
.on_input(Message::SourceChanged)
|
||||
.padding(8),
|
||||
]
|
||||
.spacing(4)
|
||||
.into()
|
||||
};
|
||||
|
||||
let input = text_input("https://… or /path/to/installer.exe", &state.source)
|
||||
.on_input(Message::SourceChanged)
|
||||
.padding(8);
|
||||
|
||||
let finished = matches!(state.stage, Stage::Finished);
|
||||
let install_success = finished && launcher.full_exe_path().exists();
|
||||
|
||||
@@ -539,10 +551,7 @@ fn view_install(state: &State) -> Element<'_, Message> {
|
||||
|
||||
let mut body = column![
|
||||
header,
|
||||
prefix,
|
||||
expected,
|
||||
text(source_label).size(12),
|
||||
input,
|
||||
source_row,
|
||||
]
|
||||
.spacing(12)
|
||||
.padding(20);
|
||||
|
||||
Reference in New Issue
Block a user