Compare commits

...

2 Commits

Author SHA1 Message Date
Emilia Allison 62d870521e
First callback move
Gitea Scan/plate-tool/pipeline/head There was a failure building this commit Details
2024-01-12 21:44:10 -05:00
Emilia Allison e2ef9fa84d
Increment version number in cargo.lock
why wasn't this done already?
2024-01-12 21:43:50 -05:00
5 changed files with 26 additions and 14 deletions

2
Cargo.lock generated
View File

@ -558,7 +558,7 @@ dependencies = [
[[package]]
name = "plate-tool"
version = "0.1.0"
version = "0.2.0"
dependencies = [
"csv",
"getrandom",

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

View File

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