hotfix
This commit is contained in:
parent
4710335750
commit
5430b3d42c
|
@ -2,7 +2,7 @@ use yew::prelude::*;
|
||||||
use yewdux::prelude::*;
|
use yewdux::prelude::*;
|
||||||
|
|
||||||
use wasm_bindgen::JsCast;
|
use wasm_bindgen::JsCast;
|
||||||
use web_sys::{EventTarget, FormData, HtmlDialogElement, HtmlFormElement};
|
use web_sys::{EventTarget, FormData, HtmlFormElement};
|
||||||
|
|
||||||
use crate::components::states::MainState;
|
use crate::components::states::MainState;
|
||||||
use crate::data::plate::*;
|
use crate::data::plate::*;
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use regex::Regex;
|
|
||||||
use serde::{Deserialize, Serialize};
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use wasm_bindgen::JsCast;
|
use wasm_bindgen::JsCast;
|
||||||
|
|
|
@ -8,6 +8,8 @@ use yewdux::prelude::*;
|
||||||
use crate::components::states::{CurrentTransfer, MainState};
|
use crate::components::states::{CurrentTransfer, MainState};
|
||||||
use crate::data::transfer_region::Region;
|
use crate::data::transfer_region::Region;
|
||||||
|
|
||||||
|
type NoParamsCallback = Box<dyn Fn(()) -> ()>;
|
||||||
|
|
||||||
pub fn open_plate_info_callback(
|
pub fn open_plate_info_callback(
|
||||||
plate_menu_id: UseStateHandle<Option<Uuid>>,
|
plate_menu_id: UseStateHandle<Option<Uuid>>,
|
||||||
) -> Callback<MouseEvent> {
|
) -> Callback<MouseEvent> {
|
||||||
|
@ -24,8 +26,8 @@ pub fn open_plate_info_callback(
|
||||||
|
|
||||||
pub fn plate_info_close_callback(
|
pub fn plate_info_close_callback(
|
||||||
plate_menu_id: UseStateHandle<Option<Uuid>>,
|
plate_menu_id: UseStateHandle<Option<Uuid>>,
|
||||||
) -> Callback<MouseEvent> {
|
) -> NoParamsCallback {
|
||||||
Callback::from(move |_| {
|
Box::new(move |_| {
|
||||||
plate_menu_id.set(None);
|
plate_menu_id.set(None);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -33,8 +35,8 @@ pub fn plate_info_close_callback(
|
||||||
pub fn plate_info_delete_callback(
|
pub fn plate_info_delete_callback(
|
||||||
main_dispatch: Dispatch<MainState>,
|
main_dispatch: Dispatch<MainState>,
|
||||||
plate_menu_id: UseStateHandle<Option<Uuid>>,
|
plate_menu_id: UseStateHandle<Option<Uuid>>,
|
||||||
) -> Callback<MouseEvent> {
|
) -> NoParamsCallback {
|
||||||
Callback::from(move |_| {
|
Box::new(move |_| {
|
||||||
if let Some(id) = *plate_menu_id {
|
if let Some(id) = *plate_menu_id {
|
||||||
main_dispatch.reduce_mut(|state| {
|
main_dispatch.reduce_mut(|state| {
|
||||||
state.del_plate(id);
|
state.del_plate(id);
|
||||||
|
@ -87,7 +89,7 @@ pub fn destination_plate_select_callback(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn transfer_select_callback(main_state: Rc<MainState>) -> Callback<MouseEvent> {
|
pub fn transfer_select_callback(main_state: Rc<MainState>, main_dispatch: Dispatch<MainState>, ct_dispatch: Dispatch<CurrentTransfer>) -> Callback<MouseEvent> {
|
||||||
Callback::from(move |e: MouseEvent| {
|
Callback::from(move |e: MouseEvent| {
|
||||||
let target: Option<EventTarget> = e.target();
|
let target: Option<EventTarget> = e.target();
|
||||||
let li = target.and_then(|t| t.dyn_into::<HtmlElement>().ok());
|
let li = target.and_then(|t| t.dyn_into::<HtmlElement>().ok());
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
use yewdux::prelude::*;
|
use yewdux::prelude::*;
|
||||||
|
|
||||||
use wasm_bindgen::JsCast;
|
use web_sys::HtmlDialogElement;
|
||||||
use web_sys::{EventTarget, FormData, HtmlDialogElement, HtmlFormElement};
|
|
||||||
|
|
||||||
use crate::components::states::MainState;
|
use crate::components::states::MainState;
|
||||||
use crate::data::plate::*;
|
|
||||||
use crate::data::plate_instances::PlateInstance;
|
use crate::data::plate_instances::PlateInstance;
|
||||||
|
|
||||||
use crate::components::callbacks::new_plate_dialog_callbacks;
|
use crate::components::callbacks::new_plate_dialog_callbacks;
|
||||||
|
|
|
@ -3,14 +3,11 @@
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
|
||||||
use wasm_bindgen::JsCast;
|
|
||||||
use web_sys::{EventTarget, HtmlInputElement};
|
|
||||||
use yew::prelude::*;
|
use yew::prelude::*;
|
||||||
use yewdux::prelude::*;
|
use yewdux::prelude::*;
|
||||||
|
|
||||||
use crate::components::callbacks::transfer_menu_callbacks;
|
use crate::components::callbacks::transfer_menu_callbacks;
|
||||||
use crate::data::{transfer::Transfer, transfer_region::Region};
|
use crate::data::transfer_region::Region;
|
||||||
|
|
||||||
use super::states::{CurrentTransfer, MainState};
|
use super::states::{CurrentTransfer, MainState};
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,9 @@ pub fn Tree(props: &TreeProps) -> Html {
|
||||||
|
|
||||||
let transfer_select_callback = {
|
let transfer_select_callback = {
|
||||||
let main_state = main_state.clone();
|
let main_state = main_state.clone();
|
||||||
tree_callbacks::transfer_select_callback(main_state)
|
let main_dispatch = main_dispatch.clone();
|
||||||
|
let ct_dispatch = ct_dispatch.clone();
|
||||||
|
tree_callbacks::transfer_select_callback(main_state, main_dispatch, ct_dispatch)
|
||||||
};
|
};
|
||||||
|
|
||||||
let source_plates = main_state
|
let source_plates = main_state
|
||||||
|
|
Loading…
Reference in New Issue