use crate::components::game::header::*; use crate::components::game::views::judging::*; use crate::components::game::views::playing::*; use crate::components::websocket::WebSocketContext; use leptos::*; use leptos_use::core::ConnectionReadyState; use lib::*; pub mod cards; pub mod header; pub mod views; #[component] pub fn Game() -> impl IntoView { // Websocket stuff let websocket = expect_context::(); let connected = move || websocket.ready_state.get() == ConnectionReadyState::Open; // Incoming let game_meta = expect_context::>>(); let user_update = expect_context::>>(); // Signals // let (judging, set_judging) = create_signal(false); // Determine judging create_effect(move |_| { user_update.with(move |user_meta| { if let Some(user_meta) = user_meta { if let Some(game_meta) = game_meta() { if user_meta.username == game_meta.czar { set_judging(true); } else { set_judging(false); } } } }) }); view! {

Game

"Disconnected."

}>
// Judging view // // Playing view //
} }