Add mobile rules indicator pill and drawer
Shows "S" (standard) or "!" (house rules) in the mobile bottom bar. Tapping opens a drawer with the full active rules list. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
28a0f90374
commit
9b0a8295eb
@ -3138,6 +3138,24 @@ class GolfGame {
|
|||||||
`<span class="rule-tag rule-more" title="${tooltip}">+${moreCount} more</span>`;
|
`<span class="rule-tag rule-more" title="${tooltip}">+${moreCount} more</span>`;
|
||||||
}
|
}
|
||||||
this.activeRulesBar.classList.remove('hidden');
|
this.activeRulesBar.classList.remove('hidden');
|
||||||
|
|
||||||
|
// Update mobile rules indicator
|
||||||
|
const mobileRulesBtn = document.getElementById('mobile-rules-btn');
|
||||||
|
const mobileRulesIcon = document.getElementById('mobile-rules-icon');
|
||||||
|
const mobileRulesContent = document.getElementById('mobile-rules-content');
|
||||||
|
if (mobileRulesBtn && mobileRulesIcon && mobileRulesContent) {
|
||||||
|
const isHouseRules = rules.length > 0;
|
||||||
|
mobileRulesIcon.textContent = isHouseRules ? '!' : 'S';
|
||||||
|
mobileRulesBtn.classList.toggle('house-rules', isHouseRules);
|
||||||
|
|
||||||
|
if (!isHouseRules) {
|
||||||
|
mobileRulesContent.innerHTML = '<div class="mobile-rules-content-list"><span class="rule-tag standard">Standard Rules</span></div>';
|
||||||
|
} else {
|
||||||
|
const tagHtml = (unrankedTag ? '<span class="rule-tag unranked">Unranked</span>' : '') +
|
||||||
|
rules.map(renderTag).join('');
|
||||||
|
mobileRulesContent.innerHTML = `<div class="mobile-rules-content-list">${tagHtml}</div>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// V3_14: Map display names to rule keys
|
// V3_14: Map display names to rule keys
|
||||||
|
|||||||
@ -406,9 +406,16 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Mobile rules drawer -->
|
||||||
|
<div id="rules-drawer" class="side-panel rules-drawer-panel">
|
||||||
|
<h4>Active Rules</h4>
|
||||||
|
<div id="mobile-rules-content"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 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>
|
<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 mobile-rules-btn" id="mobile-rules-btn" data-drawer="rules-drawer"><span id="mobile-rules-icon">S</span></button>
|
||||||
<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>
|
<button id="mobile-leave-btn" class="mobile-bar-btn mobile-leave-btn">End Game</button>
|
||||||
|
|||||||
@ -5464,6 +5464,59 @@ body.mobile-portrait #mobile-bottom-bar .mobile-bar-btn.active {
|
|||||||
box-shadow: 0 2px 12px rgba(244, 164, 96, 0.4);
|
box-shadow: 0 2px 12px rgba(244, 164, 96, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- Mobile: Rules indicator button --- */
|
||||||
|
body.mobile-portrait #mobile-bottom-bar .mobile-rules-btn {
|
||||||
|
padding: 4px 9px;
|
||||||
|
font-size: 0.77rem;
|
||||||
|
font-weight: 700;
|
||||||
|
min-width: unset;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.15);
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
body.mobile-portrait #mobile-bottom-bar .mobile-rules-btn.house-rules {
|
||||||
|
background: rgba(244, 164, 96, 0.25);
|
||||||
|
border-color: rgba(244, 164, 96, 0.4);
|
||||||
|
color: #f4a460;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* --- Mobile: Rules drawer content --- */
|
||||||
|
#rules-drawer {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.mobile-portrait #rules-drawer {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.mobile-portrait .rules-drawer-panel .mobile-rules-content-list {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.mobile-portrait .rules-drawer-panel .rule-tag {
|
||||||
|
background: rgba(244, 164, 96, 0.3);
|
||||||
|
color: #f4a460;
|
||||||
|
padding: 4px 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.mobile-portrait .rules-drawer-panel .rule-tag.standard {
|
||||||
|
background: rgba(255, 255, 255, 0.15);
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
body.mobile-portrait .rules-drawer-panel .rule-tag.unranked {
|
||||||
|
background: rgba(220, 80, 80, 0.3);
|
||||||
|
color: #f08080;
|
||||||
|
border: 1px solid rgba(220, 80, 80, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
/* --- Mobile: Non-game screens --- */
|
/* --- Mobile: Non-game screens --- */
|
||||||
body.mobile-portrait #lobby-screen {
|
body.mobile-portrait #lobby-screen {
|
||||||
padding: 55px 12px 15px;
|
padding: 55px 12px 15px;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user