# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
Black Canyon Tickets React Rebuild is a frontend-only React application focused on learning modern UI/UX patterns. This is a complete rebuild using React 18, TypeScript, and Tailwind CSS with a sophisticated glassmorphism design system. The project serves as a production-ready demo of premium ticketing platform interfaces without live database or payment integrations.
**🚨 IMPORTANT: Check REBUILD_PLAN.md for current status and Phase 3 roadmap before making any changes.**
## Development Commands
```bash
# Development
npm run dev # Start development server at localhost:5173
npm run build # Type check and build for production
npm run preview # Preview production build locally
# Code Quality
npm run lint # Run ESLint on codebase
npm run lint:fix # Run ESLint with auto-fix
npm run typecheck # Run TypeScript type checking
npm run quality # Run all quality checks (typecheck + lint + format:check)
npm run quality:fix # Run all quality fixes (typecheck + lint:fix + format)
# Testing
npm run test # Run Playwright end-to-end tests
npm run test:ui # Run tests with Playwright UI
npm run test:headed # Run tests with visible browser
npm run test:qa # Run QA test suite with screenshots
npm run test:smoke # Run smoke tests for critical paths
npm run test:auth # Run authentication flow tests
npm run test:theme # Run theme switching tests
npm run test:responsive # Run responsive design tests
npm run test:components # Run component interaction tests
# Formatting
npm run format # Format code with Prettier
npm run format:check # Check code formatting
```
## Tech Stack
### Core Technologies
- **React 18** with TypeScript for strict typing and modern patterns
- **Vite** for lightning-fast development builds and HMR
- **Tailwind CSS** with comprehensive design token system
- **React Router v6** for client-side routing with protected routes
- **Zustand** for lightweight, scalable state management
### UI/Animation Libraries
- **Framer Motion** for smooth animations and micro-interactions
- **Lucide React** for consistent, scalable SVG icons
- **React Hook Form** with Zod validation for type-safe forms
- **Date-fns** for date manipulation and formatting
### Development Tools
- **TypeScript** with strict configuration and path aliases
- **ESLint** with comprehensive React/TypeScript/accessibility rules
- **Prettier** with Tailwind plugin for code formatting
- **Playwright** for end-to-end testing with visual regression
## Architecture
### Design Token System
Comprehensive CSS custom property system supporting:
- **Dual Theme Support**: Automatic light/dark mode with system preference detection
- **Semantic Colors**: Background, text, border, and accent colors with proper contrast ratios
- **Typography Scale**: Consistent font sizes, weights, and line heights
- **Spacing System**: 8px grid-based spacing tokens
- **Glass Effects**: Backdrop blur and transparency utilities
- **Animation Tokens**: Consistent timing functions and keyframes
### Component Architecture
- **Atomic Design**: Reusable primitives (Button, Input) composed into complex organisms
- **Token-Based Styling**: All components use design tokens for consistent theming
- **TypeScript Interfaces**: Strict typing for props, state, and component APIs
- **Error Boundaries**: Graceful error handling at component and route levels
- **Accessibility First**: WCAG AA compliance built into all components
### Route Structure
```
/ or /dashboard - Protected dashboard with event overview
/events - Event management interface (events:read permission)
/tickets - Ticket management (tickets:read permission)
/customers - Customer management (customers:read permission)
/analytics - Analytics dashboard (analytics:read permission)
/settings - User account settings
/admin/* - Admin panel (admin role required)
/login - Authentication portal
/home - Public homepage
/showcase - Design system showcase
/docs - Theme documentation
```
### Mock Authentication System
Role-based access control with three tiers:
- **User**: Basic event access and ticket purchasing
- **Admin**: Event management and organization features
- **Super Admin**: Full platform administration
## File Structure
```
src/
├── components/
│ ├── ui/ # Reusable UI primitives
│ │ ├── Button.tsx # Primary action component with variants
│ │ ├── Input.tsx # Form input with validation states
│ │ ├── Card.tsx # Container component with glass effects
│ │ ├── Alert.tsx # Status message component
│ │ ├── Badge.tsx # Small status indicators
│ │ └── Select.tsx # Dropdown selection component
│ ├── layout/ # Layout and navigation
│ │ ├── AppLayout.tsx # Main application layout wrapper
│ │ ├── Header.tsx # Top navigation with user menu
│ │ ├── Sidebar.tsx # Collapsible navigation sidebar
│ │ └── MainContainer.tsx # Content area with proper spacing
│ ├── auth/ # Authentication components
│ │ └── ProtectedRoute.tsx # Route guards with permission checks
│ ├── loading/ # Loading states and skeletons
│ ├── errors/ # Error boundaries and fallback UI
│ ├── events/ # Event-related components
│ ├── tickets/ # Ticketing and purchase components
│ ├── checkout/ # Purchase flow components
│ ├── billing/ # Payment and fee breakdown
│ └── scanning/ # QR scanning components
├── pages/ # Route components
├── contexts/ # React Context providers
├── hooks/ # Custom React hooks
├── types/ # TypeScript type definitions
├── design-tokens/ # Design system token definitions
└── styles/ # CSS files and utilities
```
## Design System
### Theme Configuration
The application supports automatic theme switching with:
- **CSS Custom Properties**: Token-based design system in `/src/design-tokens/`
- **Tailwind Integration**: All tokens available as Tailwind utilities
- **WCAG AA Compliance**: 4.5:1+ contrast ratios across all color combinations
- **Glass Effects**: Sophisticated backdrop blur and transparency patterns
### Component Usage Patterns
```tsx
// Design token-based styling
// Glass effect utilities