First callback move
Gitea Scan/plate-tool/pipeline/head There was a failure building this commit Details

This commit is contained in:
Emilia Allison 2024-01-12 21:44:10 -05:00
parent e2ef9fa84d
commit 62d870521e
Signed by: emilia
GPG Key ID: 05D5D1107E5100A1
4 changed files with 25 additions and 13 deletions

View File

@ -0,0 +1,15 @@
use yew::prelude::*;
use yewdux::prelude::*;
use crate::components::states::{CurrentTransfer, MainState};
pub fn toggle_in_transfer_hashes_callback(
main_dispatch: &Dispatch<MainState>,
) -> Callback<web_sys::MouseEvent> {
let main_dispatch = main_dispatch.clone();
Callback::from(move |_| {
main_dispatch.reduce_mut(|state| {
state.preferences.in_transfer_hashes ^= true;
})
})
}

View File

@ -0,0 +1 @@
pub mod main_window_callbacks;

View File

@ -12,17 +12,19 @@ use web_sys::{
use yew::prelude::*; use yew::prelude::*;
use yewdux::prelude::*; use yewdux::prelude::*;
use super::new_plate_dialog::NewPlateDialog; use crate::components::new_plate_dialog::NewPlateDialog;
use super::plates::plate_container::PlateContainer; use crate::components::plates::plate_container::PlateContainer;
use super::states::{CurrentTransfer, MainState}; use crate::components::states::{CurrentTransfer, MainState};
use super::transfer_menu::{letters_to_num, RegionDisplay, TransferMenu}; use crate::components::transfer_menu::{letters_to_num, RegionDisplay, TransferMenu};
use super::tree::Tree; use crate::components::tree::Tree;
use crate::data::csv::state_to_csv; use crate::data::csv::state_to_csv;
use crate::data::plate_instances::PlateInstance; use crate::data::plate_instances::PlateInstance;
use crate::data::transfer::Transfer; use crate::data::transfer::Transfer;
use crate::data::transfer_region::{Region, TransferRegion}; use crate::data::transfer_region::{Region, TransferRegion};
use crate::components::callbacks::main_window_callbacks;
#[function_component] #[function_component]
pub fn MainWindow() -> Html { pub fn MainWindow() -> Html {
let (main_state, main_dispatch) = use_store::<MainState>(); let (main_state, main_dispatch) = use_store::<MainState>();
@ -49,14 +51,7 @@ pub fn MainWindow() -> Html {
}); });
} }
let toggle_in_transfer_hashes_callback = { let toggle_in_transfer_hashes_callback = main_window_callbacks::test(&main_dispatch);
let main_dispatch = main_dispatch.clone();
Callback::from(move |_| {
main_dispatch.reduce_mut(|state| {
state.preferences.in_transfer_hashes ^= true;
})
})
};
let new_plate_dialog_is_open = use_state_eq(|| false); let new_plate_dialog_is_open = use_state_eq(|| false);
let new_plate_dialog_callback = { let new_plate_dialog_callback = {

View File

@ -4,3 +4,4 @@ pub mod plates;
pub mod states; pub mod states;
pub mod transfer_menu; pub mod transfer_menu;
pub mod tree; pub mod tree;
mod callbacks;