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
63 changes: 57 additions & 6 deletions src/apps/golf/components/GolfGame.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,17 @@
}

.playerInfo.active {
background: rgba(144, 238, 144, 0.2);
background: rgba(144, 238, 144, 0.25);
border: 1px solid #90ee90;
box-shadow: 0 0 12px rgba(144, 238, 144, 0.3);
}

.turnLabel {
font-size: 0.7rem;
color: #90ee90;
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 500;
}

.score {
Expand Down Expand Up @@ -245,8 +254,15 @@
}

.card.selected {
border: 3px solid #90ee90;
transform: scale(1.05);
border: 3px solid #ffd700;
transform: scale(1.08);
box-shadow: 0 0 16px rgba(255, 215, 0, 0.5);
animation: selectedPulse 1.2s ease-in-out infinite;
}

@keyframes selectedPulse {
0%, 100% { box-shadow: 0 0 12px rgba(255, 215, 0, 0.4); }
50% { box-shadow: 0 0 24px rgba(255, 215, 0, 0.8); }
}

.card.clickable,
Expand Down Expand Up @@ -338,6 +354,17 @@
color: rgba(255, 255, 255, 0.5);
}

.emptyPileReserved {
width: 80px;
height: 120px;
visibility: hidden;
}

.drawnCardWrapper .card {
border: 2px solid #ffd700;
box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}

.playerArea {
background: rgba(255, 255, 255, 0.1);
padding: 2rem;
Expand Down Expand Up @@ -397,6 +424,20 @@
transition: transform 0.1s ease;
}

.actionButtonDisabled {
opacity: 0.4;
cursor: not-allowed;
}

.actionButtonDisabled:hover {
background: rgba(255, 255, 255, 0.2);
border-color: rgba(255, 255, 255, 0.3);
}

.actionButtonDisabled:active {
transform: none;
}

.knockButton {
background: #ff6b6b;
color: white;
Expand Down Expand Up @@ -609,9 +650,9 @@
}

.card.selected {
border: 3px solid #90ee90;
transform: scale(1.08);
box-shadow: 0 0 20px rgba(144, 238, 144, 0.5);
border: 3px solid #ffd700;
transform: scale(1.1);
box-shadow: 0 0 24px rgba(255, 215, 0, 0.6);
}

.cardRank {
Expand Down Expand Up @@ -641,6 +682,11 @@
height: 100px;
}

.emptyPileReserved {
width: 70px;
height: 100px;
}

.playerArea {
padding: 1rem;
width: 100%;
Expand Down Expand Up @@ -842,6 +888,11 @@
height: 80px;
}

.emptyPileReserved {
width: 55px;
height: 80px;
}

.cardGrid {
max-width: 130px;
gap: 0.6rem;
Expand Down
54 changes: 36 additions & 18 deletions src/apps/golf/components/GolfGame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const GolfGame = ({ onGameIdChange, onPlayerIdChange, onPlayerNameChange, onConn
const {
gameState,
roomState,
playerId,
roomCode,
selectedCardIndex,
isInLobby,
Expand Down Expand Up @@ -345,17 +346,26 @@ const GolfGame = ({ onGameIdChange, onPlayerIdChange, onPlayerNameChange, onConn
<div className={styles.gameHeaderInfo}>
<h2>Room: {gameState.id}</h2>
<div className={styles.playerList}>
{gameState.players.map((player, index) => (
<div
key={player.id}
className={`${styles.playerInfo} ${index === gameState.currentPlayerIndex ? styles.active : ''}`}
>
<span>{getDisplayName(player)}</span>
{gameState.gamePhase === 'ended' && (
<span className={styles.score}>Score: {player.score}</span>
)}
</div>
))}
{gameState.players.map((player, index) => {
const isActivePlayer = index === gameState.currentPlayerIndex && gameState.gamePhase === 'playing'
return (
<div
key={player.id}
className={`${styles.playerInfo} ${isActivePlayer ? styles.active : ''}`}
>
<span>{getDisplayName(player)}</span>
{isActivePlayer && player.id !== playerId && (
<span className={styles.turnLabel}>their turn</span>
)}
{isActivePlayer && player.id === playerId && (
<span className={styles.turnLabel}>your turn</span>
)}
{gameState.gamePhase === 'ended' && (
<span className={styles.score}>Score: {player.score}</span>
)}
</div>
)
})}
</div>
</div>
{currentGamePermalink && (
Expand Down Expand Up @@ -541,12 +551,16 @@ const GolfGame = ({ onGameIdChange, onPlayerIdChange, onPlayerNameChange, onConn
)}
</div>

{gameState.drawnCard && isMyTurn && (
<div className={styles.pile}>
<h3>Drawn Card</h3>
{renderCard(gameState.drawnCard, -2, true, false)}
</div>
)}
<div className={styles.pile}>
<h3>{gameState.drawnCard && isMyTurn ? 'Drawn Card' : '\u00A0'}</h3>
{gameState.drawnCard && isMyTurn ? (
<div className={styles.drawnCardWrapper}>
{renderCard(gameState.drawnCard, -2, true, false)}
</div>
) : (
<div className={styles.emptyPileReserved} />
)}
</div>
</div>
</div>

Expand All @@ -573,7 +587,11 @@ const GolfGame = ({ onGameIdChange, onPlayerIdChange, onPlayerNameChange, onConn
</>
) : (
<>
<button onClick={swapCard} className={styles.actionButton}>
<button
onClick={swapCard}
className={`${styles.actionButton} ${selectedCardIndex === null ? styles.actionButtonDisabled : ''}`}
disabled={selectedCardIndex === null}
>
Swap Card
</button>
<button onClick={discardDrawn} className={styles.actionButton}>
Expand Down
Loading