Skip to content

AnselZeng/red-eye

Repository files navigation

Red Eye Airlines

Live Application: https://red-eye-airlines.vercel.app/

A Pomodoro-style study timer reimagined as an airline flight experience. Study sessions become flights between airports around the world, with layovers serving as break intervals. Track your study progress as you "fly" to your destination.

🎯 Concept

Red Eye Airlines gamifies the Pomodoro technique by transforming study sessions into flight journeys. Instead of traditional timers, you:

  • Choose your route - Select departure and arrival airports worldwide
  • Plan your flight - Configure study intervals (30min or 50min segments) with breaks
  • Select your seat - Pick from a realistic airplane cabin layout
  • Board and fly - Watch your progress as you travel with real-time flight tracking
  • Complete your journey - Save completed flights to your profile history

✈️ Core Features

Flight Planning

  • Airport search: 1000+ airports (IATA codes, cities, names)
  • Suggested routes: Pre-configured flights (SFO→LAX, AMS→VIE, YYZ→SLC)
  • Path generation: Haversine-based routing with geographic optimization

Study Intervals

  • Direct: No breaks (≤30 min routes only)
  • 30-min: 30min study, 5min break (70%) or 4-7min (30%)
  • 50-min: 50min study, 9-11min break (70%) or 8-14min (30%)
  • Dynamic layover selection to match interval constraints

Boarding Pass

  • 3D flip animation with flight details
  • Random codes: flight number (2 letters + 4 digits), confirmation (6 letters), barcode
  • Route visualization for multi-segment flights

Seat Selection

  • Cabin: 24 rows × 7 seats (A-G with aisles)
  • Special rows: Premium (1-5), exit (10, 20), wing (12-19)
  • Random occupancy (5-18%), amenity zones

In-Flight Timer

  • Progress bar with segment markers, time remaining, elapsed counter
  • Segment status with progress %, next segment preview
  • Timeline view: color-coded segments (completed/current/upcoming)
  • Pause/resume with localStorage persistence and cross-tab sync

User Profiles

  • Public directory: profile pics, names, home airports, join dates
  • Profile pages: flight history, boarding pass viewer, statistics, editing
  • Flight history: grid view with modals, bulk delete

🏗️ Technical Architecture

Frontend Stack

  • Next.js 14 - React framework with App Router
  • TypeScript - Full type safety throughout
  • Tailwind CSS - Utility-first styling
  • Framer Motion - Animations and transitions
  • Lucide React - Icon library

Frontend Implementation

State Management:

  • localStorage for flight data (currentFlight) and timer state (flightTimerState)
  • React hooks (useState, useEffect, useCallback, useMemo)
  • Custom events for cross-component sync
  • Automatic state recovery on page refresh

Flight Path Algorithm:

  • Haversine formula for great-circle distance
  • Flight time estimation (800 km/h average speed)
  • Geographic interpolation for layover selection
  • Detour minimization (max 50% of direct distance)
  • Segment duration constraints (21-39min for 30min, 41-59min for 50min)
  • Scoring: duration accuracy and route alignment

Airport Data:

  • OpenFlights database (1000+ airports)
  • Caching: 24-hour localStorage + server-side API (/api/airports)
  • Nominatim geocoding for state/province
  • Custom name overrides JSON

Backend Stack

  • Supabase - BaaS
    • Authentication (email/password with username lookup)
    • PostgreSQL database with RLS policies
    • Storage bucket for profile pictures
    • Server-side API routes

Database Schema

Profiles Table:

  • User auth integration, username (unique), display name
  • Profile picture URL, home airport code
  • Auto-updating timestamps (database trigger)

Flights Table:

  • User association, departure/arrival details
  • Flight path (JSONB) with complete route segments
  • Seat assignment, duration, flight/confirmation codes
  • Completion timestamp

Security & Automation:

  • RLS policies (public read, user-specific write)
  • Auto-profile creation on signup
  • Auto-updating timestamps (database triggers)

Image Processing:

  • HEIC/HEIF → JPEG conversion
  • Sharp library (primary) with heic-convert fallback
  • Supabase Storage with automatic cleanup

📸 Application Screenshots

Flight Search Flight Path Selection Flight Path Options
Seat Selection Seat Map Boarding Pass
In-Flight Timer Flight Progress Profile Page

🚀 Future Features

In Development

  • Study Together: Invite friends to join your flight (1-5 people max)
    • Real-time seat selection synchronization
    • Shared flight timer
    • Group progress tracking

Planned Features

  • Interactive World Map:
    • Visual airport selection on globe
    • Flight path visualization
    • Real-time airplane position during study sessions
  • 3D Flight Visualization:
    • Google Maps 3D integration
    • Animated airplane movement
    • Terrain and city views
  • Enhanced Statistics:
    • Study streak tracking
    • Total study hours
    • Most frequented routes
    • Achievement system

📝 License

MIT

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages