- Persist hasPausedGame and restore it on load - Reset and resume behavior now reflect paused state - Update UI to show Game Paused and adjust labels - Clear timer before starting to avoid overlaps
218 lines
7.8 KiB
HTML
218 lines
7.8 KiB
HTML
<!doctype html>
|
||
<html lang="en" class="h-full bg-gray-50">
|
||
<head>
|
||
<meta charset="UTF-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||
<title>Round Counter - EDH Stats Tracker</title>
|
||
<meta
|
||
name="description"
|
||
content="Live round counter for Magic: The Gathering EDH/Commander games"
|
||
/>
|
||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||
<script src="https://cdn.tailwindcss.com"></script>
|
||
<link rel="stylesheet" href="/css/styles.css" />
|
||
</head>
|
||
<body class="h-full flex flex-col" x-data="roundCounterApp()">
|
||
<!-- Navigation Header -->
|
||
<header class="bg-slate-900 text-white shadow-lg">
|
||
<nav class="container mx-auto px-4 py-4">
|
||
<div class="flex justify-between items-center">
|
||
<div class="flex items-center space-x-4">
|
||
<h1 class="text-2xl font-bold font-mtg">EDH Stats</h1>
|
||
</div>
|
||
|
||
<div class="flex items-center space-x-4">
|
||
<a href="/dashboard.html" class="text-white hover:text-edh-accent">
|
||
← Back to Dashboard
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</nav>
|
||
</header>
|
||
|
||
<!-- Main Content -->
|
||
<main class="flex-1 container mx-auto px-4 py-8">
|
||
<div class="max-w-2xl mx-auto">
|
||
<!-- Title Section -->
|
||
<div class="text-center mb-8">
|
||
<h2 class="text-4xl font-bold mb-2">Round Counter</h2>
|
||
<p class="text-gray-600">Track rounds in your current game</p>
|
||
</div>
|
||
|
||
<!-- Counter Display -->
|
||
<div class="card mb-8">
|
||
<!-- Game Status -->
|
||
<div class="text-center mb-8">
|
||
<span
|
||
x-show="!counterActive && !hasPausedGame"
|
||
class="inline-block px-4 py-2 bg-gray-200 text-gray-800 rounded-full text-sm font-semibold"
|
||
>
|
||
Ready to Start
|
||
</span>
|
||
<span
|
||
x-show="!counterActive && hasPausedGame"
|
||
class="inline-block px-4 py-2 bg-yellow-200 text-yellow-800 rounded-full text-sm font-semibold"
|
||
>
|
||
Game Paused
|
||
</span>
|
||
<span
|
||
x-show="counterActive"
|
||
class="inline-block px-4 py-2 bg-green-200 text-green-800 rounded-full text-sm font-semibold"
|
||
>
|
||
Game in Progress
|
||
</span>
|
||
</div>
|
||
|
||
<!-- Large Round Display -->
|
||
<div class="text-center mb-8">
|
||
<div class="text-8xl font-bold text-edh-primary mb-4">
|
||
<span x-text="currentRound"></span>
|
||
</div>
|
||
<p class="text-2xl text-gray-600">Current Round</p>
|
||
</div>
|
||
|
||
<!-- Quick Round Increment/Decrement -->
|
||
<div class="flex flex-wrap gap-4 justify-center mb-12">
|
||
<!-- Decrement -->
|
||
<button
|
||
@click="decrementRound()"
|
||
:disabled="currentRound <= 1 || !counterActive"
|
||
class="btn bg-red-500 hover:bg-red-600 text-white px-8 py-6 text-4xl font-bold disabled:opacity-30 disabled:cursor-not-allowed transition-colors rounded-lg"
|
||
>
|
||
−
|
||
</button>
|
||
|
||
<!-- Increment -->
|
||
<button
|
||
@click="incrementRound()"
|
||
:disabled="!counterActive"
|
||
class="btn bg-green-500 hover:bg-green-600 text-white px-8 py-6 text-4xl font-bold disabled:opacity-30 disabled:cursor-not-allowed transition-colors rounded-lg"
|
||
>
|
||
+
|
||
</button>
|
||
</div>
|
||
|
||
<!-- Elapsed Time -->
|
||
<div
|
||
x-show="counterActive"
|
||
class="text-center mb-8 p-4 bg-blue-50 rounded-lg"
|
||
>
|
||
<p class="text-sm text-gray-600 mb-2">Elapsed Time</p>
|
||
<p
|
||
class="text-3xl font-bold text-edh-primary"
|
||
x-text="elapsedTime"
|
||
></p>
|
||
</div>
|
||
|
||
<!-- Control Buttons -->
|
||
<div class="flex flex-wrap gap-4 justify-center mb-8">
|
||
<!-- Start/Stop Button -->
|
||
<button
|
||
@click="toggleCounter()"
|
||
:class="counterActive ? 'bg-red-500 hover:bg-red-600' : 'bg-green-500 hover:bg-green-600'"
|
||
class="btn text-white px-8 py-4 text-lg font-bold transition-colors"
|
||
>
|
||
<span x-show="!counterActive && !hasPausedGame">Start Game</span>
|
||
<span x-show="!counterActive && hasPausedGame">Resume Game</span>
|
||
<span x-show="counterActive">Pause Game</span>
|
||
</button>
|
||
|
||
<!-- Reset Button -->
|
||
<button
|
||
@click="resetCounter()"
|
||
:disabled="counterActive || (!hasPausedGame && !counterActive)"
|
||
class="btn bg-gray-500 hover:bg-gray-600 text-white px-8 py-4 text-lg font-bold disabled:opacity-30 disabled:cursor-not-allowed transition-colors"
|
||
>
|
||
Reset
|
||
</button>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Game Stats Card -->
|
||
<div class="card">
|
||
<h3 class="text-xl font-semibold mb-4">Game Statistics</h3>
|
||
<div class="grid grid-cols-2 md:grid-cols-3 gap-4">
|
||
<div class="text-center p-4 bg-gray-50 rounded-lg">
|
||
<p class="text-sm text-gray-600 mb-1">Current Round</p>
|
||
<p
|
||
class="text-2xl font-bold text-edh-primary"
|
||
x-text="currentRound"
|
||
></p>
|
||
</div>
|
||
<div class="text-center p-4 bg-gray-50 rounded-lg">
|
||
<p class="text-sm text-gray-600 mb-1">Time Elapsed</p>
|
||
<p
|
||
class="text-2xl font-bold text-edh-primary"
|
||
x-text="elapsedTime"
|
||
></p>
|
||
</div>
|
||
<div class="text-center p-4 bg-gray-50 rounded-lg">
|
||
<p class="text-sm text-gray-600 mb-1">Avg Time/Round</p>
|
||
<p
|
||
class="text-2xl font-bold text-edh-primary"
|
||
x-text="avgTimePerRound"
|
||
></p>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Save Game Button -->
|
||
<div x-show="counterActive || hasPausedGame" class="mt-8 text-center">
|
||
<button
|
||
@click="saveAndGoToGameLog()"
|
||
class="btn btn-primary text-white px-8 py-4 text-lg font-bold"
|
||
>
|
||
End Game & Log Results
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</main>
|
||
|
||
<!-- Reset Confirmation Modal -->
|
||
<div
|
||
x-show="resetConfirm.show"
|
||
x-cloak
|
||
x-transition
|
||
class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4"
|
||
@click.self="resetConfirm.show = false"
|
||
>
|
||
<div class="bg-white rounded-lg shadow-lg max-w-sm w-full">
|
||
<div class="p-6">
|
||
<h3 class="text-lg font-semibold text-gray-900 mb-2">
|
||
Reset Counter
|
||
</h3>
|
||
<p class="text-gray-600 mb-6">
|
||
Are you sure you want to reset the counter? This will lose all
|
||
progress.
|
||
</p>
|
||
<div class="flex justify-end space-x-3">
|
||
<button
|
||
@click="resetConfirm.show = false"
|
||
class="btn btn-secondary"
|
||
>
|
||
Cancel
|
||
</button>
|
||
<button
|
||
@click="confirmReset()"
|
||
:disabled="resetConfirm.resetting"
|
||
class="btn btn-primary bg-red-600 hover:bg-red-700"
|
||
>
|
||
<span x-show="!resetConfirm.resetting">Reset Counter</span>
|
||
<span x-show="resetConfirm.resetting">Resetting...</span>
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Scripts -->
|
||
<script
|
||
defer
|
||
src="https://unpkg.com/alpinejs@3.x.x/dist/cdn.min.js"
|
||
></script>
|
||
<script src="/js/auth-guard.js"></script>
|
||
<script src="/js/round-counter.js"></script>
|
||
<script src="/js/footer-loader.js"></script>
|
||
</body>
|
||
</html>
|