commit e9b5e353b986fa7dc00d88ffa02dc398d4a69ed3
parent b0479f27f9c9a3c786753bc2b818df8bf394bd90
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Tue, 19 Dec 2023 12:13:43 -0500
cleanup
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -1831,7 +1831,7 @@ func drawSeatsStyle(authUser *database.User, g *PokerGame) string {
html += fmt.Sprintf(`#seat%s { border: 2px solid #0d1b8f; }`, idxStr)
}
html += fmt.Sprintf(`#seat%s .inner:before { content: "%s"; }`, idxStr, pUsername.String())
- html += fmt.Sprintf(`#seat%s_cash:before { content: "%s"; }`, idxStr, itoa2(p.getCash()))
+ html += drawSeatCashLabel(idxStr, itoa2(p.getCash()))
if ongoing != nil {
if op := ongoing.getPlayer(pUserID); op != nil && op.getBet() > 0 {
html += fmt.Sprintf(`#seat%sPot:before { content: "%s"; }`, idxStr, itoa2(op.getBet()))
@@ -1840,7 +1840,7 @@ func drawSeatsStyle(authUser *database.User, g *PokerGame) string {
} else {
html += fmt.Sprintf(`#seat%s { border: 1px solid #333; }`, idxStr)
html += fmt.Sprintf(`#seat%s .inner:before { content: ""; }`, idxStr)
- html += fmt.Sprintf(`#seat%s_cash:before { content: ""; }`, idxStr)
+ html += drawSeatCashLabel(idxStr, "")
}
}
})
@@ -1848,6 +1848,10 @@ func drawSeatsStyle(authUser *database.User, g *PokerGame) string {
return html
}
+func drawSeatCashLabel(seatIdxStr, cashStr string) string {
+ return fmt.Sprintf(`#seat%s_cash:before { content: "%s"; }`, seatIdxStr, cashStr)
+}
+
func drawAutoActionMsgEvent(evt AutoActionEvent) (html string) {
display := utils.Ternary(evt.Message != "", "block", "none")
html += fmt.Sprintf(`<style>#autoAction { display: %s; } #autoAction:before { content: "%s"; }</style>`, display, evt.Message)
@@ -1864,7 +1868,7 @@ func drawPlayerBetEvent(evt PlayerBetEvent) (html string) {
idxStr := itoa(evt.PlayerSeatIdx + 1)
html += `<style>`
html += fmt.Sprintf(`#seat%sPot:before { content: "%s"; }`, idxStr, itoa2(evt.TotalBet))
- html += fmt.Sprintf(`#seat%s_cash:before { content: "%s"; }`, idxStr, itoa2(evt.Cash))
+ html += drawSeatCashLabel(idxStr, itoa2(evt.Cash))
html += `</style>`
return
}
@@ -1889,7 +1893,7 @@ func drawGameIsDoneHtml(g *PokerGame, evt GameIsDoneEvent) (html string) {
g.Players.RWith(func(gPlayers *[]*seatedPlayer) {
for i, p := range *gPlayers {
if p != nil {
- html += fmt.Sprintf(`#seat%s_cash:before { content: "%s"; }`, itoa(i+1), itoa2(p.getCash()))
+ html += drawSeatCashLabel(itoa(i+1), itoa2(p.getCash()))
}
}
})