|
|
@ -8,6 +8,7 @@ use leptos::{ev::SubmitEvent, html::Input, *};
|
|
|
|
use strum_macros::IntoStaticStr;
|
|
|
|
use strum_macros::IntoStaticStr;
|
|
|
|
use wasm_bindgen::{JsCast, JsValue};
|
|
|
|
use wasm_bindgen::{JsCast, JsValue};
|
|
|
|
use web_sys::File;
|
|
|
|
use web_sys::File;
|
|
|
|
|
|
|
|
use class_list::class_list;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
#[derive(Clone)]
|
|
|
|
struct ResultMessageData {
|
|
|
|
struct ResultMessageData {
|
|
|
@ -17,6 +18,7 @@ struct ResultMessageData {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Default, Clone, Copy, IntoStaticStr)]
|
|
|
|
#[derive(Default, Clone, Copy, IntoStaticStr)]
|
|
|
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
enum Colorway {
|
|
|
|
enum Colorway {
|
|
|
|
#[default]
|
|
|
|
#[default]
|
|
|
|
#[strum(serialize = "plain")]
|
|
|
|
#[strum(serialize = "plain")]
|
|
|
@ -33,17 +35,12 @@ enum Colorway {
|
|
|
|
|
|
|
|
|
|
|
|
#[component]
|
|
|
|
#[component]
|
|
|
|
fn ResultMessage(cx: Scope, message: ReadSignal<Option<ResultMessageData>>) -> impl IntoView {
|
|
|
|
fn ResultMessage(cx: Scope, message: ReadSignal<Option<ResultMessageData>>) -> impl IntoView {
|
|
|
|
view! { cx,
|
|
|
|
move || message().map(|ResultMessageData { title, message, colorway }| view! { cx,
|
|
|
|
<Show when=move || message().is_some() fallback=move |_| {}>
|
|
|
|
<div class=class_list!["box", <Colorway as Into<&str>>::into(colorway)]>
|
|
|
|
<div class=move || {
|
|
|
|
<h3>{title}</h3>
|
|
|
|
let colorway_str: &str = message().unwrap().colorway.into();
|
|
|
|
<p>{message}</p>
|
|
|
|
colorway_str.to_owned() + " box"
|
|
|
|
|
|
|
|
}>
|
|
|
|
|
|
|
|
<h3>{move || message().unwrap().title}</h3>
|
|
|
|
|
|
|
|
<p>{move || message().unwrap().message}</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Show>
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(From, IntoStaticStr)]
|
|
|
|
#[derive(From, IntoStaticStr)]
|
|
|
|