# Your page and ATO dashboard, wired to Codex (19 Nov 2026)

This folder holds the pilot's own page and the ATO dashboard. Both are built on the response shapes the Codex backend returns today (go-around-launch-11nov, `codex/01` → `codex/12-live-engine-audit` 9150abd, 19 Nov 05:30 SAST). The fixtures in `fixtures/api.js` copy those shapes field for field. All people and ATOs in them are fictional.

Open `index.html` to see every state. Add `?t=pearl|champagne|midnight|amethyst` to any page to switch theme. When the pages are served from the Codex site (where `site/ga-api.js` is loaded) or opened with `?live=1`, they call the real API instead of the fixtures.

![Summary](SUMMARY.png)

## Latest versions found (19 Nov 2026)

| Surface | Where | Commit | Date (SAST) | Author |
|---|---|---|---|---|
| User page, design | go-around-launch-11nov `review/user-roles-17nov` (r3 round medallion, Founding pass) | 9e69f6e | 17 Nov 01:41 | Grok Bot |
| User page, design (alt) | go-around-launch-11nov `design/user-page-premium-17nov` | 8db2747 | 17 Nov 00:24 | Grok Bot |
| User page, functional | go-around-launch-11nov `site/u/` + `profile.mjs`, last touched in `codex/03-user-page-fixes` | d64ad07 | 18 Nov 09:37 | MILL (Codex) |
| ATO dashboard, design | go-around-design PR #12 `design/pilot-ato-pages-12nov`, `components/ato-page` | 00a9782 | 12 Nov 19:24 | Designer account |
| ATO dashboard, functional | Codex has the APIs only (`/api/school/{slug}/*`); there is no dashboard page | 9150abd | 19 Nov 05:30 | MILL (Codex) |
| Landing | go-around-design PR #10 `design/landing-v4-locked`, `components/landing-v4` | 3d42202 | 12 Nov 19:24 | Designer account |

The PR #12 ATO dashboard is out of date. It assumes the school login and the 25-seat roles proposal, and Codex retired both on 16 Nov. This folder replaces it with Codex's model: owner and staff are members added by username, with 2-seat or 5-seat plans.

Nobody has changed landing v4 since 12 Nov. On 18 Nov, Codex replaced `site/welcome/index.html` with its own landing design (4a30ba1, `codex/02-bug-fixes`, 09:24 SAST). That conflicts with the master rule "Landing v4 is the landing page". See the decisions below.

## Field mapping: Your page (`user/`)

| On screen | Codex field |
|---|---|
| Name, @username, Founding or Pro mark | `GET /api/me/page` → `identity.display_name`, `identity.username`, `identity.badge`, `identity.suffix` (name → suffix → mark, same order as `badges.js nameLine`) |
| Pass tier (gold Founding, steel Pro, theme card for trial and free) | `plan.plan` |
| Licence and rating chips on the pass | `licences[]` where `verified` |
| Stub: Reviews · Plan · Renews | `reviews.length`, `plan.plan`, `plan.renews_on` or `plan.trial_ends` |
| Membership: Price / mo · Renews · Resets | `plan.price_cents`, `plan.renews_on`, `limits.resets` |
| Allowance meters | `limits.reviews_quota` / `reviews_left`, `limits.votes_quota` / `votes_left` (null quota shows as Unlimited) |
| Finish payment, access until | `plan.finish_payment`, `plan.access_until`, `plan.can_cancel` |
| Pass finish per plan: gold Founding, steel Pro, graphite Free, graphite + accent Trial | `plan.plan` (own view); other members only ever see `identity.badge`, so a Trial or Free pilot looks the same to them |
| Trial days left (stub + line on the pass) | `plan.trial_ends`, counted in SAST |
| Renewal cancelled: "Not renewing", Ends, Renew plan | `plan.access_until` set, `plan.can_cancel` false |
| Offers on Free and Trial (Founding, Pro) | `GET /api/prices` → `plans[]` where `available` (Founding drops out at its cap), `total_cents`, `vat_enabled` |
| Your ATOs (link to dashboard) | `GET /api/me/schools` → `slug, name, role, can_manage` |
| Staff request (Accept or Decline) | `GET /api/me/school-requests` → `id, name, expires_at`; actions on `/api/me/memberships/{id}` |
| Licences and ratings, grouped by kind | `licences[]` → `code, label, kind, verified` (Verified or Self-declared) |
| Reviews you wrote | `reviews[]` → `school.name, state, anonymous, stars, title, date` |
| Updated terms banner | `legal_updates[]` → `doc, version` |
| DFE claim notice | `dfe_claim.status`, `dfe_claim.since` |
| Ban and hold notices | `status` |
| What other members see | client projection of the own view (see gaps); `?view=public&name=x` calls `GET /api/u/{username}` |

## Field mapping: ATO dashboard (`ato/`)

