# 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/`.

## Sign in · Create account, Designer's touch (19 Nov 2026)

`auth/` · built on MT's latest auth version: **go-around-launch-11nov · `codex/14-master-rules-db` · afc8b26 · 19 Nov 2026 17:59 SAST · Moahmed T maghlawy** (`site/login/index.html`, `site/signup/signup.js`). Same title, intro, tabs (Sign in / Create account), back copy ("All ways to continue"), email field (`autocomplete="username webauthn"`), Turnstile slot, "Send email code", "Use a password", Privacy / Terms. The later steps (code, password, profile with gender and nationality) are unchanged and not redrawn here.

What is new:
- **One row for Google and Passkey.** Idle 50 / 50. Tap one: it opens to 64 % and turns ink, the other steps down to 36 % and keeps its icon and short label. Tap the small one to swap. Tap the open one again to start it (Google redirect, or the device passkey prompt). 64 / 36 rather than 70 / 30, because at 390 px a 30 % button cannot hold "Passkey" next to its icon.
- **The rest steps away.** Tabs, the "or" rule and the email button fade out, a quiet "All ways to continue" takes the tabs' place, and one line under the row says what happens next. Escape also goes back.
- **Email opens inline.** "Continue with email" dissolves the methods and the email form takes their place on the same page. Focus moves to the field.
- **No jumps.** Every state lives in the same grid cell, so the card never changes height (checked: 0 px). The split eases on a spring curve (stiffness 380, damping 32, 560 ms, 1 % overshoot), on one fixed-height row with `contain: layout`. Longest frame while switching: 16.8 ms.
- **Access.** Real buttons with full `aria-label`s and `aria-expanded`, tabs follow the WAI-ARIA pattern (arrow keys), hidden layers are `inert`, a status region announces each change. With reduced motion every state lands at once.
- **Top bar.** Same bar as the user page: back, title in General Sans 600, gear on the right. Guests have no account settings yet, so the gear opens Appearance (the four themes, like Codex's footer theme picker) plus Privacy and Terms.

Preview: `auth/?tab=signin|create&mode=choose|google|passkey|mail&t=pearl|champagne|midnight|amethyst`.
Check: `python3 tests/verify_auth.py` → 170 runs, 0 failed (390×844, 820×1180, 1440×900 × 4 themes × 2 tabs × idle, Google, passkey, back, email, Escape, start; plus reduced motion and a frame budget run).

To decide:
1. Passkey on **Create account**. Codex's passkey route signs in only (`/api/auth/passkey/signin-options`), so on Create account the passkey half says so and points new members to Google or email, then Settings. Keep it there, or show Google alone on Create account?
2. Short idle labels "Google" / "Passkey" (the full "Continue with Google" / "Sign in with passkey" appear when opened, and screen readers always hear the full label).

## One top bar on every page (19 Nov 2026)

Every user-facing page now uses the user page's bar: a 44 px back button, the title centred in General Sans 600 17/22, and the 44 px gear on the right, with the same blur and the same gear icon.
- **Your page:** the reference, unchanged.
- **ATO dashboard:** the globe on the right becomes the gear (to Settings). "Public page" is still in the dashboard hero, so nothing is lost.
- **Settings (new, `settings/`):** Codex's sections and copy (`site/settings/index.html`, afc8b26) in the shared look. Pilot profile, Email, Password, Passkeys, Sessions, Theme, Plan and Delete account, with a section index on desktop. The gear marks itself as the current page.
- **Sign in:** same bar. Guests have no Settings, so the gear opens Appearance plus Privacy and Terms.
- **ATO public page (Option A):** `option-a/shared/topbar.js` now draws the same bar (back to the ATO list, "ATO", gear) and `option-a/shared/ga-bar.css` styles it from the page's own tokens. The UTC/SAST clock, the logo and the refresh button are gone. The Appearance sheet and the locked guest rule (guests follow the sun and see no theme button) are unchanged. The template gains one stylesheet link.

`GA.bar()` in `shared/ga.js` fills the icons. In the design preview it points the gear at `../settings/`.

Check: `python3 tests/verify_bar.py` gives 48 runs and 0 failed (the bar is pixel-identical on all four pages at 390/820/1440 × 4 themes, Settings has 0 errors and 0 overflow). `tests/verify.py` gives 162 runs and 0 failed. `tests/verify_auth.py` gives 170 runs and 0 failed. The ATO public page, rendered by the go-around-ato generator, gives 36 runs and 0 failed (3 example schools × guest day and night × member day and night × 3 widths).
