# Code from launch PR #14

This is a copy of the product-code change on `go-around-launch-11nov` branch `design/badges-code-20nov`. It is here so the design file has the code that was written. The launch PR stays open and is not merged.

| | |
|---|---|
| Source repo | [sdzrxwfxd2-cloud/go-around-launch-11nov](https://github.com/sdzrxwfxd2-cloud/go-around-launch-11nov) |
| Pull request | [go-around-launch-11nov/pull/14](https://github.com/sdzrxwfxd2-cloud/go-around-launch-11nov/pull/14) |
| Commit | [`b319bd762ba529bf39d9ccddcccb5f68b3696e0c`](https://github.com/sdzrxwfxd2-cloud/go-around-launch-11nov/commit/b319bd762ba529bf39d9ccddcccb5f68b3696e0c) |
| Branch | `design/badges-code-20nov` (base: `codex/17-owner-decisions`) |

The full diff is [pr-14-b319bd76.patch](pr-14-b319bd76.patch). Every added or changed file, as it stands in that commit, is under [files/](files/), at the same paths as in the launch repo.

## Badge SVG, JS and CSS

These are also copied to [badges/](badges/) for a shorter path:

| File | What it is |
|---|---|
| [badges/badge-marks.mjs](badges/badge-marks.mjs) | Inline SVG marks and `nameLineHtml()` for guest and static HTML |
| [badges/badges.js](badges/badges.js) | Browser IIFE: `nameLine`, `attachNameLine` (DOM only, no `innerHTML`), `markNode` |
| [badges/badges.css](badges/badges.css) | Pearl, Midnight, Amethyst and Champagne. One-shot gold shine and blue pop. `prefers-reduced-motion` stays still. No `!important`. |
| [badges/founding-compass-gold.svg](badges/founding-compass-gold.svg) | New gold founding compass asset. Locked badge SVGs in the launch repo were left unchanged. |

## Other files under `files/`

**Rules and data:** `cloudflare/lib/reviews/projection.mjs` (gold tick only if official and paying; DFE author is the username, display name above), `data_more.mjs` / `data.mjs` (gifts unlock extras; a full refund is not “ever paid”), `data_auth.mjs` (DFE search returns label, suffix and mark).

**Where the marks are drawn:** `cloudflare/lib/ato_review_html.mjs` and `functions/_middleware.js` (guest ATO), `site/me/ato-member.js` (signed-in official replies), `site/ga-directory.mjs` (directory), `site/u/profile.mjs` and `site/u/index.html` (profile), `site/ato/index.html` and `site/dfe/index.html` (CSS/JS includes), `tools/reviews/export_for_generator.mjs`, `ato-generator/` (`generator.py`, `svg.py`, `template/ato.html.j2`, `template/parts/badges.j2`).

**Tests:** `tests/reviews/audit_handles.test.mjs` and `audit_handles_ui.test.mjs` (from go-around-design PR #30, plus the animation CSS check), and small updates in `admin.test.mjs`, `added_rules.test.mjs`, `access.test.mjs`, `security_gate.test.mjs`.

## Rules implemented (MT, 20 Nov 2026)

- Paying, approved school: gold tick beside the school name, handle `name.official` in blue. Stop paying: gold tick is removed. A finished gift keeps `.official`; a full refund loses it. A gift on an unclaimed school does not give the tick.
- Paying, approved DFE: `username.dfe` and a blue tick. Stop paying: keeps `username.dfe`, no tick. Display name is shown above; the handle uses the username, not the display name.
- Founding member: gold compass beside their name; removed if founding lapses.
- Gifted Premium unlocks Premium extras. Guest views and signed-in official replies draw the same marks.
- Animation: gold tick and gold compass shine once on first appear; the blue tick pops once. CSS/SVG only, no loops. Reduced motion stays still. All four themes.