| On screen | Codex field |
|---|---|
| Which ATO, owner or staff | `GET /api/me/schools` → `slug, role, can_manage` |
| Name line `demoato.official` and gold tick | `GET /api/ato/{slug}/public` → `school.label, suffix, mark` |
| Certificates, bases, courses, contact | `/public` → `certificates[] (number, state, expiry, base.code, base.town)`, `courses[]`, `school.contact` |
| Score, stars, rating split, latest reviews, replied or not | `GET /api/ato/{slug}/view` → `rating.shown, score, gold, count, written, bars`; `reviews[].replies[].author.kind === "school"` |
| Status pill and notices (ending, grace, private-from lists) | `GET /api/school/{slug}/plan` → `paying, ending, in_grace, renews_on, private_from, will_go_private[], keeps[]` |
| Plan card: price, seats, renews, card, next charge | `GET /api/school/{slug}/billing` → `plan.{seats, price_cents, period_end, cancel_at_period_end, grace_days_left}`, `card.{on_file, paid_by, paid_by_me, next_charge}` |
| New owner card window | `billing.card_window.{ends, days_left, i_must_add_card}` |
| Seat picker when there is no plan | `billing.can_buy`, prices R3,999 (2 seats) and R4,999 (5 seats) excl. VAT |
| Invoices | `GET /api/school/{slug}/invoices` → `documents[]` |
| Seat bar (used, waiting, free) | `GET /api/school/{slug}/members` → `seats.{paid, used, pending, free}` |
| Team rows, waiting hours, frozen | `members[]` → `username, display_name, role, status, frozen, expires_at, accepted_at` |
| Member actions (Make owner, Freeze, Remove, Cancel request) | `POST /api/school/{slug}/memberships/{id}/*`, `handover` |
| Photos (5 live at most, waiting queue) | `GET /api/school/{slug}/photos` → `status, size_bytes, uploaded_at, uploaded_by, mine` |
| Activity, owner only | `GET /api/school/{slug}/activity` → `action, at, actor` (every action has a plain label in `ato.js`) |
| Staff view | Staff get 403 on plan, billing, activity and invoices, so those cards are left out. Members returns the seat bar only. |

Page extras and suggestions (`/suggestions`) are kept out on purpose, following PREM-1 (premium extras stay hidden until after launch).

## Plan states (added 19 Nov, after MT's yes on the design)

Codex's `planOf()` has four plans, `free`, `trial`, `pro` and `founding`, and `planSummary()` adds two sub-states: renewal cancelled (`access_until`) and payment not finished (`finish_payment`). Every one has a preview: `?plan=free|trial|pro|founding`, plus `&s=ending` (renewal cancelled), `&s=nofounding` (Founding not on sale, so only Pro is offered) and `&s=finish`.

Free now has its own graphite pass with a silver edge, so it no longer looks like a plain card next to Pro and Founding. Free and Trial also show the paid plans that are on sale, with prices from `/api/prices`.

## Backend gaps

1. `getPilotPage` returns no member-since (join) date.
2. There is no table for home or saved aerodromes, so the page leaves that out.
3. The master rules list gender and nationality as private fields, but the schema has no columns for them.
4. There are no privacy switches. "What other members see" is fixed by the server's public projection.
5. `GET /api/u/{own username}` returns the own view, so the server has no "view as others" mode. The page removes the private fields in the browser instead. A `?as=public` flag on the server would be safer.
6. There is no endpoint for unanswered reviews at the ATO level. The dashboard works it out from `/view` reviews, which only covers the reviews that endpoint returns.
7. Codex has no dashboard page at all, only the APIs. This folder is the page.
8. The Pro badge artwork isn't final. The pass keeps a slot for it.
9. Seat numbers aren't returned for members, so the bar shows counts only.
10. Codex's `site/welcome` landing is not landing v4. A merge of the two is proposed on `design/landing-v4-codex-merge-19nov`.
11. `/api/prices` says whether Founding is on sale but not how many seats are left, so the offer can't show "12 of 50 left".

## Decisions for MT

- Should Codex's own `site/welcome` landing be replaced with landing v4?
- What should the final Pro badge look like?
- Should the server add a "view as others" flag (gap 5)?
- Should pilots get a home aerodrome field? If yes, the backend needs a table.
- Should "Member since" show on the pass? That needs `created_at` in `getPilotPage`.
- Gender and nationality: add the columns, or drop them from the rules?
- Keep the dark medallion and the gold compass together on the Founding pass, as r3 has it?

## Checks

`tests/verify.py` covers 162 runs: 5 pages × 3 sizes × 4 themes, plus 17 states × 3 sizes × 2 themes. Each run checks console errors, JS errors and horizontal overflow, and the result is 0 failed. Run it from this folder with `python3 -m http.server 8917` serving the folder. Full-page shots are in `shots/`.
