use yew::prelude::*;
use crate::bridge_engine::{Bid, Bidding, Player};
use crate::components::bid_css_class;
#[function_component(BiddingTable)]
pub fn bidding_table(props: &BiddingTableProps) -> Html {
    let bid = |bid: &Bid| match bid.as_raise() {
        None => html!{ 
{ bid }
 },
        Some(raise) => html!{
            
        },
    };
    let bids: Html = props
        .bidding
        .bids
        .iter()
        .map(|b| { bid(b) })
        .collect();
    let padding : Html = padding(props.bidding.dealer);
    html! {
        
          
          
          
          
          { padding }
          { bids }
        
    }
}
fn padding(dealer: Player) -> Html {
    let mut padding : Vec = vec![];
    let mut player = Player::West;
    while player != dealer {
        padding.push(html! {  });
        player = player.next();
    }
    padding.into_iter().collect()
}
#[derive(PartialEq, Properties, Clone)]
pub struct BiddingTableProps {
    pub bidding: Bidding,
}