This file provides guidance to Codex (Codex.ai/code) when working with code in this repository.
npm run dev- Start development server with Vitenpm run build- Build for productionnpm run lint- Run ESLintnpm run typecheck- Run TypeScript type checkingnpm start- Start production server via Netlify
The project has a custom pre-build process:
npm run compile:hyphenate- Compiles TypeScript hyphenation scriptnpm run rename:hyphenate- Renames output to .cjs formatnode dist/scripts/hyphenate.cjs- Processes hyphenation dataremix vite:build- Main Remix build
This is a Remix application with Vite that builds a roadtrip bingo game. Key architectural elements:
- Remix - Full-stack React framework with file-based routing
- Vite - Build tool and dev server
- TypeScript - Type safety
- Tailwind CSS v4 - Styling with @tailwindcss/vite plugin
- Netlify - Deployment platform with @netlify/remix-adapter
app/routes/- Remix file-based routes (_index.tsx,bingo.tsx)@/components/- React components organized by feature:bingo/- Core game components (BingoGrid, BingoCell, BingoHeader, etc.)landing/- Landing page components (IntroCarousel, LanguageSwitcher, forms)shared/- Reusable components (Header, ErrorFallback, NeonText, QRCodeSVG)ui/- Base UI components (button, drawer, dialog, tabs, etc.)
@/lib/- Core utilities and business logic:utils.ts- Game state management (loadGameState, saveGameState, checkBingo)generateBingoGrid.ts- Deterministic grid generation using SHA-1 hashingthemes.ts- Theme definitions with gradient and color configurationsanalytics.ts- Event tracking to Supabase edge functionconstants.ts- Bingo patterns and default game state
app/content/i18n/- Internationalization contentapp/items/- Game data:items.json- Source game items with translationsitems.ts- Generated file with hyphenated text (auto-generated, do not edit manually)
app/scripts/- Build-time scripts:hyphenate.ts- Processes items.json and generates items.ts with soft hyphens for all languages
- Multilingual Support - Swedish, English, French, German, Spanish, Italian, Finnish, Norwegian, Danish
- Theme System - Dynamic theming with gradient backgrounds and coordinated colors
- Game State Management - React useReducer with localStorage persistence
- Responsive Design - Mobile-first with drawer components for settings
- Hyphenation - Build-time processing of hyphenation patterns for multiple languages
- Game state uses React useReducer pattern in
bingo.tsxwith actions for:LOAD_STATE- Initialize from localStorageMARK_ITEM/UNMARK_ITEM- Toggle bingo cell states (stores SHA-1 hash of item)CLEAR_ITEMS- Reset game boardSET_THEME- Change visual theme
- Persistent storage via localStorage key
game_statewith cleanup of legacy formats - State shape:
{ theme: ThemeName, markeditems: (string | 0)[] }where strings are SHA-1 hashes - Bingo detection checks rows, columns, and diagonals using patterns from
@/lib/constants.ts
- Uses
@/path alias configured viavite-tsconfig-pathsfor clean imports - Functional components with hooks
- Theme classes passed down via props for consistent styling (avoids prop drilling via explicit theme prop)
- Error boundaries at route and component levels for graceful failure handling
- Drawer components (from
vaul) used for mobile-friendly settings panels
- Uses deterministic SHA-1 hash of seed string to generate consistent bingo grids
- Hash is converted to byte array, each byte mod item count selects an item
- Ensures uniqueness by tracking used indices with a Set
- Falls back to sequential selection if hash doesn't provide enough unique items
- Grid is generated server-side in loader and passed to client
- Custom analytics system sending events to Supabase edge function at
/functions/v1/analytics - Tracks: page views, game start/complete, theme changes, user interactions
- Session ID stored in sessionStorage, anonymous user ID in localStorage
- Event payload includes app name, session ID, user ID, pathname, search params, referrer
- Environment variables:
VITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEY(defaults provided in code)
@radix-ui/*- Accessible UI primitives (dialog, select, tabs, scroll-area)lucide-react- Icon libraryreact-rewards- Confetti animation for bingo winsqrcode.react- QR code generationhypher+ language packs (hyphenation.{en-us,sv,de,fr,es,it,fi,nb-no,da}) - Text hyphenationjs-sha1- SHA-1 hashing for deterministic grid generationvaul- Drawer component for mobile UIclass-variance-authority,clsx,tailwind-merge- Styling utilities