Gold Betting Demo - Mobile UI Guide
This guide documents the mobile-responsive UI overhaul completed in February 2026 (PR #942).Overview
The gold betting demo now features a fully responsive mobile-first UI with:- Resizable panels on desktop (drag to resize)
- Bottom-sheet sidebar on mobile (touch-friendly)
- Live SSE feed from game server (replaces mock data in dev mode)
- Dual wallet support (SOL + EVM) with mobile-optimized layout
- Real-time duel streaming with agent stats overlay
Mobile Layout Features
Responsive Breakpoints
The UI adapts to screen size using theuseIsMobile hook:
- JavaScript inline styles are gated (CSS media queries control layout)
- Bottom-sheet sidebar replaces side-by-side panels
- Stacked header layout (logo above phase strip)
- Touch-friendly tab targets (48px minimum)
dvhunits for proper mobile viewport height
Video Player
Desktop:- Resizable panels with drag handles
- Video + sidebar side-by-side
- Minimum 400px video width
- Fixed 16:9 aspect ratio video
- Full-width video at top
- Bottom-sheet sidebar below
- No resize handles (CSS controls layout)
Header Layout
Desktop:- Horizontal layout:
HYPERSCAPE | MARKETlogo, phase strip, wallet buttons - Tabs below header (Trades, Leaderboard, Points, Referrals)
- Stacked layout:
HYPERSCAPElogo (centered)MARKETsubtitle (centered)- Phase strip above video (full width)
- SOL wallet button (full width)
- EVM wallet button (full width)
- Tabs reordered: Trades first (most important on mobile)
Sidebar Tabs
Tab Order (Mobile-Optimized):- Trades - Recent trades and order book (most important)
- Leaderboard - Top traders by points
- Points - User points and history
- Referrals - Referral links and rewards
Real Data Integration
SSE Feed (Server-Sent Events)
Development Mode (bun run dev):
- Connects to live SSE feed from game server
- Endpoint:
http://localhost:5555/api/streaming/state/events - Real-time duel updates, agent stats, HP bars
bun run dev:stream-ui):
- Uses mock streaming engine for UI development
- No game server required
- Simulated duel data for testing layouts
AppRoot.tsx):
Data Flow
- Game Server → SSE endpoint (
/api/streaming/state/events) - Client →
useDuelContext()hook subscribes to SSE - Components → Consume real-time state:
- Agent HP bars
- Combat stats (hits, damage, accuracy)
- Phase transitions (IDLE, COUNTDOWN, FIGHTING, ANNOUNCEMENT)
- Market status (open, locked, resolved)
Keeper Database Persistence
The keeper bot now includes a persistence layer (keeper/src/db.ts) for tracking:
- Market history
- Bet records
- Resolution outcomes
- Fee collection
.env.example):
Development Modes
Local Development (Real Data)
- Solana test validator with programs deployed
- Mock GOLD mint + funded test wallet
- Vite dev server at
http://127.0.0.1:4179 - Real SSE feed from game server (if running)
bun run dev:stream-ui
Stream UI Development (Mock Data)
- Vite dev server with mock streaming engine
- Simulated duel data (no game server required)
- Useful for UI development and layout testing
Production Modes
Mobile Testing
Browser DevTools
- Open Chrome DevTools (F12)
- Click device toolbar icon (Cmd+Shift+M / Ctrl+Shift+M)
- Select device preset:
- iPhone 12 Pro (390x844)
- iPhone 14 Pro Max (430x932)
- iPad Air (820x1180)
- Galaxy S20 (360x800)
Physical Device Testing
iOS (via Tauri):- Find your local IP:
ipconfig getifaddr en0(Mac) orhostname -I(Linux) - Start dev server:
bun run dev - Open
http://YOUR_IP:4179on mobile device
Responsive Design Patterns
useResizePanel Hook
Desktop-only resizable panels:CSS Media Queries
Mobile-specific styles (gated by!isMobile in JS):
Touch-Friendly Targets
All interactive elements meet 48px minimum touch target:Component Updates
StreamPlayer.tsx
Changes:- Removed
isStreamUIModechecks (mode routing now in AppRoot.tsx) - Always uses real SSE feed in dev mode
- Mock data only in stream-ui mode
Sidebar.tsx
Changes:- Responsive layout with
useIsMobilehook - Bottom-sheet on mobile, side panel on desktop
- Tab reordering (Trades first on mobile)
AgentStats.tsx
Changes:- Upgraded HP bars with gradient fills
- Real-time stat updates from SSE feed
- Mobile-optimized spacing and font sizes
Trade Interface
New Field:trader field to Trade interface
Testing Checklist
Desktop (Chrome/Edge/Safari)
- Video resizes smoothly with drag handle
- Sidebar maintains minimum 300px width
- Tabs switch without layout shift
- Wallet buttons fit in header
- Phase strip displays correctly
Mobile (< 768px)
- Video maintains 16:9 aspect ratio
- Sidebar appears below video (not side-by-side)
- Header stacks vertically (logo, phase, wallets)
- Tabs are touch-friendly (48px height)
- No horizontal scrolling
- Bottom-sheet tabs swipe smoothly
Tablet (768px - 1024px)
- Layout switches to desktop mode at 768px
- Resize handles appear
- Sidebar returns to side-by-side layout
Data Integration
- SSE feed connects in dev mode
- Agent HP bars update in real-time
- Combat stats reflect actual game state
- Phase transitions trigger UI updates
- Market status syncs with game server
Implementation Details
Files Changed (PR #942)
Frontend:app/src/App.tsx- Removed simulation mode checksapp/src/AppRoot.tsx- Mode routing (stream-ui vs dev)app/src/components/StreamPlayer.tsx- Real SSE feed integrationapp/src/components/Sidebar.tsx- Responsive layoutapp/src/components/AgentStats.tsx- Upgraded HP barsapp/src/lib/useResizePanel.ts- New hook for resizable panelsapp/src/lib/useMockStreamingEngine.ts- Mock data for stream-ui mode
keeper/src/db.ts- Database persistence layerkeeper/.env.example- Database configuration
- Mobile-first CSS with media queries
dvhunits for proper mobile viewport- Touch-friendly spacing (48px minimum)
Breaking Changes
Mode Environment Variable:MODE=stream-ui→ StreamUIApp (mock data)MODE=devnetor any other → App (real SSE feed)
isStreamUIModeprop passed through components- Mock data mixed with real data in dev mode
- Mode routing at app root (AppRoot.tsx)
- Clean separation: stream-ui = mock, dev = real
- No mode checks in child components
Future Improvements
Planned:- Swipe gestures for tab navigation on mobile
- Pull-to-refresh for market data
- Haptic feedback for bet placement
- Offline mode with cached data
- Progressive Web App (PWA) support
- Virtual scrolling for large trade lists
- Lazy loading for historical data
- Image optimization for agent avatars
- Service worker for asset caching
Related Documentation
- Main README:
packages/gold-betting-demo/README.md - Deployment:
docs/betting-production-deploy.md - Duel Stack:
docs/duel-stack.md - Keeper Bot:
packages/gold-betting-demo/keeper/README.md
Commit Reference
- PR #942: Mobile-responsive UI overhaul + real-data integration
- Commit:
210f6bd(February 26, 2026) - Author: SYMBiEX