Move enum from yew_components mod to state mod

Preparation for symlinking shared code into the backend project.
This commit is contained in:
Stephen Seo 2022-03-29 14:41:04 +09:00
parent 1c1e02742c
commit e4d4d6e153
2 changed files with 10 additions and 8 deletions

View file

@ -1,5 +1,4 @@
use crate::ai::AIDifficulty; use crate::ai::AIDifficulty;
use crate::yew_components::MainMenuMessage;
use std::cell::Cell; use std::cell::Cell;
use std::fmt::Display; use std::fmt::Display;
use std::rc::Rc; use std::rc::Rc;
@ -288,3 +287,12 @@ impl Default for SharedState {
} }
} }
} }
// This enum moved from yew_components module so that this module would have no
// dependencies on the yew_components module
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum MainMenuMessage {
SinglePlayer(Turn, AIDifficulty),
LocalMultiplayer,
NetworkedMultiplayer(Turn),
}

View file

@ -5,7 +5,7 @@ use crate::html_helper::{
append_to_info_text, element_append_class, element_remove_class, get_window_document, append_to_info_text, element_append_class, element_remove_class, get_window_document,
}; };
use crate::random_helper::get_seeded_random; use crate::random_helper::get_seeded_random;
use crate::state::{BoardState, GameState, SharedState, Turn}; use crate::state::{BoardState, GameState, MainMenuMessage, SharedState, Turn};
use std::cell::Cell; use std::cell::Cell;
use std::rc::Rc; use std::rc::Rc;
@ -18,12 +18,6 @@ use yew::prelude::*;
pub struct MainMenu {} pub struct MainMenu {}
pub enum MainMenuMessage {
SinglePlayer(Turn, AIDifficulty),
LocalMultiplayer,
NetworkedMultiplayer(Turn),
}
impl Component for MainMenu { impl Component for MainMenu {
type Message = MainMenuMessage; type Message = MainMenuMessage;
type Properties = (); type Properties = ();