Move Hole indicator and End Game button to mobile bottom bar

- Add round info and leave button to mobile-bottom-bar HTML
- Hide .round-info and #leave-game-btn from header on mobile
- Style round info as subtle text, leave button as red-tinted pill
- Slim down bottom bar: smaller gaps/padding to fit 4 items
- Sync round numbers and leave text via JS (renderGame + bindEvents)
- Frees up header space, reduces mobile crowding

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
adlee-was-taken 2026-02-21 23:40:24 -05:00
parent 7e108a71f9
commit ac2d53b404
3 changed files with 41 additions and 8 deletions

View File

@ -545,6 +545,8 @@ class GolfGame {
this.addSelectedCpusBtn.addEventListener('click', () => { this.playSound('success'); this.addSelectedCpus(); }); this.addSelectedCpusBtn.addEventListener('click', () => { this.playSound('success'); this.addSelectedCpus(); });
this.muteBtn.addEventListener('click', () => this.toggleSound()); this.muteBtn.addEventListener('click', () => this.toggleSound());
this.leaveGameBtn.addEventListener('click', () => { this.playSound('click'); this.leaveGame(); }); this.leaveGameBtn.addEventListener('click', () => { this.playSound('click'); this.leaveGame(); });
const mobileLeaveBtn = document.getElementById('mobile-leave-btn');
if (mobileLeaveBtn) mobileLeaveBtn.addEventListener('click', () => { this.playSound('click'); this.leaveGame(); });
this.gameLogoutBtn.addEventListener('click', () => { this.playSound('click'); this.auth?.logout(); }); this.gameLogoutBtn.addEventListener('click', () => { this.playSound('click'); this.auth?.logout(); });
// Copy room code to clipboard // Copy room code to clipboard
@ -3073,7 +3075,10 @@ class GolfGame {
this.waitingForFlip = false; this.waitingForFlip = false;
this.previousState = null; this.previousState = null;
// Update leave button text based on role // Update leave button text based on role
this.leaveGameBtn.textContent = this.isHost ? 'End Game' : 'Leave'; const leaveText = this.isHost ? 'End Game' : 'Leave';
this.leaveGameBtn.textContent = leaveText;
const mobileLeave = document.getElementById('mobile-leave-btn');
if (mobileLeave) mobileLeave.textContent = leaveText;
// Update active rules bar // Update active rules bar
this.updateActiveRulesBar(); this.updateActiveRulesBar();
} }
@ -3750,6 +3755,12 @@ class GolfGame {
this.currentRoundSpan.textContent = this.gameState.current_round; this.currentRoundSpan.textContent = this.gameState.current_round;
this.totalRoundsSpan.textContent = this.gameState.total_rounds; this.totalRoundsSpan.textContent = this.gameState.total_rounds;
// Sync mobile bottom bar round info
const mobileRound = document.getElementById('mobile-current-round');
const mobileTotal = document.getElementById('mobile-total-rounds');
if (mobileRound) mobileRound.textContent = this.gameState.current_round;
if (mobileTotal) mobileTotal.textContent = this.gameState.total_rounds;
// Show/hide final turn badge with enhanced urgency // Show/hide final turn badge with enhanced urgency
const isFinalTurn = this.gameState.phase === 'final_turn'; const isFinalTurn = this.gameState.phase === 'final_turn';
if (isFinalTurn) { if (isFinalTurn) {

View File

@ -401,8 +401,10 @@
<!-- Mobile bottom bar (hidden on desktop) --> <!-- Mobile bottom bar (hidden on desktop) -->
<div id="mobile-bottom-bar"> <div id="mobile-bottom-bar">
<div class="mobile-round-info">Hole <span id="mobile-current-round">1</span>/<span id="mobile-total-rounds">9</span></div>
<button class="mobile-bar-btn" data-drawer="standings-panel">Standings</button> <button class="mobile-bar-btn" data-drawer="standings-panel">Standings</button>
<button class="mobile-bar-btn" data-drawer="scoreboard">Scores</button> <button class="mobile-bar-btn" data-drawer="scoreboard">Scores</button>
<button id="mobile-leave-btn" class="mobile-bar-btn mobile-leave-btn">End Game</button>
</div> </div>
<!-- Drawer backdrop for mobile --> <!-- Drawer backdrop for mobile -->

View File

@ -4960,10 +4960,12 @@ body.mobile-portrait .header-col-right {
gap: 4px; gap: 4px;
} }
/* Hide non-essential header items on mobile */ /* Hide items moved to bottom bar on mobile */
body.mobile-portrait .active-rules-bar, body.mobile-portrait .active-rules-bar,
body.mobile-portrait .game-username, body.mobile-portrait .game-username,
body.mobile-portrait #game-logout-btn { body.mobile-portrait #game-logout-btn,
body.mobile-portrait .game-header .round-info,
body.mobile-portrait .game-header #leave-game-btn {
display: none !important; display: none !important;
} }
@ -5257,24 +5259,42 @@ body.mobile-portrait #mobile-bottom-bar {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
gap: 12px; gap: 8px;
background: none; background: none;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
padding: 8px 20px; padding: 6px 12px;
padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
z-index: 500; z-index: 500;
} }
body.mobile-portrait #mobile-bottom-bar .mobile-round-info {
color: rgba(255, 255, 255, 0.7);
font-size: 0.65rem;
font-weight: 600;
white-space: nowrap;
letter-spacing: 0.05em;
}
body.mobile-portrait #mobile-bottom-bar .mobile-leave-btn {
background: rgba(180, 60, 60, 0.3) !important;
border-color: rgba(220, 80, 80, 0.4) !important;
color: rgba(255, 120, 120, 0.9) !important;
}
body.mobile-portrait #mobile-bottom-bar .mobile-leave-btn:active {
background: rgba(180, 60, 60, 0.5) !important;
}
body.mobile-portrait #mobile-bottom-bar .mobile-bar-btn { body.mobile-portrait #mobile-bottom-bar .mobile-bar-btn {
background: rgba(255, 255, 255, 0.06); background: rgba(255, 255, 255, 0.06);
border: 1px solid rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.1);
color: rgba(255, 255, 255, 0.65); color: rgba(255, 255, 255, 0.65);
font-size: 0.7rem; font-size: 0.65rem;
font-weight: 600; font-weight: 600;
padding: 7px 20px; padding: 6px 14px;
cursor: pointer; cursor: pointer;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.1em; letter-spacing: 0.1em;