From 507a81f25dc6e38df91dce2eed63a8b7d282184f Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Thu, 22 Sep 2022 20:26:26 -0400 Subject: Add component to show tricks played --- webapp/src/components/game.rs | 5 ++--- webapp/src/components/tricks_played.rs | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 webapp/src/components/tricks_played.rs (limited to 'webapp/src/components') diff --git a/webapp/src/components/game.rs b/webapp/src/components/game.rs index 91b3022..b42f912 100644 --- a/webapp/src/components/game.rs +++ b/webapp/src/components/game.rs @@ -2,7 +2,7 @@ use crate::bridge_engine::{self, Contract, Player, DealInPlay, DealInPlayResult} use crate::card; use crate::card::Deal; use crate::card::Suit; -use crate::components::{Bidding, Hand, ShowBid, TrickInPlay}; +use crate::components::{Bidding, Hand, ShowBid, TrickInPlay, TricksPlayed}; use log::{error, info}; use yew::prelude::*; @@ -115,7 +115,7 @@ pub fn game() -> Html { } => { html! { <> -

{ "Time to play" }

+ } @@ -129,7 +129,6 @@ pub fn game() -> Html { if let GameState::Play { contract, bidding, .. } = &*state { } -

{ format!("Phase: {:?}", &*state) }

diff --git a/webapp/src/components/tricks_played.rs b/webapp/src/components/tricks_played.rs new file mode 100644 index 0000000..352a030 --- /dev/null +++ b/webapp/src/components/tricks_played.rs @@ -0,0 +1,16 @@ +use yew::prelude::*; +use crate::bridge_engine::Trick; + +#[function_component(TricksPlayed)] +pub fn tricks_played(props: &TricksPlayedProperties) -> Html { + html! { + <> +

{ format!("{} tricks played", props.tricks.len()) }

+ + } +} + +#[derive(PartialEq, Properties, Clone)] +pub struct TricksPlayedProperties { + pub tricks: Vec, +} -- cgit v1.2.3