pilot-toolkit-web/doc/README.md

85 lines
4.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Pilot's Toolkit — Web
A collection of aviation utilities for flight crews, built with React and Vite. Single-page application designed for browser-based cockpit use and future Docker deployment.
**Not for operational use — verify all calculations independently.**
---
## Modules
- **Fuel Order Calculator** — Fuel quantity in US/imperial gallons and liters with ASTM D1250 Table 6B density correction and ambient temperature adjustment.
- **Pavement Strength / ESWL** — ACN/ACR calculation with PCN/PCR comparison, rigid/flexible pavement types, four subgrade categories. Reverse-solves maximum allowable weight when pavement is exceeded.
- **Crosswind Calculator** — Headwind, tailwind, and crosswind components from wind direction/speed and runway heading. Auto-formats five-digit wind input on blur.
- **Fuel Buckets** — Stage length vs. fuel burn schedule with slider interpolation. Supports operator-specific CSV and JSON profile import.
- **HF Frequencies** — Active ARINC HF assignments for Atlantic and Pacific with staleness indicator.
- **Passdown** — Crew changeover form with local storage, autocomplete, history, batch .ptz export, email compose via `mailto:`, and stale-record detection on send.
- **Flight Level ↔ Meters** — ICAO meters-to-feet conversion table and China RVSM FLAS with directional filtering.
- **Crew Rest** — Augmented operations rest calculator for 34 pilots. Equal-division sequential rest rotation with lock toggle to prevent accidental edits mid-flight.
## Project Structure
```
pilot-toolkit-web/
package.json ← Dependencies and scripts
vite.config.js ← Vite + React plugin
index.html ← Entry HTML
src/
main.jsx ← React root mount
toolkit.jsx ← All eight modules (~3,600 lines)
data/
reference.json ← Flight levels, subgrade labels
aircraft/
G450.json ← Per-airframe data
G500.json
G650.json
G700.json
```
## Data Architecture
All aircraft and reference data lives in JSON files under `src/data/`. Vite imports these statically at build time — they are tree-shaken into the production bundle.
- **`reference.json`** — Airframe-agnostic: meters-to-feet table (107 entries), China FLAS (50 entries), RVSM direction sets, pavement subgrade labels.
- **`aircraft/*.json`** — One file per airframe: weight limits, ESWL config (formula or thresholds), PCN/PCR linear regression coefficients, fuel bucket schedules. Each file is imported individually in `toolkit.jsx` and wrapped in a `loadAircraft()` call with error handling.
Each aircraft file loads independently. A parse failure is caught and logged to `dataLoadErrors` — it does not crash the app or affect other airframes.
**Adding a new airframe** requires adding an import line and a `loadAircraft()` call in `toolkit.jsx` (Vite does not support dynamic JSON imports at build time).
## Storage
- **`localStorage`** — Dark mode, default aircraft, volume unit, passdown retention period, fuel profiles (per aircraft).
- **IndexedDB** — Passdown records and autocomplete lookups. Accessed via async helper functions.
All data is local to the browser. No backend, no accounts, no external APIs (except ARINC HF frequency pages).
## Exchange Formats
- **`.ptz`** — Gzipped JSON array of passdown objects. Exported via browser `CompressionStream`, imported via `DecompressionStream`. Open format.
- **Fuel profile JSON** — Validated on import by `format: "pilot-toolkit-fuel-profile"` field.
- **Fuel profile CSV** — Two columns (stage length, fuel burn), optional header row.
## Dependencies
Production: `react`, `react-dom` (2 packages). No other runtime dependencies.
Dev: `vite`, `@vitejs/plugin-react`.
Compression uses the browser-native `CompressionStream` / `DecompressionStream` APIs — no external gzip library.
## Build
```
npm install
npm run dev # Development server
npm run build # Production build → dist/
npm run preview # Preview production build
```
Production build produces a single HTML file and a single JS bundle (~250 KB, ~72 KB gzipped).
## Deployment
Currently runs as a local dev server. Docker deployment (Phase II) is planned — the production build output (`dist/`) can be served by any static file server (nginx, Caddy, etc.) with no backend required.