Skip to content

Commit b57850d

Browse files
mariofarandaclaude
andcommitted
Pre-release cleanup and README update for v1.0.0
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 385e6c8 commit b57850d

23 files changed

Lines changed: 531 additions & 4393 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ data/
2727
# Private documentation (kept locally)
2828
docs/
2929

30+
# Archived unused source files (kept locally)
31+
archive/
32+
3033
# Environment variables
3134
.env.local
3235
.vercel

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Lightpath calculates the flight trajectory between any two airports and visualiz
1111
## What it does
1212

1313
- **Great circle routing** — Plots the shortest path between airports on a 3D globe
14+
- **Real flight trajectories** — Look up any flight by callsign to trace its actual route using historical flight data
1415
- **Solar illumination mapping** — Color-codes flight segments by daylight, twilight (civil/nautical/astronomical), and darkness
1516
- **Time animation** — Watch flights move through changing light as Earth rotates
1617
- **Astronomical accuracy** — Uses NOAA equations for solar declination and Jean Meeus algorithms for solar position
@@ -21,7 +22,7 @@ Lightpath calculates the flight trajectory between any two airports and visualiz
2122

2223
- **React 19** + **Three.js** for 3D rendering
2324
- **Vite** for build tooling
24-
- **solar-calculator** (NOAA) + **suncalc** (Jean Meeus) for astronomical calculations
25+
- **solar-calculator** (NOAA) + **suncalc** for astronomical calculations
2526
- **Custom GLSL shaders** for twilight visualization
2627

2728
---
@@ -30,26 +31,35 @@ Lightpath calculates the flight trajectory between any two airports and visualiz
3031

3132
- Real-time solar position calculation
3233
- Latitude-dependent twilight width modeling
34+
- Two search modes: airport-to-airport routing (Great Circle Routes) and flight number lookup
3335
- Animated flight playback with sun position sync
3436
- Color and black-and-white visualization modes
3537
- Shareable flight URLs
38+
- Optional overlays: airport dots, graticule, timezone boundaries, twilight lines
3639

3740
---
3841

3942
## Project structure
4043
```
4144
src/
42-
├── App.jsx # Main component
45+
├── App.jsx # Main component (3D scene, state, non-panel UI)
4346
├── App.css # All styles
4447
├── components/
4548
│ ├── AirportSearchInput.jsx
4649
│ ├── FlightInputPanel.jsx
47-
│ └── AnimationControls.jsx
50+
│ ├── AnimationControls.jsx
51+
│ └── ShareButton.jsx
52+
├── services/
53+
│ └── fr24.js # FlightRadar24 API client
4854
└── utils/
49-
├── geoUtils.js # Coordinate conversion
55+
├── geoUtils.js # Coordinate conversion + flight scaling
5056
├── solarUtils.js # Solar position calculations
5157
├── sceneUtils.js # Label texture generation
52-
└── animationUtils.js # Fade animations
58+
├── animationUtils.js # Fade animations
59+
├── routeInterpolation.js # Timestamp interpolation along arc-length
60+
├── captureUtils.js # Screenshot capture for share cards
61+
├── cardGenerator.js # Share card image generation
62+
└── shareUtils.js # Web Share API wrapper
5363
5464
scripts/
5565
└── build-airports.js # OurAirports CSV → airports.json
@@ -59,7 +69,7 @@ public/
5969
├── earth-texture.png # Custom Earth texture
6070
├── graticule-10.geojson # Latitude/longitude grid
6171
├── timezones.geojson # Timezone boundaries
62-
└── icons/ # SVG icons
72+
└── fonts/ # ABC Repro, ABC Repro Mono
6373
```
6474

6575
---
@@ -80,9 +90,10 @@ npm run build
8090
## Credits
8191

