Compare commits

..

No commits in common. "e836c4264a9dd5dd381404e41493177027a5e7ff" and "020f7740d3a62a91d054b625dbc3f86bad4f758b" have entirely different histories.

6 changed files with 17 additions and 13 deletions

View File

@ -2,7 +2,7 @@ use yew::prelude::*;
use yewdux::prelude::*;
use wasm_bindgen::JsCast;
use web_sys::{EventTarget, FormData, HtmlFormElement};
use web_sys::{EventTarget, FormData, HtmlDialogElement, HtmlFormElement};
use crate::components::states::MainState;
use crate::data::plate::*;

View File

@ -1,3 +1,6 @@
use lazy_static::lazy_static;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::rc::Rc;
use uuid::Uuid;
use wasm_bindgen::JsCast;

View File

@ -8,8 +8,6 @@ use yewdux::prelude::*;
use crate::components::states::{CurrentTransfer, MainState};
use crate::data::transfer_region::Region;
type NoParamsCallback = Box<dyn Fn(()) -> ()>;
pub fn open_plate_info_callback(
plate_menu_id: UseStateHandle<Option<Uuid>>,
) -> Callback<MouseEvent> {
@ -26,8 +24,8 @@ pub fn open_plate_info_callback(
pub fn plate_info_close_callback(
plate_menu_id: UseStateHandle<Option<Uuid>>,
) -> NoParamsCallback {
Box::new(move |_| {
) -> Callback<MouseEvent> {
Callback::from(move |_| {
plate_menu_id.set(None);
})
}
@ -35,8 +33,8 @@ pub fn plate_info_close_callback(
pub fn plate_info_delete_callback(
main_dispatch: Dispatch<MainState>,
plate_menu_id: UseStateHandle<Option<Uuid>>,
) -> NoParamsCallback {
Box::new(move |_| {
) -> Callback<MouseEvent> {
Callback::from(move |_| {
if let Some(id) = *plate_menu_id {
main_dispatch.reduce_mut(|state| {
state.del_plate(id);
@ -89,7 +87,7 @@ pub fn destination_plate_select_callback(
})
}
pub fn transfer_select_callback(main_state: Rc<MainState>, main_dispatch: Dispatch<MainState>, ct_dispatch: Dispatch<CurrentTransfer>) -> Callback<MouseEvent> {
pub fn transfer_select_callback(main_state: Rc<MainState>) -> Callback<MouseEvent> {
Callback::from(move |e: MouseEvent| {
let target: Option<EventTarget> = e.target();
let li = target.and_then(|t| t.dyn_into::<HtmlElement>().ok());

View File

@ -1,9 +1,11 @@
use yew::prelude::*;
use yewdux::prelude::*;
use web_sys::HtmlDialogElement;
use wasm_bindgen::JsCast;
use web_sys::{EventTarget, FormData, HtmlDialogElement, HtmlFormElement};
use crate::components::states::MainState;
use crate::data::plate::*;
use crate::data::plate_instances::PlateInstance;
use crate::components::callbacks::new_plate_dialog_callbacks;

View File

@ -3,11 +3,14 @@
use lazy_static::lazy_static;
use regex::Regex;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use wasm_bindgen::JsCast;
use web_sys::{EventTarget, HtmlInputElement};
use yew::prelude::*;
use yewdux::prelude::*;
use crate::components::callbacks::transfer_menu_callbacks;
use crate::data::transfer_region::Region;
use crate::data::{transfer::Transfer, transfer_region::Region};
use super::states::{CurrentTransfer, MainState};

View File

@ -46,9 +46,7 @@ pub fn Tree(props: &TreeProps) -> Html {
let transfer_select_callback = {
let main_state = main_state.clone();
let main_dispatch = main_dispatch.clone();
let ct_dispatch = ct_dispatch.clone();
tree_callbacks::transfer_select_callback(main_state, main_dispatch, ct_dispatch)
tree_callbacks::transfer_select_callback(main_state)
};
let source_plates = main_state