From 127639355fc4e3e601f42d2b23714f673cf6b557 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Mon, 21 Aug 2023 15:11:08 -0700 Subject: [PATCH] Remove load button --- dyesub-tool/src/main.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/dyesub-tool/src/main.rs b/dyesub-tool/src/main.rs index f4fd3b1..54a9c5d 100644 --- a/dyesub-tool/src/main.rs +++ b/dyesub-tool/src/main.rs @@ -104,8 +104,7 @@ fn KeyboardFromFile( let file_input = create_node_ref::(cx); let (file, set_file) = create_signal(cx, Option::::None); let (result_message, set_result_message) = create_signal(cx, Option::::None); - let on_submit = move |e: SubmitEvent| { - e.prevent_default(); + let on_submit = move || { spawn_local(async move { match read_kle_from_file(&file).await { Ok(keyboard) => { @@ -119,34 +118,35 @@ fn KeyboardFromFile( })); set_keyboard(Some(keyboard)); } - Err(err) => set_result_message(Some(ResultMessageData { - message: view! { cx, - { - err.to_string() + Err(err) => { + set_result_message(Some(ResultMessageData { + message: view! { cx, + { + err.to_string() + } } - } - .into_view(cx), - title: >::into(err).to_string(), - colorway: Colorway::Bad, - })), + .into_view(cx), + title: >::into(err).to_string(), + colorway: Colorway::Bad, + })); + file_input().unwrap().set_value(""); + }, } }); }; view! { cx,

"Load KLE JSON from file"

-
+ - - -
} }