A comprehensive Magic: The Gathering Commander life and timer tracking application built with React and Tailwind CSS.
- 3-4 Player Support: Configurable games for 3 or 4 players
- Customizable Starting Life: Adjustable starting life totals with -5/-1/+1/+5 increment buttons (default 40 life)
- Per-Player Timers: Individual turn timers with customizable duration (default 15 minutes)
- Random Starting Player: Animated selection of the starting player
- Turn Management: Clockwise turn progression with visual active player indication
- Large, Clear Life Totals: Easy-to-read life counters with touch-friendly +/- buttons
- Quick Life Adjustments: Convenient increment/decrement controls positioned around timer
- Player Elimination Detection: Visual indicators for eliminated players
- Full Commander Damage Tracking: Track damage from each commander to each player
- Lethal Damage Warnings: Clear indicators when commander damage reaches 21+
- Intuitive Modal Interface: Easy-to-use commander damage adjustment modal with improved spacing
- CSS Grid-Based Layout: Modern 2x2 grid system replacing absolute positioning for better reliability
- Responsive Card Sizing: Cards scale from
w-[clamp(250px,35vw,350px)]to work on all screen sizes - Smart Grid Spacing: Uses
gap-[clamp(1rem,4vw,2rem)]for responsive margins that prevent overlap - Rotated Player Cards: Table-style layout with 90° and -90° rotations for immersive gameplay
- No Overlap Design: Grid system prevents layout issues across all device sizes
- Cross-Device Consistency: Works from iPhone SE (375px) to desktop screens
- Progressive Web App (PWA): Install as a native app on mobile and desktop
- Improved Fullscreen: Enhanced fullscreen support with cross-browser compatibility
- Visual Player States: Color-coded borders and highlighting for active players
- Touch-Optimized: Large buttons and intuitive gestures for mobile gameplay
- Clean Interface: Streamlined UI without unnecessary elements
- Offline Support: Works without internet connection after initial load
-
Clone the repository:
git clone https://github.com/yourusername/commander-tracker.git cd commander-tracker -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open your browser to
http://localhost:5173
Once the app is running or deployed, you can install it as a native app:
- Open the app in your mobile browser (Safari/Chrome)
- Tap the browser menu (share button on iOS, three dots on Android)
- Select "Add to Home Screen" or "Install"
- The app will appear on your home screen like a native app
- Look for the install icon in the address bar
- Click "Install Commander Tracker"
- The app will be installed and can be launched from your applications
- Works offline after initial load
- Full-screen experience without browser UI
- Faster launch times
- Native app-like behavior
- Setup: Configure number of players (3-4), starting life total, and timer duration using the increment/decrement buttons
- Start Game: Begin with animated starting player selection
- Track Life: Use the large +/- buttons positioned around the timer to adjust life totals
- Manage Turns: Use the blue center button to pass turns clockwise
- Commander Damage: Click "dmg" button on player cards to track commander damage in the modal
- Install as App: Use browser's "Add to Home Screen" or "Install" option for native app experience
- Fullscreen: Enable fullscreen mode for immersive mobile play
- Player Count: Choose between 3 or 4 players
- Starting Life: Adjust with -5, -1, +1, +5 buttons (all with consistent border styling)
- Timer Duration: Set minutes per player with matching control buttons
- Center Controls: Play/pause, reset, next player, and settings access
- Player Cards: Life adjustment buttons positioned around timer display
- Commander Damage: Dedicated "dmg" button for easy access to damage tracking modal
- Fullscreen Mode: Toggle fullscreen for mobile devices
- Game Settings: Return to setup menu
- React: Frontend framework with hooks for state management
- Tailwind CSS: Utility-first CSS framework for responsive design
- Lucide React: Modern icon library for UI elements
- Vite: Fast development build tool
src/App.jsx: Main application component containing all game logic and UIsrc/utils/constants.js: Player color schemes and game constantssrc/index.css: Global styles, Tailwind imports, and fullscreen optimization
The app uses a modern CSS Grid-based layout system that replaced the original absolute positioning approach:
.grid-container {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);
gap: clamp(1rem, 4vw, 2rem);
padding: clamp(0.5rem, 2vw, 1rem);
}- 3-Player: Uses grid cells [1,1], [1,2], [2,1] (top-left, bottom-left, top-right)
- 4-Player: Uses all four grid cells [1,1], [1,2], [2,1], [2,2]
- Alignment: Center-justified within each grid cell for consistent positioning
- Rotation: 90° for left side cards, -90° for right side cards
- Card Width:
clamp(250px, 35vw, 350px)- scales from mobile to desktop - Card Height:
clamp(140px, 18vh, 200px)- maintains aspect ratio - Grid Gaps: Responsive spacing prevents overlap on all screen sizes
- Content Scaling: All text and buttons use clamp() for proportional sizing
- ✅ Overlap Prevention: Grid system eliminates card overlap issues
- ✅ iPhone SE Compatibility: Verified on 375px width screens
- ✅ Cascading Layout Problems: No more sizing changes affecting positioning
- ✅ Center Control Sizing: Consistent button sizes across all devices
- Floating Number System: Individual animated life change indicators with proper rotation matching player cards
- Button Enhancements: Enhanced visual feedback for +/- life buttons with shadows, borders, and active states
- Rotation Fix: Fixed floating number orientation issues to properly match rotated player cards
- Animation Timing: 1.5-second float-up animations with proper CSS keyframes for each rotation (0°, 90°, -90°)
- No Haptic Feedback: Haptic feedback was implemented but removed due to compatibility issues
- Running Total System: Tried implementing accumulating floating numbers but reverted due to timing issues
- Haptic Feedback: Added vibration to center control buttons but removed due to site breakage
- 2-Second Timer Logic: Complex button press state tracking that caused animation problems
- Complete CSS Grid Migration: Replaced problematic absolute positioning with robust 2x2 CSS Grid
- Responsive Design Fix: Eliminated cascading layout issues that occurred when resizing elements
- Cross-Screen Compatibility: Cards now properly scale on all devices without overlap
- Improved Center Controls: Larger, more touch-friendly buttons (
p-4withw-6 h-6icons) - Smart Spacing System: Responsive gaps that adapt from mobile to desktop (
clamp(1rem,4vw,2rem)) - iPhone SE Support: Verified compatibility with smallest common screen size (375px width)
- Floating Life Change Indicators: Animated numbers appear when life totals change (+1, -1, +5, -5)
- Orientation-Aware Animation: Floating numbers rotate to match each player's card orientation
- Individual Number Display: Each button press creates separate floating animation
- Enhanced Button Visual Feedback: Improved +/- button styling with shadows, borders, and active states
- 1.5-Second Animation Duration: Numbers float upward and fade over 1.5 seconds
- PWA Support: Installable as native app with offline functionality
- Enhanced Fullscreen: Cross-browser fullscreen compatibility
- Commander Damage Modal: Improved spacing and user experience
- Touch Optimization: Better button sizing and interaction areas
- Touch-Friendly Interface: Minimum 44px touch targets on all interactive elements
- Fullscreen Experience: Native fullscreen mode with disabled scrolling
- Responsive Grid Layout: CSS Grid system that scales perfectly on all screen sizes
- iPhone SE Tested: Verified compatibility with smallest common mobile resolution (375px)
- Smart Spacing: Responsive margins that adapt to available screen space
- Optimized Card Rotation: Intuitive table view with properly sized rotated player cards
| Command | Description |
|---|---|
npm run dev |
Start development server with hot reload |
npm run build |
Create production build |
npm run preview |
Preview production build locally |
npm run lint |
Run ESLint for code quality checks |
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
MIT License
Happy Gaming! 🎲✨