# ericliol/da20-planner architecture

> Architecture diagram of the GitHub repository ericliol/da20-planner, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ericliol/da20-planner
- Repository: https://github.com/ericliol/da20-planner

## Overview

DA20-C1 Planner is an offline-capable flight-planning training aid. Pilots enter aircraft, loading, departure and arrival details; the app computes weight-and-balance and take-off/landing performance, then presents checks and a printable sheet. Separate branches cover aircraft profiles and documentation, plus METAR/TAF lookup through an optional Worker relay. The calculation layer uses AFM data, chart/table interpolation and runway factors. Edges are limited to relationships shown in the README or SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`src/App.tsx`](https://github.com/ericliol/da20-planner/blob/main/src/App.tsx) (App shell), [`src/components/WeightBalance.tsx`](https://github.com/ericliol/da20-planner/blob/main/src/components/WeightBalance.tsx) (Weight and balance view), [`src/components/PrintSheet.tsx`](https://github.com/ericliol/da20-planner/blob/main/src/components/PrintSheet.tsx) (Print sheet), [`src/lib/performance.ts`](https://github.com/ericliol/da20-planner/blob/main/src/lib/performance.ts) (Performance orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Planner interface"]
  node_application["App shell<br/>[App.tsx]"]
  node_wb_view["Weight and balance view<br/>[WeightBalance.tsx]"]
  node_envelope["CG envelope<br/>[Envelope.tsx]"]
  node_loading_table["Loading table<br/>[LoadingTable.tsx]"]
  node_performance_view["Performance view<br/>[Performance.tsx]"]
  node_nomogram["Take-off nomogram<br/>[Nomogram.tsx]"]
  node_print_sheet["Print sheet<br/>[PrintSheet.tsx]"]
end

subgraph group_wb["Weight and balance"]
  node_wb_calc["Loading calculations<br/>[wb.ts]"]
  node_afm_data["AFM data<br/>[afm.ts]"]
  node_app_state[("Saved planner state<br/>[state.ts]")]
end

subgraph group_perf["Performance calculations"]
  node_performance_calc["Performance orchestration<br/>[performance.ts]"]
  node_takeoff_calc["Take-off chart calculation<br/>[takeoff.ts]"]
  node_landing_calc["Landing table calculation<br/>[landing.ts]"]
  node_interpolation["Chart interpolation<br/>[interp.ts]"]
  node_distance_factors["Runway and regulatory factors<br/>[factors.ts]"]
end

subgraph group_support["Aircraft and weather"]
  node_aircraft_editor["Aircraft profiles<br/>[AircraftEditor.tsx]"]
  node_aircraft_docs["Aircraft documents"]
  node_weather_view["Weather lookup<br/>[Weather.tsx]"]
  node_weather_client["Weather relay client<br/>[wx.ts]"]
  node_weather_worker["Weather relay<br/>[index.js]"]
end

node_pilot(("Pilot"))
node_weather_service["Aviation weather service"]

node_pilot -->|"enters inputs"| node_application
node_application -->|"shows tab"| node_wb_view
node_application -->|"shows tab"| node_performance_view
node_application -->|"renders"| node_print_sheet
node_application -->|"shows tab"| node_aircraft_editor
node_application -->|"renders"| node_aircraft_docs
node_application -->|"shows tab"| node_weather_view
node_wb_view -->|"computes loading"| node_wb_calc
node_wb_view -->|"renders"| node_envelope
node_wb_view -->|"renders"| node_loading_table
node_wb_calc -->|"uses limits"| node_afm_data
node_application -->|"loads and updates"| node_app_state
node_app_state -->|"types loading data"| node_wb_calc
node_performance_view -->|"calculates distances"| node_performance_calc
node_performance_view -->|"renders"| node_nomogram
node_performance_calc -->|"calls"| node_takeoff_calc
node_performance_calc -->|"calls"| node_landing_calc
node_performance_calc -->|"applies factors"| node_distance_factors
node_takeoff_calc -->|"uses guide curves"| node_interpolation
node_landing_calc -->|"looks up table"| node_interpolation
node_print_sheet -->|"renders"| node_envelope
node_print_sheet -->|"renders"| node_loading_table
node_print_sheet -->|"renders"| node_nomogram
node_aircraft_editor -->|"updates profiles"| node_app_state
node_aircraft_docs -->|"uses aircraft data"| node_afm_data
node_weather_view -->|"requests weather"| node_weather_client
node_weather_client -.->|"relays request"| node_weather_worker
node_weather_worker -.->|"fetches METAR/TAF"| node_weather_service

click node_application "https://github.com/ericliol/da20-planner/blob/main/src/App.tsx"
click node_wb_view "https://github.com/ericliol/da20-planner/blob/main/src/components/WeightBalance.tsx"
click node_envelope "https://github.com/ericliol/da20-planner/blob/main/src/components/Envelope.tsx"
click node_loading_table "https://github.com/ericliol/da20-planner/blob/main/src/components/LoadingTable.tsx"
click node_performance_view "https://github.com/ericliol/da20-planner/blob/main/src/components/Performance.tsx"
click node_nomogram "https://github.com/ericliol/da20-planner/blob/main/src/components/Nomogram.tsx"
click node_print_sheet "https://github.com/ericliol/da20-planner/blob/main/src/components/PrintSheet.tsx"
click node_wb_calc "https://github.com/ericliol/da20-planner/blob/main/src/lib/wb.ts"
click node_afm_data "https://github.com/ericliol/da20-planner/blob/main/src/lib/afm.ts"
click node_app_state "https://github.com/ericliol/da20-planner/blob/main/src/state.ts"
click node_performance_calc "https://github.com/ericliol/da20-planner/blob/main/src/lib/performance.ts"
click node_takeoff_calc "https://github.com/ericliol/da20-planner/blob/main/src/lib/takeoff.ts"
click node_landing_calc "https://github.com/ericliol/da20-planner/blob/main/src/lib/landing.ts"
click node_interpolation "https://github.com/ericliol/da20-planner/blob/main/src/lib/interp.ts"
click node_distance_factors "https://github.com/ericliol/da20-planner/blob/main/src/lib/factors.ts"
click node_aircraft_editor "https://github.com/ericliol/da20-planner/blob/main/src/components/AircraftEditor.tsx"
click node_aircraft_docs "https://github.com/ericliol/da20-planner/blob/main/src/components/AircraftDocuments.tsx"
click node_weather_view "https://github.com/ericliol/da20-planner/blob/main/src/components/Weather.tsx"
click node_weather_client "https://github.com/ericliol/da20-planner/blob/main/src/lib/wx.ts"
click node_weather_worker "https://github.com/ericliol/da20-planner/blob/main/worker/src/index.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_application,node_wb_view,node_envelope,node_loading_table,node_performance_view,node_nomogram,node_print_sheet toneBlue
class node_wb_calc,node_afm_data,node_app_state toneAmber
class node_performance_calc,node_takeoff_calc,node_landing_calc,node_interpolation,node_distance_factors toneMint
class node_aircraft_editor,node_aircraft_docs,node_weather_view,node_weather_client,node_weather_worker toneRose
class node_pilot,node_weather_service toneIndigo
```

## Components

### Planner interface

- [App shell](https://github.com/ericliol/da20-planner/blob/main/src/App.tsx): `src/App.tsx`
- [Weight and balance view](https://github.com/ericliol/da20-planner/blob/main/src/components/WeightBalance.tsx): `src/components/WeightBalance.tsx`
- [CG envelope](https://github.com/ericliol/da20-planner/blob/main/src/components/Envelope.tsx): `src/components/Envelope.tsx`
- [Loading table](https://github.com/ericliol/da20-planner/blob/main/src/components/LoadingTable.tsx): `src/components/LoadingTable.tsx`
- [Performance view](https://github.com/ericliol/da20-planner/blob/main/src/components/Performance.tsx): `src/components/Performance.tsx`
- [Take-off nomogram](https://github.com/ericliol/da20-planner/blob/main/src/components/Nomogram.tsx): `src/components/Nomogram.tsx`
- [Print sheet](https://github.com/ericliol/da20-planner/blob/main/src/components/PrintSheet.tsx): `src/components/PrintSheet.tsx`

### Weight and balance

- [Loading calculations](https://github.com/ericliol/da20-planner/blob/main/src/lib/wb.ts): `src/lib/wb.ts`
- [AFM data](https://github.com/ericliol/da20-planner/blob/main/src/lib/afm.ts): `src/lib/afm.ts`
- [Saved planner state](https://github.com/ericliol/da20-planner/blob/main/src/state.ts): `src/state.ts`

### Performance calculations

- [Performance orchestration](https://github.com/ericliol/da20-planner/blob/main/src/lib/performance.ts): `src/lib/performance.ts`
- [Take-off chart calculation](https://github.com/ericliol/da20-planner/blob/main/src/lib/takeoff.ts): `src/lib/takeoff.ts`
- [Landing table calculation](https://github.com/ericliol/da20-planner/blob/main/src/lib/landing.ts): `src/lib/landing.ts`
- [Chart interpolation](https://github.com/ericliol/da20-planner/blob/main/src/lib/interp.ts): `src/lib/interp.ts`
- [Runway and regulatory factors](https://github.com/ericliol/da20-planner/blob/main/src/lib/factors.ts): `src/lib/factors.ts`

### Aircraft and weather

- [Aircraft profiles](https://github.com/ericliol/da20-planner/blob/main/src/components/AircraftEditor.tsx): `src/components/AircraftEditor.tsx`
- [Aircraft documents](https://github.com/ericliol/da20-planner/blob/main/src/components/AircraftDocuments.tsx): `src/components/AircraftDocuments.tsx`
- [Weather lookup](https://github.com/ericliol/da20-planner/blob/main/src/components/Weather.tsx): `src/components/Weather.tsx`
- [Weather relay client](https://github.com/ericliol/da20-planner/blob/main/src/lib/wx.ts): `src/lib/wx.ts`
- [Weather relay](https://github.com/ericliol/da20-planner/blob/main/worker/src/index.js): `worker/src/index.js`

### Other components

- **Pilot**
- **Aviation weather service**

## Connections

- Pilot → App shell: enters inputs (evidence: `README.md`)
- App shell → Weight and balance view: shows tab (evidence: `src/App.tsx`)
- App shell → Performance view: shows tab (evidence: `src/App.tsx`)
- App shell → Print sheet: renders (evidence: `src/App.tsx`)
- App shell → Aircraft profiles: shows tab (evidence: `src/App.tsx`)
- App shell → Aircraft documents: renders (evidence: `src/App.tsx`)
- App shell → Weather lookup: shows tab (evidence: `src/App.tsx`)
- Weight and balance view → Loading calculations: computes loading (evidence: `src/components/WeightBalance.tsx`)
- Weight and balance view → CG envelope: renders (evidence: `src/components/WeightBalance.tsx`)
- Weight and balance view → Loading table: renders (evidence: `src/components/WeightBalance.tsx`)
- Loading calculations → AFM data: uses limits (evidence: `src/lib/wb.ts`)
- App shell → Saved planner state: loads and updates (evidence: `src/App.tsx`)
- Saved planner state → Loading calculations: types loading data (evidence: `src/state.ts`)
- Performance view → Performance orchestration: calculates distances (evidence: `src/components/Performance.tsx`)
- Performance view → Take-off nomogram: renders (evidence: `src/components/Performance.tsx`)
- Performance orchestration → Take-off chart calculation: calls (evidence: `src/lib/performance.ts`)
- Performance orchestration → Landing table calculation: calls (evidence: `src/lib/performance.ts`)
- Performance orchestration → Runway and regulatory factors: applies factors (evidence: `src/lib/performance.ts`)
- Take-off chart calculation → Chart interpolation: uses guide curves (evidence: `src/lib/takeoff.ts`)
- Landing table calculation → Chart interpolation: looks up table (evidence: `src/lib/landing.ts`)
- Print sheet → CG envelope: renders (evidence: `src/components/PrintSheet.tsx`)
- Print sheet → Loading table: renders (evidence: `src/components/PrintSheet.tsx`)
- Print sheet → Take-off nomogram: renders (evidence: `src/components/PrintSheet.tsx`)
- Aircraft profiles → Saved planner state: updates profiles (evidence: `src/components/AircraftEditor.tsx`)
- Aircraft documents → AFM data: uses aircraft data (evidence: `src/components/AircraftDocuments.tsx`)
- Weather lookup → Weather relay client: requests weather (evidence: `src/components/Weather.tsx`)
- Weather relay client → Weather relay: relays request (evidence: `README.md`)
- Weather relay → Aviation weather service: fetches METAR/TAF (evidence: `README.md`)
