dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 70542a9b850a8eb2edcfe59771617bd1d71b58a8
parent c6e646886b3d7cb1b34237324fc8bc33400e14ab
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat,  9 Dec 2023 05:48:12 -0500

refactor

Diffstat:
Mpkg/web/handlers/poker/poker.go | 36++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -1274,47 +1274,47 @@ func buildActionsDiv(roomID string) (html string) { return } -func buildSeatsHtml(g *PokerGame, authUser *database.User, roomID string) (seats string) { +func buildSeatsHtml(g *PokerGame, authUser *database.User, roomID string) (html string) { g.PlayersMtx.RLock() defer g.PlayersMtx.RUnlock() for i := range g.Players { - seats += `<div id="seat` + itoa(i+1) + `Pot"></div>` + html += `<div id="seat` + itoa(i+1) + `Pot"></div>` } - seats += `<div>` + html += `<div>` for i := range g.Players { - seats += `<div class="seat" id="seat` + itoa(i+1) + `"> + html += `<div class="seat" id="seat` + itoa(i+1) + `"> <iframe src="/poker/` + roomID + `/sit/` + itoa(i+1) + `" class="takeSeat takeSeat` + itoa(i+1) + `"></iframe>` - seats += ` <div class="inner"></div>` - seats += ` <div id="seat` + itoa(i+1) + `_cash" class="cash"></div>` - seats += `</div>` + html += ` <div class="inner"></div>` + html += ` <div id="seat` + itoa(i+1) + `_cash" class="cash"></div>` + html += `</div>` } - seats += `</div>` + html += `</div>` seated, _ := g.IsSeated(authUser.Username.String()) - seats += `<style>` + html += `<style>` for i, p := range g.Players { if p != nil || seated { - seats += `.takeSeat` + itoa(i+1) + ` { display: none; }` + html += `.takeSeat` + itoa(i+1) + ` { display: none; }` } else { - seats += `.takeSeat` + itoa(i+1) + ` { display: block; }` + html += `.takeSeat` + itoa(i+1) + ` { display: block; }` } if p != nil { if p.Username == authUser.Username.String() { - seats += `#seat` + itoa(i+1) + ` { border: 2px solid #0d1b8f; }` + html += `#seat` + itoa(i+1) + ` { border: 2px solid #0d1b8f; }` } - seats += `#seat` + itoa(i+1) + ` .inner:before { content: "` + p.Username + `"; }` - seats += `#seat` + itoa(i+1) + `_cash:before { content: "` + itoa(p.getDisplayCash(g)) + `"; }` + html += `#seat` + itoa(i+1) + ` .inner:before { content: "` + p.Username + `"; }` + html += `#seat` + itoa(i+1) + `_cash:before { content: "` + itoa(p.getDisplayCash(g)) + `"; }` if g.Ongoing != nil { if op := g.Ongoing.GetPlayer(p.Username); op != nil && op.Bet > 0 { - seats += `#seat` + itoa(i+1) + `Pot:before { content: "` + itoa(op.Bet) + `"; }` + html += `#seat` + itoa(i+1) + `Pot:before { content: "` + itoa(op.Bet) + `"; }` } } } else { - seats += `#seat` + itoa(i+1) + ` { border: 1px solid #333; }` + html += `#seat` + itoa(i+1) + ` { border: 1px solid #333; }` } } - seats += `</style>` - return seats + html += `</style>` + return html } func drawSeatsHtml(authUser *database.User, g *PokerGame) string {