From ba0b0ec1104deab7a8367cefbe399c3acaf33476 Mon Sep 17 00:00:00 2001 From: pepen Date: Wed, 14 Oct 2026 03:16:00 +0200 Subject: [PATCH] fix(ui): the status bar's error count opens the Preflight panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 533ba782643314e5841fb8bb58cd3af4bf2dd9ae) --- crates/ui-egui/src/chrome.rs | 47 ++++++++++++++++++++++++------------ crates/ui-egui/src/menus.rs | 2 +- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 439fb3932..5855b3f9a 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -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] diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index a35261d59..229ced6eb 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -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"), (