Fix Texas Hold'em dealer page: script timing crash and seat overlap

main.js ran an IIFE immediately, but the layout renders @section Scripts
inside <head> before <body> exists, so every getElementById() call hit
null. Wrapped init in DOMContentLoaded, matching the rest of the codebase
(e.g. ChessScripts/chessMain.js).

Separately, the original seat cards packed a full data-entry form (name,
toggles, 2 cards, 5 chip counters, $ override, custom fields) into each of
up to 24 positions around a circle — at any screen size, adjacent seats
overlapped badly. Replaced with compact seat "pucks" for the table view
(name, cards, total, blind/dealer badges) plus a dedicated seat editor
panel in the sidebar that opens for whichever seat is clicked.

Verified via Playwright MCP: load with no console errors, drag-and-drop
seat swap, and a 3-way side-pot resolution (short all-in capped correctly,
remainder awarded to the next-best hand) end to end.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018CmAti1baCjidbJM2HeJfk
This commit is contained in:
2026-08-31 15:01:18 -06:00
co-authored by Claude Sonnet 5
parent 98f95df8fb
commit 25bf67062a
4 changed files with 315 additions and 189 deletions
+83 -38
View File
@@ -117,7 +117,7 @@ body {
#pokerTableWrap {
position: relative;
width: 100%;
padding-bottom: 62%;
padding-bottom: 72%;
}
#pokerTable {
@@ -161,19 +161,21 @@ body {
inset: 0;
}
/* ---------- Seats ---------- */
/* ---------- Seats (compact pucks on the table) ---------- */
.seat {
position: absolute;
transform: translate(-50%, -50%);
width: 190px;
width: 96px;
min-height: 54px;
background: #232323;
border: 1px solid #3a3a3a;
border: 2px solid #3a3a3a;
border-radius: 10px;
padding: 0.6rem;
padding: 0.3rem 0.4rem;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
cursor: grab;
z-index: 1;
text-align: center;
}
.seat.dragging {
@@ -189,30 +191,60 @@ body {
opacity: 0.45;
}
.seat.seatFolded .seatCard {
opacity: 0.55;
.seat.seatFolded {
border-style: dashed;
opacity: 0.6;
}
.seat.seatSelected {
border-color: #09ff00;
box-shadow: 0 0 0 2px rgba(9, 255, 0, 0.35), 0 4px 10px rgba(0, 0, 0, 0.4);
}
.seatChairNumber {
position: absolute;
top: 2px;
left: 5px;
font-size: 0.6rem;
color: #777;
}
.seatPuckName {
font-size: 0.72rem;
font-weight: 600;
color: #eee;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-top: 0.6rem;
}
.seatPuckCards {
font-size: 0.65rem;
color: #888;
text-transform: uppercase;
letter-spacing: 0.05em;
margin-bottom: 0.3rem;
font-family: var(--font-mono, monospace);
color: #bbb;
min-height: 0.9em;
}
.seatPuckTotal {
font-size: 0.7rem;
font-weight: 700;
color: #9be6a8;
min-height: 1em;
}
.dealerChip {
position: absolute;
top: -10px;
right: -10px;
width: 26px;
height: 26px;
width: 22px;
height: 22px;
border-radius: 50%;
background: #444;
color: #ccc;
border: 2px solid #666;
font-weight: 700;
font-size: 0.75rem;
font-size: 0.68rem;
cursor: pointer;
z-index: 2;
}
@@ -226,10 +258,10 @@ body {
.blindBadge {
display: none;
position: absolute;
top: -10px;
font-size: 0.65rem;
top: -9px;
font-size: 0.58rem;
font-weight: 700;
padding: 0.1rem 0.4rem;
padding: 0.05rem 0.3rem;
border-radius: 8px;
z-index: 2;
}
@@ -245,15 +277,43 @@ body {
}
.bbBadge {
left: 26px;
left: 22px;
background: #b7791f;
color: #fff7e6;
}
.seatCardTop {
/* ---------- Seat editor panel (sidebar form for the selected seat) ---------- */
.seatEditorPanel {
padding: 0.9rem;
}
.seatEditorPanel h2 {
margin: 0 0 0.6rem;
font-size: 0.95rem;
font-weight: 500;
color: #f5f5f5;
}
.seatEditorForm {
display: flex;
gap: 0.4rem;
margin-bottom: 0.35rem;
flex-direction: column;
gap: 0.6rem;
}
.seatCardToggles {
display: flex;
gap: 0.6rem;
font-size: 0.8rem;
color: #aaa;
}
.inHandToggle,
.foldToggle {
display: flex;
align-items: center;
gap: 0.3rem;
cursor: pointer;
}
.seatNameInput {
@@ -267,22 +327,6 @@ body {
font-size: 0.8rem;
}
.seatCardToggles {
display: flex;
gap: 0.6rem;
margin-bottom: 0.4rem;
font-size: 0.7rem;
color: #aaa;
}
.inHandToggle,
.foldToggle {
display: flex;
align-items: center;
gap: 0.25rem;
cursor: pointer;
}
.seatCards {
display: flex;
gap: 0.35rem;
@@ -598,6 +642,7 @@ body {
}
.seat {
width: 150px;
width: 78px;
min-height: 44px;
}
}