UI: grey ribbon entries, search results and Solve that miss what they need

The ribbon buttons, drop-down rows, command search and the title bar's Solve read
Session::availability: greyed, with what is missing (and where to get it) in the tooltip.
Starting such an entry opens no form; the status bar names what is missing. ui.toolbar
reports each entry's `enabled` and `unavailable`, ui.inspect the Solve button's.

Fixes #220

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-14 18:43:29 -04:00
1 parent e0d5adba23
commit 8409101483
7 files changed
+114 -37

No files matched your search

+9 -9
View File
@@ -195,8 +195,11 @@ pub fn app_bar(app: &mut ModelApp, ui: &mut egui::Ui) {
}
// Solve: the one prominent action, a filled button with its label.
let solve = lay.solve;
let resp = ui.interact(solve, ui.id().with("fc_solve"), Sense::click());
let can = !app.session.model.steps().is_empty() && !busy;
// Solve runs `solve.run`: greyed while the model misses what it needs, every missing
// piece listed in the tooltip.
let missing = app.unavailable("solve.run");
let can = missing.is_none() && !busy;
let resp = ui.interact(solve, ui.id().with("fc_solve"), if can { Sense::click() } else { Sense::hover() });
let fill = if resp.hovered() && can {
t.accent.gamma_multiply(1.15)
} else if can {
@@ -221,13 +224,10 @@ pub fn app_bar(app: &mut ModelApp, ui: &mut egui::Ui) {
Color32::WHITE,
);
}
let tip = if app.session.model.steps().is_empty() {
"Solve: the model has no steps yet (try Help › Samples)"
} else {
"Solve every step and show the results"
};
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, true, "Solve"));
if resp.on_hover_text(tip).clicked() {
let head = if missing.is_some() { "Solve: not ready yet (or try Help › Samples)" } else { "Solve every step and show the results" };
let tip = fieldcraft_engine::requirement::Unavailable::tip(head, missing.as_ref());
resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, can, "Solve"));
if resp.on_hover_text(tip).clicked() && can {
clicked = Some(Quick::Solve);
}
anchors.push((Quick::Solve, solve));