Improve scenario tool feedback and keep draft actions visible

This commit is contained in:
2026-09-06 05:32:34 +03:00
parent b2d713e774
commit c6c07cc3a3
5 changed files with 114 additions and 67 deletions
+38 -22
View File
@@ -1254,10 +1254,16 @@ pub fn view<'a>(app: &'a App, owner: Id, mut out: Column<'a, Message>) -> Elemen
if !pending {
out = out.push(
row![
button("Select / reorder").on_press(Message::ScenarioCanvas(CanvasEvent::Choose(
context,
CanvasTool::Select
))),
button("Select / reorder")
.on_press(Message::ScenarioCanvas(CanvasEvent::Choose(
context,
CanvasTool::Select
)))
.style(if tool == CanvasTool::Select {
style::selected
} else {
style::nav
}),
pick_list(
vec![
MessageStyle::Asynchronous,
@@ -1277,10 +1283,16 @@ pub fn view<'a>(app: &'a App, owner: Id, mut out: Column<'a, Message>) -> Elemen
.text_size(12)
.padding(8)
.width(Fill),
button("Draw message").on_press(Message::ScenarioCanvas(CanvasEvent::Choose(
context,
CanvasTool::Message(style)
))),
button("Draw message")
.on_press(Message::ScenarioCanvas(CanvasEvent::Choose(
context,
CanvasTool::Message(style)
)))
.style(if matches!(tool, CanvasTool::Message(_)) {
style::selected
} else {
style::nav
}),
]
.spacing(6),
);
@@ -1314,7 +1326,7 @@ pub fn view<'a>(app: &'a App, owner: Id, mut out: Column<'a, Message>) -> Elemen
horizontal: scrollable::Scrollbar::default(),
})
.height(if pending {
(app.window_size.height - 500.).clamp(160., 260.)
(app.window_size.height - 660.).clamp(110., 190.)
} else {
(app.window_size.height - 410.).clamp(180., 340.)
}),
@@ -1524,24 +1536,28 @@ pub fn view<'a>(app: &'a App, owner: Id, mut out: Column<'a, Message>) -> Elemen
if let Err(error) = &readiness {
form = form.push(label(error.clone()));
}
form = form.push(
row![
button("Create")
.padding(9)
.on_press_maybe(readiness.is_ok().then_some(event(Event::Submit))),
action("Cancel", event(Event::Cancel))
]
.spacing(7),
);
let footer = row![
button("Create")
.padding(9)
.on_press_maybe(readiness.is_ok().then_some(event(Event::Submit))),
action("Cancel", event(Event::Cancel))
]
.spacing(7);
out = out.push(
container(scrollable(form).height((app.window_size.height - 470.).clamp(190., 280.)))
.padding(14)
.style(style::card),
container(
column![
scrollable(form).height((app.window_size.height - 650.).clamp(110., 240.)),
footer
]
.spacing(9),
)
.padding(14)
.style(style::card),
);
}
if lines(p, owner).is_empty() && p.elements[&owner].steps().is_none_or(Vec::is_empty) {
out = out.push(container(label("Add lifelines for the participating work or actors, then create messages between them.")).padding(16).width(Fill).style(style::card));
} else {
} else if !pending {
out = sequence_rows(p, owner, out);
}
super::scenario_scroll::observe(context, ScrollArea::Page, scrollable(out.padding(24)))