diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2022-09-06 21:06:04 -0400 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2022-09-06 21:06:15 -0400 |
commit | c19d8d2d475d12b45b85e44682f39aaa70923d74 (patch) | |
tree | fedeff55c02ba9f7a26e1f0807c3c38e2f0771e7 /webapp | |
parent | 397214caf0fe46cb1cd455908a67d36a931e7ec4 (diff) |
Refactor current_bid handling in bidding box
Align with representation used by the engine
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/src/default.css | 3 | ||||
-rw-r--r-- | webapp/src/main.rs | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/webapp/src/default.css b/webapp/src/default.css index e76ca28..7e34b66 100644 --- a/webapp/src/default.css +++ b/webapp/src/default.css @@ -19,7 +19,7 @@ body { .card { min-width: 30px; - min-height: 100px; + min-height: 80px; border: 1px solid #000; transition: 0.1s; font-family: Helvetica, sans-serif; @@ -27,6 +27,7 @@ body { padding: 3px; background-color: #fcfcf0; color: #000; + line-height: 90%; } .card div { diff --git a/webapp/src/main.rs b/webapp/src/main.rs index 846514a..dd69eca 100644 --- a/webapp/src/main.rs +++ b/webapp/src/main.rs @@ -64,7 +64,7 @@ pub fn app() -> Html { <p>{ "Bidding table" }</p> <BiddingTable { bidding } /> <p>{ "Bidding box" }</p> - <BiddingBox lower_limit={"1H".parse::<Raise>().unwrap()} /> + <BiddingBox current_bid={Some("1H".parse::<Raise>().unwrap())} /> <p>{ "North" }</p> <Hand ..(*north).clone() /> <p>{ "West" }</p> @@ -73,6 +73,7 @@ pub fn app() -> Html { <Hand ..(*south).clone() /> <p>{ "East" }</p> <Hand ..(*east).clone() /> + <p>{ "Controls" }</p> <button onclick={shuffle}>{ "Shuffle" }</button> </> } @@ -203,7 +204,7 @@ pub fn bidding_box(props: &BiddingBoxProps) -> Html { let bids: Html = Raise::all_raises() .iter() .map(|bid| { - let mut class = if bid < &props.lower_limit { + let mut class = if Some(*bid) <= props.current_bid { classes!("disabled") } else { classes!("enabled") @@ -229,8 +230,7 @@ pub fn bidding_box(props: &BiddingBoxProps) -> Html { #[derive(PartialEq, Properties, Clone)] pub struct BiddingBoxProps { - #[prop_or("1♣".parse().unwrap())] - lower_limit: Raise, + current_bid: Option<Raise>, } #[cfg(test)] |