Recipe edit, we can now delete groups, steps and ingredients

This commit is contained in:
Greg Burri 2024-12-28 22:52:07 +01:00
parent d4962c98ff
commit 5ce3391466
11 changed files with 183 additions and 68 deletions

View file

@ -0,0 +1,30 @@
use futures::{future::FutureExt, pin_mut, select};
use web_sys::{Element, HtmlDialogElement};
use crate::utils::{by_id, SelectExt};
use crate::on_click;
pub async fn show(message: &str) -> bool {
let dialog: HtmlDialogElement = by_id("modal-dialog");
let input_ok: Element = dialog.select(".ok");
let input_cancel: Element = dialog.select(".cancel");
dialog.select::<Element>(".content").set_inner_html(message);
dialog.show_modal().unwrap();
let click_ok = on_click::OnClick::new(&input_ok).fuse();
let click_cancel = on_click::OnClick::new(&input_cancel).fuse();
pin_mut!(click_ok, click_cancel);
let result = select! {
() = click_ok => true,
() = click_cancel => false,
};
dialog.close();
result
}