8292
Airport data: [OurAirports](https://ourairports.com/data/)
83-
Astronomical calculations: [solar-calculator](https://www.npmjs.com/package/solar-calculator) (NOAA) and [suncalc](https://github.com/mourner/suncalc) (Jean Meeus)
93+
Astronomical calculations: [solar-calculator](https://www.npmjs.com/package/solar-calculator) (NOAA) and [suncalc](https://github.com/mourner/suncalc) (Jean Meeus)
94+
Topography: [NASA](https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/topography-bathymetry-maps/)
8495

85-
Designed and developed by [Studio Folder](https:www.studiofolder.it)
96+
Designed and developed by [Studio Folder](https://www.studiofolder.it)
8697

8798

8899
---

docs/fr24-integration-plan.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
**Project**: Lightpath
44
**Feature**: Historical Flight Route Tracking
55
**Target**: v1.0.0 (currently v0.9.6)
6-
**Date**: 2026-03-20
7-
**Status**: Phase 4 complete (caching, deep links, date-independence implemented)
6+
**Date**: 2026-03-21
7+
**Status**: Phase 5 in progress (cleanup, error handling, UI polish started)
88
**Alternative approach**: `api-plan-adsbexchange.md` (ADSBexchange via RapidAPI, Feb 2026)
99

1010
---
@@ -589,12 +589,14 @@ Flight Summary Light is only needed to obtain the `fr24_id` and confirm the flig
589589

590590
4. **Vite proxy `flight_ended` filter** — ✅ FIXED. The local dev Vite custom middleware (`vite.config.js`) now replicates the full `flight-lookup.js` logic including the `flight_ended === true` filter. Local dev behavior matches production. The only difference is no Upstash Redis cache locally — every search hits FR24 live.
591591

592-
5. **Callsign resolved airports display styling**The resolved FROM/TO airports in callsign mode use inline `fontFamily: 'monospace'` styling (lines 304, 321 of FlightInputPanel.jsx) which doesn't match the route mode styling. Should use the same CSS classes as route mode's airport code display. Cosmetic issue for UI polish phase.
592+
5. **Callsign resolved airports display styling**✅ FIXED (2026-03-21). Replaced inline `fontFamily: 'monospace'` with `.callsign-airport-code` CSS class matching route mode's `.airport-columns.route-mode .input-group input` styling (ABCReproMono, 48px, weight 300, letter-spacing 2px). BW mode override and mobile breakpoint added. Color set to `rgba(255, 255, 255, 0.85)` for dark mode.
593593

594594
6. **`vercel.json` rewrite change** — Updated `/(.*) → /index.html` to `/((?!api/).*)` for `vercel dev` compatibility. This is a no-op in production (Vercel resolves functions before rewrites). Should be verified on production deploy.
595595

596596
7. **Serverless functions use `export default` (ES modules)** — Changed from `module.exports` (CommonJS) to `export default` due to `"type": "module"` in package.json. Works with both Vercel deployment and `vercel dev`. Verified.
597597

598+
8. **Flight mode shows great circle distance instead of real route distance** — ✅ FIXED (2026-03-20). In `handleCallsignStart()`, the displayed distance was computed as a great circle between origin/destination airports, identical to route mode. Now the real route distance is computed by sampling the CatmullRom curve (500 points via `getPointAt`) and summing haversine segment distances. The great circle distance is still used for camera positioning (`centerCameraOnFlight`) and plane icon scaling (`getFlightScale`), since those depend on the airport-to-airport span. The `results.distance` value now reflects the actual airway routing (typically 2–8% longer than great circle for transatlantic flights).
599+
598600
### Phase 4b: Caching & Date-Independence ✅
599601

600602
- [x] Create `api/flight-lookup.js` — merged serverless function that handles both summary + events in a single call, with Upstash Redis cache layer (see §8.2). Uses `@upstash/redis` package.
@@ -615,17 +617,31 @@ Flight Summary Light is only needed to obtain the `fr24_id` and confirm the flig
615617
- [x] Ensure `handleCallsignStart()` updates URL with the user-selected date/time after rendering: `navigate(\`/flight/${callsignInput}/${dt.toFormat('yyyy-MM-dd')}/${dt.toFormat('HHmm')}\`, { replace: true })`
616618
- [x] Update `main.jsx` routes: `/flight/:segment1/:date/:time` and `/flight/:callsign`
617619

618-
### Phase 5: Testing & Polish
620+
### Phase 5: Testing & Polish (in progress)
621+
622+
**Completed (2026-03-21):**
623+
- [x] Delete legacy `api/flight-search.js` and `api/flight-events.js` — superseded by `api/flight-lookup.js`, no longer called by client
624+
- [x] CSS refinement: `.callsign-airport-code` class matching route mode styling (both color and B&W themes)
625+
- [x] Fix date field click area — `onClick` added directly on hidden date `<input>` instead of parent div (z-index conflict)
626+
- [x] Error differentiation — `fr24.js` now throws typed errors (`rate_limited`, `server_error`, `request_failed`); `handleCallsignSearch()` shows specific user-facing messages for 429 / 5xx / generic errors
627+
- [x] Remove dead `buildControlPoints()` from `routeInterpolation.js` — was unused, `handleCallsignStart` builds control points inline
628+
- [x] Fix `flightDurationMs` rounding inconsistency — rendering useEffect now reads exact `totalDurationMs` from `flightDataRef.current.flightDurationMs` instead of recomputing from rounded hours/minutes (eliminates ~30s precision loss)
629+
- [x] Graceful fallback when events are insufficient — if `< 2` events with lat/lon, falls back to great circle via `calculateFlight()`
630+
- [x] Loading indicator — FIND button shows `'...'` with pulsing animation (`calculate-pill--loading`) during search
631+
- [x] Callsign error state — inline styles extracted to CSS classes (`.callsign-error`, `.callsign-error-message`, `.callsign-error-dismiss`) with BW mode overrides
632+
- [x] Callsign input layout — inline styles extracted to CSS classes (`.callsign-input-columns`, `.callsign-input-column`, `.callsign-find-row`)
633+
- [x] Mode toggle redesign (partial) — pill-shaped ROUTE/FLIGHT toggle with sliding indicator replaces h3 text. Uses `<span>` elements (not `<button>`) to avoid browser focus styling. Indicator animates via `transform: translateX`. Both themes implemented.
619634

635+
**In progress:**
636+
- [ ] Mode toggle header layout — three-element layout (h3 "Search" left, toggle centred, chevron right) not yet resolved; toggle positioning conflicts with collapse button placement
637+
638+
**Remaining:**
620639
- [ ] Test with diverse flights (short-haul, long-haul, polar, domestic)
621-
- [ ] Tune CatmullRom tension parameter
640+
- [ ] Tune CatmullRom tension parameter (currently 0.0 default; `CATMULLROM_TENSION` constant extracted for easy tuning)
622641
- [ ] Verify visual quality at different zoom levels
623642
- [ ] Edge cases: diverted flights, cancelled flights, no events
624643
- [ ] Performance: verify no rendering regression
625644
- [ ] Capture/share: verify ShareButton works with event-based routes
626-
- [ ] CSS refinement for callsign mode UI elements (both color and B&W modes)
627-
- [ ] Graceful fallback when events are insufficient (great circle between Summary airports)
628-
- [ ] Error differentiation (429 rate limit vs 5xx API error vs not found)
629645

630646
### Phase 6: Credit Monitoring (Post-Launch)
631647

@@ -747,29 +763,44 @@ On Explorer tier (30,000 credits/month): without cache, ~1,875 unique lookups. W
747763

748764
---
749765

750-
## 9a. Complete File Inventory (as of 2026-03-20)
766+
## 9a. Complete File Inventory (as of 2026-03-21)
751767

752768
### New files created:
753769
```
754770
api/flight-lookup.js # Merged serverless function: summary + events + Upstash Redis cache (implemented)
755-
api/flight-search.js # Legacy: Vercel serverless proxy → FR24 Flight Summary Light (deprecated, kept for reference)
756-
api/flight-events.js # Legacy: Vercel serverless proxy → FR24 Historic Events Light (deprecated, kept for reference)
757-
src/services/fr24.js # Client-side API calls (lookupFlight with in-memory cache)
758-
src/utils/routeInterpolation.js # buildControlPoints + interpolateTimestamp (with arc-length-aware interpolation)
771+
src/services/fr24.js # Client-side API calls (lookupFlight with in-memory cache, typed errors)
772+
src/utils/routeInterpolation.js # interpolateTimestamp (with arc-length-aware interpolation)
759773
tests/fr24-sandbox-test.mjs # Standalone sandbox API test (not committed)
760774
tests/fr24-production-test.mjs # Standalone production API test (not committed)
761775
```
762776

777+
### Deleted files:
778+
```
779+
api/flight-search.js # Legacy: deleted 2026-03-21, superseded by flight-lookup.js
780+
api/flight-events.js # Legacy: deleted 2026-03-21, superseded by flight-lookup.js
781+
```
782+
763783
### Modified files:
764784
```
765785
src/App.jsx # searchMode state, callsign state/refs, handleCallsignSearch/Start,
766786
# rendering branch (SLERP vs CatmullRom with getPointAt + sphere normalization),
767787
# airportsIcao lookup, arc-length fractions, calculateFlight clears callsign refs,
768788
# deep-link useEffect for /flight/:callsign/:date/:time,
769789
# editable datetime pill in callsign mode,
770-
# relative timing model (user-chosen date + offsets)
771-
src/components/FlightInputPanel.jsx # Header mode toggle, callsign input/FIND, resolved airports display,
772-
# error state, editable datetime pill, CALCULATE/START conditional text
790+
# relative timing model (user-chosen date + offsets),
791+
# error differentiation (rate_limited, server_error, request_failed),
792+
# flightDurationMs precision fix, graceful fallback for insufficient events,
793+
# CATMULLROM_TENSION constant
794+
src/App.css # .callsign-airport-code (matching route mode styling),
795+
# .callsign-error / .callsign-error-message / .callsign-error-dismiss,
796+
# .callsign-input-columns / .callsign-input-column / .callsign-find-row,
797+
# .calculate-pill--loading animation,
798+
# .mode-toggle / .mode-toggle-indicator / .mode-toggle-btn (pill toggle),
799+
# BW mode overrides for all new classes
800+
src/components/FlightInputPanel.jsx # Pill-shaped mode toggle (ROUTE/FLIGHT with sliding indicator),
801+
# h3 "Search" title, callsign input/FIND, resolved airports display,
802+
# error state with CSS classes, editable datetime pill,
803+
# date picker onClick fix, loading indicator on FIND button
773804
vite.config.js # Custom configureServer middleware for local dev (/api/flight-lookup)
774805
vercel.json # SPA rewrite updated with negative lookahead to exclude /api/
775806
src/main.jsx # Routes: /, /flight/:segment1/:date/:time, /flight/:callsign

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default defineConfig([
2323
},
2424
},
2525
rules: {
26-
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
26+
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]', argsIgnorePattern: '^_' }],
2727
},
2828
},
2929
])

package-lock.json

Lines changed: 0 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lightpath",
3-
"version": "0.9.6",
3+
"version": "1.0.0",
44
"private": true,
55
"type": "module",
66
"scripts": {

public/clouds-alpha.png

-35.4 MB
Binary file not shown.

public/content/data.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
- Airports: [OurAirports](https://github.com/davidmegginson/ourairports-data)
33
- Timezones: [tz-lookup](https://github.com/darkskyapp/tz-lookup-oss)
44
- Coastline: [GSHHG/NOAA](https://www.ngdc.noaa.gov/mgg/shorelines/shorelines.html)
5+
- Topography: [NASA](https://science.nasa.gov/earth/earth-observatory/blue-marble-next-generation/topography-bathymetry-maps/)
56
- Graticule: [Natural Earth](https://www.naturalearthdata.com/)
67

8+
## Flights
9+
- Historic flight data: [Flightradar24](https://fr24api.flightradar24.com/)
10+
711
## Libraries
8-
[Three.js](https://github.com/mrdoob/three.js/), [React](https://react.dev/), [Luxon](https://github.com/moment/luxon/), [SunCalc](https://cran.r-project.org/web/packages/SunCalcMeeus/index.html)
12+
[Luxon](https://github.com/moment/luxon/), [SunCalc](https://cran.r-project.org/web/packages/SunCalcMeeus/index.html), [Three.js](https://github.com/mrdoob/three.js/), [React](https://react.dev/)
913

1014
## Typography
1115
[ABC Repro](https://abcdinamo.com/typefaces/repro), [LL Rephlex](https://lineto.com/typefaces/rephlex)

public/earth-bump.jpg

3.37 MB
Loading

public/earth-bump.png

-2.32 MB
Binary file not shown.

0 commit comments

Comments
 (0)