commit c1ca6e498b81753746d4416a0810f9f96f6c771c
parent 6e6b67f7175e0eec22d8a1c07b164ae401f4fc22
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 6 Dec 2023 15:00:41 -0500
bet shortcuts
Diffstat:
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -700,13 +700,28 @@ func PokerBetHandler(c echo.Context) error {
}
bet := 100
if c.Request().Method == http.MethodPost {
- bet, _ = strconv.Atoi(c.Request().PostFormValue("bet"))
+ bet, _ = strconv.Atoi(c.Request().PostFormValue("betValue"))
+ betBtn := c.Request().PostFormValue("bet")
+ if betBtn == "bet50" {
+ bet = 50
+ } else if betBtn == "bet100" {
+ bet = 100
+ } else if betBtn == "bet200" {
+ bet = 200
+ }
select {
case g.PlayersEventCh <- PlayerEvent{Player: authUser.Username.String(), Bet: bet}:
default:
}
}
- return c.HTML(http.StatusOK, `<form method="post"><input type="number" name="bet" value="`+itoa(bet)+`" style="width: 90px;" /><button>Bet</button></form>`)
+ html := `
+<form method="post">
+ <input type="number" name="betValue" value="` + itoa(bet) + `" style="width: 90px;" /><button type="submit" name="bet" value="bet">Bet</button><br />
+ <button type="submit" name="bet" value="bet50">50</button>
+ <button type="submit" name="bet" value="bet100">100</button>
+ <button type="submit" name="bet" value="bet200">200</button>
+</form>`
+ return c.HTML(http.StatusOK, html)
}
func PokerCallHandler(c echo.Context) error {
@@ -1188,7 +1203,7 @@ body {
#checkBtn { width: 60px; height: 30px; }
#foldBtn { width: 50px; height: 30px; }
#callBtn { width: 50px; height: 30px; }
-#betBtn { width: 145px; height: 30px; }
+#betBtn { width: 145px; height: 60px; }
#countdown1 { position: absolute; display: none; z-index: 100; }
#countdown2 { position: absolute; display: none; z-index: 100; }
#countdown3 { position: absolute; display: none; z-index: 100; }