cards/client/src/components/game.rs

32 lines
861 B
Rust
Raw Normal View History

2024-08-09 02:57:27 -04:00
use crate::components::websocket::WebSocketContext;
2024-08-09 01:21:04 -04:00
use leptos::*;
2024-08-09 02:57:27 -04:00
use lib::*;
2024-08-09 01:21:04 -04:00
#[component]
pub fn Game() -> impl IntoView {
2024-08-09 02:57:27 -04:00
let websocket = expect_context::<WebSocketContext>();
let game_meta = expect_context::<ReadSignal<Option<GameMeta>>>();
let (game_name, set_game_name) = create_signal("".to_string());
let (game_host, set_game_host) = create_signal("".to_string());
create_effect(move |_| {
if let Some(game) = game_meta() {
set_game_name(game.name.clone())
set_game_name(game.host.clone())
}
});
2024-08-09 01:21:04 -04:00
view! {
<div class="p-1">
<h2 class="text-2xl">Game</h2>
2024-08-09 02:57:27 -04:00
<p>Name: {move || game_name}</p>
2024-08-09 01:21:04 -04:00
<p>Host:</p>
<p>Players:</p>
<p>Czar:</p>
<p>Black Card:</p>
<p>Your Cards:</p>
</div>
}
}