Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -693,9 +693,16 @@ export function renderer(options: RendererOptions): void {
? bestFiveCardHands[winnerIndex].match(/.{1,2}/g) || ([] as string[])
: ([] as string[]);

// Check for split pot
let isSplitPot = false;
// If both players are winners, then it's a split pot
if (stepType === 'final' && players.every((p) => (p as RepeatedPokerStepPlayer).isWinner)) {
isSplitPot = true;
}

// Add actual cards
for (let i = 0; i < numCards; i++) {
const shouldHighlight = winnerBestHand.includes(communityCardsArray[i]);
const shouldHighlight = !isSplitPot && winnerBestHand.includes(communityCardsArray[i]);
elements.communityCardsContainer.appendChild(createCardElement(communityCardsArray[i], false, shouldHighlight));
}

Expand All @@ -713,18 +720,23 @@ export function renderer(options: RendererOptions): void {
// Casting 'basePlayerData' to 'RepeatedPokerStepPlayer' to access properties.
const playerData = basePlayerData as RepeatedPokerStepPlayer;

const isWinner = playerData.actionDisplayText !== 'SPLIT POT' && playerData.isWinner;
const isSplitPot = playerData.actionDisplayText === 'SPLIT POT';
const isAllIn = playerData.actionDisplayText === 'ALL-IN';
const isTurn = playerData.isTurn;

const playerNameElement = elements.playerNames[index];
if (playerNameElement) {
playerNameElement.textContent = playerData.name;

if (playerData.isTurn) {
if (isTurn) {
playerNameElement.classList.add('current-turn');
} else {
playerNameElement.classList.remove('current-turn');
}

// Add winner class if player won
if (playerData.isWinner) {
if (isWinner) {
playerNameElement.classList.add('winner');
} else {
playerNameElement.classList.remove('winner');
Expand Down Expand Up @@ -758,8 +770,8 @@ export function renderer(options: RendererOptions): void {
bestFiveCardHands && bestFiveCardHands[index]
? bestFiveCardHands[index].match(/.{1,2}/g) || ([] as string[])
: ([] as string[]);
const shouldHighlightWinningHand = playerData.isWinner && showCards && isShowdown && bestHandArray.length > 0;

const shouldHighlightWinningHand = isWinner && showCards && isShowdown && bestHandArray.length > 0;
(playerCardsArray || [null, null]).forEach((cardStr) => {
const shouldHighlight = shouldHighlightWinningHand && cardStr && bestHandArray.includes(cardStr);
playerCardsContainer.appendChild(
Expand All @@ -777,14 +789,17 @@ export function renderer(options: RendererOptions): void {
const playerInfoArea = elements.playerInfoAreas[index];
if (playerInfoArea) {
// Highlight active player's pod
if (playerData.isTurn) {
if (isTurn) {
playerInfoArea.classList.add('active-player');
} else {
playerInfoArea.classList.remove('active-player');
}
if (isSplitPot) {
playerInfoArea.classList.add('split-pot');
}

// Highlight winner's pod
if (playerData.isWinner) {
if (isWinner) {
playerInfoArea.classList.add('winner-player');
} else {
playerInfoArea.classList.remove('winner-player');
Expand All @@ -797,16 +812,24 @@ export function renderer(options: RendererOptions): void {

const betDisplay = playerInfoArea.querySelector('.bet-display') as HTMLElement;
if (betDisplay) {
if (playerData.isWinner) {
if (isWinner) {
betDisplay.classList.add('winner-player');
} else if (isSplitPot) {
betDisplay.classList.add('split-pot');
} else {
if (isTurn) {
betDisplay.classList.add('active-player');
}
if (isAllIn) {
betDisplay.classList.add('all-in');
}
}
if (playerData.currentBet > 0) {
if (playerData.actionDisplayText) {
betDisplay.textContent = playerData.actionDisplayText;
} else {
betDisplay.textContent = '';
}
betDisplay.style.display = 'block';
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@
border-color: #ffeb70;
}

.player-info-area.split-pot {
border-color: #FF5C19;
}

.player-container-0 .player-info-area {
flex-direction: column-reverse;
}
Expand Down Expand Up @@ -433,20 +437,36 @@
padding: 10px;
border-radius: 30px;
background-color: #ffffff;
opacity: 0.7;
color: black;
font-family: "Inter", sans-serif;
font-size: 20px;
font-weight: 600;
text-align: center;
height: 20pxrem;
height: 20px;
line-height: 20px;
width: 240px;
min-height: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.bet-display.active-player {
opacity: 1;
}

.bet-display.winner-player {
background-color: #ffeb70;
opacity: 1;
}

.bet-display.split-pot {
opacity: 1;
background-color: #FF5C19;
}

.bet-display.all-in {
color: white;
background-color: #B3261E;
}

.blind-indicator {
Expand Down