summaryrefslogtreecommitdiff
path: root/webapp/src/main.rs
diff options
context:
space:
mode:
authorKjetil Orbekk <kj@orbekk.com>2022-09-06 21:06:04 -0400
committerKjetil Orbekk <kj@orbekk.com>2022-09-06 21:06:15 -0400
commitc19d8d2d475d12b45b85e44682f39aaa70923d74 (patch)
treefedeff55c02ba9f7a26e1f0807c3c38e2f0771e7 /webapp/src/main.rs
parent397214caf0fe46cb1cd455908a67d36a931e7ec4 (diff)
Refactor current_bid handling in bidding box
Align with representation used by the engine
Diffstat (limited to 'webapp/src/main.rs')
-rw-r--r--webapp/src/main.rs8
1 files changed, 4 insertions, 4 deletions
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)]