Skip to content

Commit fbbee13

Browse files
ui pass
Co-Authored-By: Danilo <[email protected]>
1 parent dd5b969 commit fbbee13

File tree

1 file changed

+42
-27
lines changed

1 file changed

+42
-27
lines changed

crates/settings_ui/src/settings_ui.rs

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,46 +2690,61 @@ impl SettingsWindow {
26902690
}
26912691
Banner::new()
26922692
.severity(Severity::Warning)
2693-
.child(Label::new(label).size(LabelSize::Large))
2694-
.child(Label::new(error).size(LabelSize::Small).color(Color::Muted))
2693+
.child(
2694+
v_flex()
2695+
.my_0p5()
2696+
.gap_0p5()
2697+
.child(Label::new(label))
2698+
.child(Label::new(error).size(LabelSize::Small).color(Color::Muted)),
2699+
)
26952700
.action_slot(
2696-
Button::new("fix-in-json", "Fix in settings.json")
2697-
.tab_index(0_isize)
2698-
.style(ButtonStyle::OutlinedGhost)
2699-
.on_click(cx.listener(|this, _, _, cx| {
2700-
this.open_current_settings_file(cx);
2701-
})),
2701+
div().pr_1().child(
2702+
Button::new("fix-in-json", "Fix in settings.json")
2703+
.tab_index(0_isize)
2704+
.style(ButtonStyle::Tinted(ui::TintColor::Warning))
2705+
.on_click(cx.listener(|this, _, _, cx| {
2706+
this.open_current_settings_file(cx);
2707+
})),
2708+
),
27022709
)
27032710
}
27042711
let parse_error = error.parse_error();
27052712
let parse_failed = parse_error.is_some();
27062713
warning_banner = v_flex()
2714+
.gap_2()
27072715
.pb_4()
27082716
.when_some(parse_error, |this, err| {
2709-
this.child(
2710-
banner("Your Settings File Is In An Invalid State. Setting Values May Be Incorrect, And Changes May Be Lost", err, &mut self.shown_errors, cx)
2711-
)
2717+
this.child(banner(
2718+
"Failed to load your settings. Some values may be incorrect and changes may be lost.",
2719+
err,
2720+
&mut self.shown_errors,
2721+
cx,
2722+
))
27122723
})
2713-
.map(|this| {
2714-
match &error.migration_status {
2715-
settings::MigrationStatus::Succeeded => {
2716-
this.child(
2717-
banner("Your Settings File Is Out Of Date, And Needs To Be Updated", "It May Be Possible To Automatically Migrate Your Settings File".to_string(), &mut self.shown_errors, cx)
2718-
)
2719-
},
2720-
settings::MigrationStatus::Failed { error: err } if !parse_failed => {
2721-
this.child(
2722-
banner("Your Settings File Is Out Of Date, Automatic Migration Failed", err, &mut self.shown_errors, cx)
2723-
)
2724-
}
2725-
_ => this
2726-
}
2724+
.map(|this| match &error.migration_status {
2725+
settings::MigrationStatus::Succeeded => this.child(banner(
2726+
"Your settings are out of date, and need to be updated.",
2727+
match &self.current_file {
2728+
SettingsUiFile::User => "They can be automatically migrated to the latest version.",
2729+
SettingsUiFile::Server(_) | SettingsUiFile::Project(_) => "They must be manually migrated to the latest version."
2730+
}.to_string(),
2731+
&mut self.shown_errors,
2732+
cx,
2733+
)),
2734+
settings::MigrationStatus::Failed { error: err } if !parse_failed => this
2735+
.child(banner(
2736+
"Your settings file is out of date, automatic migration failed",
2737+
err.clone(),
2738+
&mut self.shown_errors,
2739+
cx,
2740+
)),
2741+
_ => this,
27272742
})
27282743
.into_any_element()
27292744
}
27302745

27312746
return v_flex()
2732-
.id("Settings-ui-page")
2747+
.id("settings-ui-page")
27332748
.on_action(cx.listener(|this, _: &menu::SelectNext, window, cx| {
27342749
if !sub_page_stack().is_empty() {
27352750
window.focus_next();
@@ -2800,8 +2815,8 @@ impl SettingsWindow {
28002815
.pt_6()
28012816
.px_8()
28022817
.bg(cx.theme().colors().editor_background)
2803-
.child(warning_banner)
28042818
.child(page_header)
2819+
.child(warning_banner)
28052820
.child(
28062821
div()
28072822
.size_full()

0 commit comments

Comments
 (0)