use crate::bridge_engine::{Bid, BiddingResult, Player}; use crate::components::{BiddingBox, BiddingTable}; use yew::prelude::*; #[derive(Debug)] pub enum Msg { Bid(Bid), } pub struct Bidding { bidding: BiddingResult, } #[derive(PartialEq, Properties)] pub struct BiddingProperties { pub dealer: Player, } impl Component for Bidding { type Message = Msg; type Properties = BiddingProperties; fn create(ctx: &Context) -> Self { Self { bidding: BiddingResult::new(ctx.props().dealer), } } fn update(&mut self, _ctx: &Context, msg: Self::Message) -> bool { match msg { Msg::Bid(bid) => { self.bidding = self.bidding.bidding().clone().bid(bid).unwrap(); true } } } fn view(&self, ctx: &Context) -> Html { html! { <>

{ "Bidding table" }

{ "Bidding box" }

} } }