mirror of
https://github.com/storytold/designcraft.git
synced 2026-10-29 20:56:47 -06:00
fix(ui): the status bar's error count opens the Preflight panel
The "N errors ▾" text in the status bar was a plain label. As in
InDesign it is now a menu; its Preflight Panel… entry shows the panel
(`window.panel {panel: "preflight"}`).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 533ba782643314e5841fb8bb58cd3af4bf2dd9ae)
This commit is contained in:
@@ -709,22 +709,21 @@ pub fn status_bar(app: &mut DesignApp, ui: &mut egui::Ui) {
|
||||
4.0,
|
||||
if errors == 0 { Color32::from_rgb(60, 200, 90) } else { Color32::from_rgb(235, 50, 50) },
|
||||
);
|
||||
crate::rtl::label(
|
||||
ui,
|
||||
egui::RichText::new(if errors == 0 {
|
||||
format!("{} ▾", crate::i18n::tr(&app.ui.language, "No errors"))
|
||||
} else {
|
||||
format!(
|
||||
"{} ▾",
|
||||
crate::i18n::count_label(
|
||||
&app.ui.language,
|
||||
if errors == 1 && app.ui.language != "uk" { "error" } else { "errors" },
|
||||
errors
|
||||
)
|
||||
)
|
||||
})
|
||||
.font(small.clone()),
|
||||
);
|
||||
let count = if errors == 0 {
|
||||
format!("{} ▾", crate::i18n::tr(&app.ui.language, "No errors"))
|
||||
} else {
|
||||
format!(
|
||||
"{} ▾",
|
||||
crate::i18n::count_label(&app.ui.language, if errors == 1 && app.ui.language != "uk" { "error" } else { "errors" }, errors)
|
||||
)
|
||||
};
|
||||
// As in InDesign, the count opens a menu that leads to the Preflight panel.
|
||||
crate::menus::menu_button(ui, egui::RichText::new(count).font(small.clone()), |ui| {
|
||||
if ui.button(crate::i18n::tr(&app.ui.language, "Preflight Panel…")).clicked() {
|
||||
let _ = app.run("window.panel", json!({"panel": "preflight"}));
|
||||
ui.close();
|
||||
}
|
||||
});
|
||||
ui.add_space(12.0);
|
||||
ui.label(egui::RichText::new(&app.ui.status).font(small).color(t.text_dim));
|
||||
});
|
||||
@@ -899,6 +898,22 @@ mod tests {
|
||||
h.get_by_label(label).rect()
|
||||
}
|
||||
|
||||
/// The status bar's preflight count is a menu; its Preflight Panel entry shows the panel.
|
||||
#[test]
|
||||
fn status_bar_error_count_opens_the_preflight_panel() {
|
||||
let mut app = app();
|
||||
app.run("file.new", serde_json::json!({})).unwrap();
|
||||
app.ui.dock_tab = "properties".into();
|
||||
let mut h = test_window::open(app, vec2(1200.0, 700.0));
|
||||
h.get_by_label("No errors ▾").click();
|
||||
h.run_steps(3);
|
||||
h.get_by_label("Preflight Panel…").click();
|
||||
h.run_steps(3);
|
||||
// Preflight is not a dock tab: `window.panel` shows it as its own panel.
|
||||
assert_eq!(h.state().app.ui.open_panel.as_deref(), Some("preflight"));
|
||||
h.get_by_label("Preflight");
|
||||
}
|
||||
|
||||
/// A very long document name made its tab grow past the window, hiding the close button
|
||||
/// and the tabs after it (#603).
|
||||
#[test]
|
||||
|
||||
@@ -162,7 +162,7 @@ pub const UI_COMMANDS: &[(&str, &str, Option<&str>, &str)] = &[
|
||||
"window.panel",
|
||||
"Show Panel",
|
||||
None,
|
||||
"{panel: properties|pages|layers|swatches|paragraphStyles|characterStyles|stroke|character|paragraph|textWrap|links|table}",
|
||||
"{panel: properties|pages|layers|swatches|paragraphStyles|characterStyles|stroke|character|paragraph|textWrap|links|table|preflight}",
|
||||
),
|
||||
("window.floatPanel", "Float Panel", None, "{panel, x?, y?} — the panel in its own movable window"),
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user