dkforest

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

commit cda27ce5bd4e22acb542b8f50038d20fc81845f0
parent 85bb648171804ce55fd279902063b500e5728850
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sat,  9 Dec 2023 05:41:03 -0500

improve UI

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

diff --git a/pkg/web/handlers/poker/poker.go b/pkg/web/handlers/poker/poker.go @@ -1286,7 +1286,7 @@ func buildActionsDiv(roomID string) (html string) { return } -func buildSeatsHtml(g *PokerGame, roomID string) (seats string) { +func buildSeatsHtml(g *PokerGame, authUser *database.User, roomID string) (seats string) { g.PlayersMtx.RLock() defer g.PlayersMtx.RUnlock() for i := range g.Players { @@ -1302,9 +1302,12 @@ func buildSeatsHtml(g *PokerGame, roomID string) (seats string) { } seats += `</div>` + seats += `<style>` for i, p := range g.Players { if p != nil { - seats += `<style>` + if p.Username == authUser.Username.String() { + seats += `#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)) + `"; }` if g.Ongoing != nil { @@ -1312,9 +1315,11 @@ func buildSeatsHtml(g *PokerGame, roomID string) (seats string) { seats += `#seat` + itoa(i+1) + `Pot:before { content: "` + itoa(op.Bet) + `"; }` } } - seats += `</style>` + } else { + seats += `#seat` + itoa(i+1) + ` { border: 1px solid #333; }` } } + seats += `</style>` return seats } @@ -1387,9 +1392,13 @@ func drawSeatsHtml(authUser *database.User, g *PokerGame) string { 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: ""; }` } @@ -1780,7 +1789,7 @@ func PokerHandler(c echo.Context) error { //send(buildDevHtml()) send(buildCardsHtml()) send(buildTakeSeatHtml(authUser, g, roomID)) - send(buildSeatsHtml(g, roomID)) + send(buildSeatsHtml(g, authUser, roomID)) send(buildActionsDiv(roomID)) send(buildYourCardsHtml(authUser, g)) send(buildDealerTokenHtml(g))