commit 5a48e4964d1948376c66447fef9296496b2f4f34
parent f63cc217b371f98b3efc029a42e25a4e6c767b3c
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 6 Dec 2023 02:55:52 -0500
ui
Diffstat:
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -726,14 +726,11 @@ func colorForCard1(name string) string {
}
func buildYourCardsHtml(authUser *database.User, g *PokerGame) string {
- html := `<div style="position: absolute; top: 480px; left: 200px;"><div id="yourCard1"></div><div id="yourCard2"></div></div>`
+ html := `<div style="position: absolute; top: 500px; left: 200px;"><div id="yourCard1"></div><div id="yourCard2"></div></div>`
if g.Ongoing != nil {
cards := make([]PlayerCard, 0)
- for _, p := range g.Ongoing.Players {
- if p != nil && p.Username == authUser.Username.String() {
- cards = p.Cards
- break
- }
+ if p := g.Ongoing.GetPlayer(authUser.Username.String()); p != nil {
+ cards = p.Cards
}
html += `<style>`
if len(cards) >= 1 {
@@ -821,8 +818,10 @@ func drawErrorMsgEvent(evt ErrorMsgEvent) string {
return `<style>#errorMsg:before { content: "` + evt.Message + `"; }</style>`
}
-func drawPlayerBetEvent(evt PlayerBetEvent) string {
- return `<style>#seat` + itoa(evt.PlayerIdx+1) + `_cash:before { content: "` + itoa(evt.Cash) + `"; }</style>`
+func drawPlayerBetEvent(evt PlayerBetEvent) (html string) {
+ html += `<style>#seat` + itoa(evt.PlayerIdx+1) + `Pot:before { content: "` + itoa(evt.TotalBet) + `"; }</style>`
+ html += `<style>#seat` + itoa(evt.PlayerIdx+1) + `_cash:before { content: "` + itoa(evt.Cash) + `"; }</style>`
+ return
}
func drawYourCardEvent(evt YourCardEvent) string {
@@ -905,6 +904,7 @@ func drawCountDownStyle(evt PokerWaitTurnEvent) string {
html := "<style>"
html += `#countdown1, #countdown2, #countdown3, #countdown4, #countdown5, #countdown6 { display: none; }`
if evt.Idx == -1 {
+ html += `#seat1Pot:before, #seat2Pot:before, #seat3Pot:before, #seat4Pot:before, #seat5Pot:before, #seat6Pot:before { content: ""; }`
html += `#mainPot:before { content: "Pot: ` + itoa(evt.MainPot) + `"; }`
} else if evt.Idx == 0 {
html += `#countdown1 { top: 50px; left: 600px; display: block; animation: time calc(var(--duration) * 1s) steps(1000, start) forwards; }`
@@ -1094,7 +1094,7 @@ body {
#winner { position: absolute; top: 265px; left: 250px; }
#yourCard1 { font-size: 22px; display: inline-block; margin-right: 15px; }
#yourCard2 { font-size: 22px; display: inline-block; }
-#errorMsg { position: absolute; top: 530px; left: 150px; color: darkred; }
+#errorMsg { position: absolute; top: 550px; left: 150px; color: darkred; }
#eventLogs { position: absolute; bottom: 5px; right: 5px; width: 200px; height: 200px; border: 1px solid black; background-color: #ccc; }