chadtmiller.com/monolith
An atproto PDS
0
0
---
name: ui
description: Build or change the OAuth authorization pages (web/) so they look right, not only work. Use for any change to a view, component or style under web/. Look at every state of what you touch with `just look` before pushing, hold it to the house rules here, and have it critiqued by eyes that did not write it.
---
# Building the authorization pages
`--pages` checks that each control has its name and makes the right
call. It does not check that the page is good to look at. A view nobody
looked at shows it: an alert jammed against the button above it, a long
handle running out of its card on a phone, two buttons that look
primary. So look at every state before pushing.
`web/AGENTS.md` has the mechanics: layers, tokens, the
Content-Security-Policy's limits, and inline text. `spec/OAUTH-PAGES.md`
says what each view holds. This file says how the views should read, and
how to check that they do.
## Looking
`just look` builds `web/` and `pds`, then starts the server on a data
directory of its own, with a PLC directory of its own and two accounts
(`alice.test` and one with a long handle). It makes a PAR for the state
you name, drives a browser to it, and writes pictures to `target/look`
to open with Read. Each state is drawn on desktop in light and on a phone
in dark. `cd harness && node look.mjs ...` skips the build when it is
fresh.
```sh
just look sign-in # the first view of a new device
just look sign-in --hint # with login_hint: the identifier filled
just look wrong-password # the alert under the form
just look rate-limited # 429: "Too many tries…" (the answer given by look itself)
just look email-code # the code view (the answer given by look itself)
just look choose # two remembered accounts, one with a long handle
just look consent # loopback client, atproto transition:generic, the long handle
just look consent --scope 'atproto repo:com.example.foo?action=create rpc:com.example.bar?aud=* blob:image/* account:email?action=manage identity:handle'
just look consent --details # Technical details and every set's Details open
just look consent --scope 'atproto include:com.example.authFull?aud=did:web:api.example.com%23notes include:com.example.test.authUntitled' # the harness's permission sets (harness/lib/sets.mjs)
just look consent --scope 'atproto space:com.example.workspace space:*?authority=*&action=read_self include:com.example.forum.access' # spaces, with the harness's declarations
just look ended # consent answered 400: "This sign-in has ended…"
just look busy # the sign-in held on its way: the button busy, the rest disabled
just look error # the error page
just look add-passkey # the page a passkey link opens (server on localhost, Chromium's virtual authenticator)
just look passkey-added # after Add passkey: the passkey made and taken
just look no-passkey # Sign in with a passkey, the browser giving none: its alert
just look consent --phone --light # one size and scheme alone
just look email resetPassword # an email's HTML part, as the server sent it over SMTP
```
`email` takes any kind of email: `confirmEmail`, `updateEmail`,
`resetPassword`, `signInAuthFactor`, `deleteAccount`, `plcOperation`; or
`all`, which `just look-emails` runs. The browser draws it as a page; a
mail client may draw less.
It prints each console message, and says when a view is wider than the
screen, naming the element that runs past the edge. Fix that before
anything else, because on a phone the page then scrolls sideways.
## The states to look at
For every view you touch, look at each of these that applies:
- **Empty and filled**: a field as it first shows, and with text typed.
- **Long text**: a long handle, a long client name, a client with no
name (its host), a scope with many tokens, a collection NSID that
cannot wrap.
- **One and many**: one remembered account, then several.
- **Every alert**: each of the view's answers in `spec/OAUTH-PAGES.md`.
- **Busy**: each button that calls the API, pressed, with its call held.
- **Phone** and **dark**: the defaults draw desktop light and phone dark.
Look at phone light and desktop dark too when you change a colour.
- **Open**: `Technical details`, and each permission set's `Details`.
## House rules
**Case.** Sentence case everywhere: headings, buttons, labels, links and
alerts ("Sign in", "Another account", "Technical details"). Only the
first word and proper nouns take a capital: Bluesky, PDS, DID. A label
ends with no full stop. Something said in a sentence, such as an alert,
ends with one. Names stay as they are written: handles, NSIDs, scopes,
hosts. Use no `text-transform` to change case; write the label as it
should read.
**Space.** Every block stacked on another has a gap from the space
scale between them. Text never touches a row of controls. Things that
belong together sit closer than things that do not: a label to its
field, less than the field to the next field.
**Weight.** One primary button on a view at most: the one that goes on
(`Sign in`, `Allow`). `Deny`, `Cancel`, `Back` and `Another account` are
quiet. Quiet what is said about a thing (`--mute`, `--text-sm`) next to
the thing itself: a handle under a name, a host under a client.
**Consistency.** Do the same thing the same way on every view: the same
component where one exists (look in `web/src/lib` before making one), the
same words for the same act, and the same order of controls (the primary
button first, at the start of the row). People and clients are drawn by
their molecules, never by hand.
**Trust.** The page asks for a password. Keep it plain and calm: the
server's host shown, no decoration that a phishing page could copy more
easily than the server's own name, and nothing that moves.
## Critique
You read your own pictures kindly. Before pushing a change that moves a
view, hand the pictures to an agent that did not write it. Give a fresh
one the paths under `target/look`, this file's house rules, and only
this question: "What looks wrong, out of place, or unlike the other
views here? Be specific: element, what is wrong, which rule." Do not give
it the code, nor what you meant: it judges what is drawn. Fix what it
finds, or say in the pull why not.
## Then
Push. Give the pull the `just look` pictures of every view you changed,
each as an `--image` to `knotless pull create` or `knotless pull edit`.