From 0c51c8d22ab1e12a881955c1337e977ed247ea21 Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Thu, 5 Nov 2026 07:29:28 +0100 Subject: [PATCH] Clarify missing column warnings with actionable cards --- crates/rundown-converter/src/gui/review.rs | 70 ++++++++++++++++------ docs/rundown-converter.md | 2 + 2 files changed, 54 insertions(+), 18 deletions(-) diff --git a/crates/rundown-converter/src/gui/review.rs b/crates/rundown-converter/src/gui/review.rs index 7fa11c8..f64b98a 100644 --- a/crates/rundown-converter/src/gui/review.rs +++ b/crates/rundown-converter/src/gui/review.rs @@ -1502,13 +1502,16 @@ impl App { } else { format!("{affected} {column_word} · ") }; - ui.colored_label( - PREVIEW_AMBER, - format!( - "! Column mapping needs attention · {affected_summary}{} issues", - errors.len() - ), - ); + if !errors.iter().all(|error| error.code == "MISSING_COLUMN") { + let issue_word = if errors.len() == 1 { "issue" } else { "issues" }; + ui.colored_label( + PREVIEW_AMBER, + format!( + "! Column mapping needs attention · {affected_summary}{} {issue_word}", + errors.len() + ), + ); + } for ((role, candidates), error) in ambiguous { let code = error.code.as_str(); let message = error.message.as_str(); @@ -1564,24 +1567,39 @@ impl App { .map(|error| { if error.code == "MISSING_COLUMN" { if error.message.starts_with("Cannot infer title;") { - return ("Title column missing", "Choose Title for the appropriate column below."); + return ("Title column missing", "Choose Title in the role dropdown of the appropriate column below."); } if error.message.starts_with("Cannot infer start;") { - return ("Start column missing", "Choose Start or Start–end for the appropriate column below."); + return ("Start column missing", "Choose Start or Start–end in the role dropdown of the appropriate column below."); } } column_issue_advice(&error.code, duration) }) .collect(); + if missing { + egui::Frame::new() + .fill(PREVIEW_AMBER.gamma_multiply(0.08)) + .inner_margin(10.0) + .corner_radius(5.0) + .show(ui, |ui| { + ui.set_min_width(ui.available_width()); + for (reason, action) in &advice { + ui.label( + RichText::new(format!("! {reason}")) + .color(PREVIEW_AMBER) + .strong(), + ); + ui.indent(("missing_column_action", reason), |ui| { + ui.label(RichText::new("Next step").strong()); + ui.label(*action); + }); + } + }); + ui.add_space(6.0); + continue; + } let title = column.map_or_else( - || { - if missing { - "Missing column" - } else { - "Sheet / settings" - } - .into() - }, + || "Sheet / settings".into(), |c| format!("Column {}", column_name(c)), ); ui.horizontal_wrapped(|ui| { @@ -2965,9 +2983,25 @@ mod tests { assert!( labels .iter() - .any(|(text, _)| text.starts_with("Title column missing.")) + .any(|(text, _)| text == "! Title column missing") ); assert!(labels.iter().any(|(text, _)| text == "Suggested: Start")); + let heading = labels + .iter() + .find(|(text, _)| text == "! Title column missing") + .unwrap() + .1; + let action = labels + .iter() + .find(|(text, _)| text == "Next step") + .unwrap() + .1; + assert!(action.left() > heading.left()); + assert!(action.top() >= heading.bottom()); + assert!(!labels.iter().any( + |(text, _)| text.starts_with("! Column mapping needs attention") + || text.starts_with("Missing column ·") + )); assert!(!labels.iter().any(|(text, _)| matches!( text.as_str(), "Needs attention" | "Review column…" | "Affected cells" diff --git a/docs/rundown-converter.md b/docs/rundown-converter.md index 527d1d7..774c3d2 100644 --- a/docs/rundown-converter.md +++ b/docs/rundown-converter.md @@ -125,6 +125,8 @@ visually distinct from labels and ordinary actions; the active tab uses the stro and source location. This grouping changes only the GUI summary, not CLI logs. Missing required columns are reported at sheet level: no unrelated column is highlighted, and existing role suggestions remain available. + A missing-column warning uses an amber card with an indented **Next step** + explaining which role to choose, without duplicate summary headings. When detection is blocked, recognised headers still provide hints; these do not replace validation. Expand **Detection evidence** for full inference and validation details; hover the **Columns** tab for a compact