commit cda8c8c9c87c378b89834cf1b1d405f255de0ed8
parent cda27ce5bd4e22acb542b8f50038d20fc81845f0
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Sat, 9 Dec 2023 05:41:32 -0500
move code
Diffstat:
1 file changed, 27 insertions(+), 27 deletions(-)
diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go
@@ -1323,6 +1323,33 @@ func buildSeatsHtml(g *PokerGame, authUser *database.User, roomID string) (seats
return seats
}
+func drawSeatsHtml(authUser *database.User, g *PokerGame) string {
+ html := "<style>"
+ seated, _ := g.IsSeated(authUser.Username.String())
+ g.PlayersMtx.RLock()
+ defer g.PlayersMtx.RUnlock()
+ for i, p := range g.Players {
+ if p != nil || seated {
+ html += `.takeSeat` + itoa(i+1) + ` { display: none; }`
+ } else {
+ html += `.takeSeat` + itoa(i+1) + ` { display: block; }`
+ }
+ if p != nil {
+ if p.Username == authUser.Username.String() {
+ html += `#seat` + itoa(i+1) + ` { border: 2px solid #0d1b8f; }`
+ }
+ html += `#seat` + itoa(i+1) + ` .inner:before { content: "` + p.Username + `"; }`
+ html += `#seat` + itoa(i+1) + `_cash:before { content: "` + itoa(p.getDisplayCash(g)) + `"; }`
+ } else {
+ html += `#seat` + itoa(i+1) + ` { border: 1px solid #333; }`
+ html += `#seat` + itoa(i+1) + ` .inner:before { content: ""; }`
+ html += `#seat` + itoa(i+1) + `_cash:before { content: ""; }`
+ }
+ }
+ html += "</style>"
+ return html
+}
+
func drawErrorMsgEvent(evt ErrorMsgEvent) string {
return `<style>#errorMsg:before { content: "` + evt.Message + `"; }</style>`
}
@@ -1380,33 +1407,6 @@ func drawResetCardsEvent() (html string) {
return
}
-func drawSeatsHtml(authUser *database.User, g *PokerGame) string {
- html := "<style>"
- seated, _ := g.IsSeated(authUser.Username.String())
- g.PlayersMtx.RLock()
- defer g.PlayersMtx.RUnlock()
- for i, p := range g.Players {
- if p != nil || seated {
- html += `.takeSeat` + itoa(i+1) + ` { display: none; }`
- } else {
- html += `.takeSeat` + itoa(i+1) + ` { display: block; }`
- }
- if p != nil {
- if p.Username == authUser.Username.String() {
- html += `#seat` + itoa(i+1) + ` { border: 2px solid #0d1b8f; }`
- }
- html += `#seat` + itoa(i+1) + ` .inner:before { content: "` + p.Username + `"; }`
- html += `#seat` + itoa(i+1) + `_cash:before { content: "` + itoa(p.getDisplayCash(g)) + `"; }`
- } else {
- html += `#seat` + itoa(i+1) + ` { border: 1px solid #333; }`
- html += `#seat` + itoa(i+1) + ` .inner:before { content: ""; }`
- html += `#seat` + itoa(i+1) + `_cash:before { content: ""; }`
- }
- }
- html += "</style>"
- return html
-}
-
func drawCountDownStyle(evt PokerWaitTurnEvent) string {
html := "<style>"
html += `#countdown1, #countdown2, #countdown3, #countdown4, #countdown5, #countdown6 { display: none; }`