How taibeled/jetlaghideandseek works
Purpose and Entry Points
This is a client-side interactive map generator for evaluating Hide and Seek locations in *Jet Lag: The Game*. Astro hosts the application shell; React/TSX components provide the interactive UI. The primary entry route is src/pages/index.astro, wrapped by src/layouts/Layout.astro; PWA setup is in src/pwa.ts.
Application Composition
src/components/Map.tsx is the central map-facing UI, coordinating rendered map state, overlays, and user interactions. Supporting controls collect locations and geometry (src/components/PlacePicker.tsx, src/components/PolygonDraw.tsx, src/components/DraggableMarkers.tsx) and expose map-specific operations such as printing and fullscreen (src/components/MapPrint.tsx, src/components/LeafletFullScreenButton.tsx).
State, Setup, and Question Selection
Shared application context is defined in src/lib/context.ts. Question configuration is presented through the sidebar/card layer: src/components/QuestionSidebar.tsx, src/components/QuestionCards.tsx, and src/components/cards/base.tsx. Initialization, built-in presets, and user-defined presets form a separate configuration boundary in src/components/CustomInitDialog.tsx, src/components/PresetsDialog.tsx, and src/components/CustomPresets.tsx.
Question Evaluation Domain
The question engine is organized by gameplay category under src/maps/questions/: matching, measuring, radius, thermometer, and tentacles (src/maps/questions/matching.ts, src/maps/questions/measuring.ts, src/maps/questions/tentacles.ts). These modules turn selected question parameters and geographic datasets into map-visible eligibility/measurement results. Shared domain schemas and exports reside in src/maps/schema.ts and src/maps/index.ts, providing a boundary between React presentation and geospatial computation.
Geospatial Processing Pipeline
Reusable spatial algorithms are isolated from UI and external requests in src/maps/geo-utils/. Operators and special-case logic (src/maps/geo-utils/operators.ts, src/maps/geo-utils/special.ts) support transformations and filtering; station-specific processing is in src/maps/geo-utils/stationManipulations.ts; Voronoi calculations are in src/maps/geo-utils/voronoi.ts. User-drawn or picked points, lines, and polygons flow into this layer, then into question evaluators and map overlays.
Data Access and External Boundaries
src/maps/api/index.ts is the map-data access facade. It separates geocoding, Overpass queries, imports, and caching (src/maps/api/geocode.ts, src/maps/api/overpass.ts, src/maps/api/cache.ts) from calculation code. Geographic input/output types and constants are centralized in src/maps/api/types.ts and src/maps/api/constants.ts. The checked-in coastline dataset, public/coastline50.geojson, is a local geospatial dependency for coastline-distance questions. External map/geographic services are consumed through the API layer rather than UI components.
Runtime and Delivery
The project runs on Node.js with pnpm and is built as an Astro application configured by astro.config.mjs; TypeScript React components constitute the interactive runtime. Styling is global/Tailwind-based (src/styles/globals.css, tailwind.config.mjs). Deployment automation is defined in .github/workflows/deploy.yml. The PWA module indicates installable/offline-oriented browser delivery, while runtime geographic lookup remains an external-service boundary.
Main entry points: Map.tsx Interactive map · context.ts Shared app context · index.ts Map data facade · index.astro Home route
Components 20
Astro & UI
Browser application shell and interactive controls.
- Home route · Primary application entry point.
src/pages/index.astro - Application layout
src/layouts/Layout.astro - Interactive map · Coordinates map state, overlays, and interactions.
src/components/Map.tsx - Location & geometry input · Place picking, polygon drawing, and draggable markers.
- Map operations · Print and fullscreen map actions.
Configuration
Shared state, question selection, and presets.
- Shared app context · Holds shared application state.
src/lib/context.ts - Question selection · Presents question configuration.
- Initialization & presets · Provides built-in and user-defined setups.
Map Domain
Question evaluation and spatial computation.
- Map domain boundary · Separates presentation from geospatial computation.
- Question evaluators · Computes eligibility and measurements by question category.
- Spatial algorithms · Transforms and filters user geography for evaluation.
- Station processing
src/maps/geo-utils/stationManipulations.ts - Voronoi calculation
src/maps/geo-utils/voronoi.ts
Geographic Data
External lookup facade and local geographic assets.
- Map data facade · Isolates external geographic requests, imports, and caching.
src/maps/api/index.ts - Geocoding, Overpass & cache
- Geographic contracts
- Coastline dataset · Local dependency for coastline-distance questions.
public/coastline50.geojson
Delivery
Build, styling, PWA, and deployment.
- PWA setup · Supports installable and offline-oriented delivery.
src/pwa.ts - Astro build & styling · Astro application and global Tailwind styling.
- Deployment workflow
.github/workflows/deploy.yml
Connections 22
- Home route → Application layout: renders within
- Application layout → Interactive map: hosts
- Interactive map → Shared app context: reads and updates
- Question selection → Shared app context: configures
- Initialization & presets → Shared app context: initializes
- Shared app context → Interactive map: drives UI state
- Location & geometry input → Interactive map: supplies geometry
- Map operations → Interactive map: acts on
- Interactive map → Map domain boundary: requests evaluation
- Shared app context → Map domain boundary: supplies parameters
- Map domain boundary → Question evaluators: routes questions
- Question evaluators → Spatial algorithms: uses spatial operations
- Spatial algorithms → Station processing: includes
- Spatial algorithms → Voronoi calculation: includes
- Question evaluators → Map data facade: loads geographic data
- Map data facade → Geocoding, Overpass & cache: delegates requests
- Map data facade → Geographic contracts: uses contracts
- Question evaluators → Coastline dataset: uses for distance rules
- Question evaluators → Interactive map: returns overlays
- Astro build & styling → Home route: builds
- PWA setup → Home route: enables browser delivery
- Deployment workflow → Astro build & styling: deploys build