Files
events-hub/docs/POPUPS-PLAN.md
T
joshuaandClaude Opus 5.5 691f46844d Hub 2.17.0: popups on the server, settings, install and invoice pages
- Server page: Configuration is a read view with an Edit popup; Update agent is a popup.
- frp config: the file shows read-only; Edit opens it in a popup with Restart, the two-factor
  code and Save on the server (its confirmation unchanged).
- Ports & defaults: install defaults, port range and central IP as a read view with an Edit popup;
  Mark as taken is a popup from the port list.
- Install page (/installs/[id]): Clear public key is a popup with the two-factor code; the notes
  are a read view with an Edit popup; the page message is under the header.
- Invoice: always the read view; Edit (draft, approved) opens a popup, so Approve no longer needs
  a save first. Void and Refund are popups instead of prompt().
- docs/POPUPS-PLAN.md done. Frontend only: no migration, no API changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 12:42:52 +02:00

97 lines
6.1 KiB
Markdown

# Popups everywhere plan
Status: done in Hub 2.16.0 and 2.17.0 (Step 0 before them) · 2026-11-23
Hub 2.14.0 added `Modal` and made every add or edit on the customer page a popup; 2.15.0 did the same
for the install page. The rest of the Hub still opens forms inline: a form card above a list, a card
that turns into a form, or an editor that is always open. This plan moves those onto the same popup,
so every page shows read views and every change happens in a popup. Frontend only: no migration, no
API changes.
## Still inline
Paths are under `frontend/src/`.
### Add buttons and edits on list pages
| # | Where | Inline today |
|---|---|---|
| 1 | `app/(hub)/servers/page.tsx` | **Add server**: name/kind form, then the join command, in a card above the list |
| 2 | `app/(hub)/customers/page.tsx` | **Add customer**: form card |
| 3 | `app/(hub)/servers/installs/page.tsx` | **New install**: large form card with the server picker |
| 4 | `app/(hub)/servers/installs/page.tsx` | **Link existing**: form card |
| 5 | `app/(hub)/notices/page.tsx` | **New notice**: form card |
| 6 | `app/(hub)/notices/page.tsx` | **Edit** a notice: its card turns into the form |
| 7 | `app/(hub)/releases/page.tsx` | **Add release**: form card |
| 8 | `app/(hub)/releases/page.tsx` | **Edit** a release: its card turns into the form |
| 9 | `app/(hub)/releases/page.tsx` | **Release sources**: an always-editable form (rows and the access token) |
| 10 | `app/(hub)/billing/page.tsx` → `billing/invoices/[id]/page.tsx` (`NewInvoice`) | **One-off invoice** is a separate full page, while `components/billing/OneOffInvoice.tsx` is already the same form as a popup on the customer page |
### Editors on detail pages
| # | Where | Inline today |
|---|---|---|
| 11 | `app/(hub)/servers/[id]/page.tsx` (`ConfigEditor`) | The server's .env layer, always editable |
| 12 | `components/FrpConfig.tsx` | frp config textarea, two-factor code and Save, always open |
| 13 | `app/(hub)/servers/[id]/page.tsx` | **Update agent**: a version input in the Actions card |
| 14 | `app/(hub)/servers/settings/page.tsx` | Install defaults and port range, always editable |
| 15 | `app/(hub)/servers/settings/page.tsx` | **Mark as taken** (a port): inline form |
| 16 | `app/(hub)/installs/[id]/page.tsx` | **Clear public key**: two-factor form inside the card |
| 17 | `app/(hub)/billing/invoices/[id]/page.tsx` | A draft or approved invoice is always editable on the page, with a "Save your changes first" guard before Approve |
| 18 | `app/(hub)/installs/[id]/page.tsx` | **Notes**: textarea and Save notes, always open (found while building 2.17.0) |
Optional: **Void** and **Refund** on the invoice page ask for a reason or note with `prompt()`. They are
small forms, but 2.15.0 left confirmations as they are.
### Left inline on purpose
Forms that are the page itself, not an action on it: the Settings page tabs (Hub, SMTP, password,
`BillingSettings`), the **Updates** planner (`servers/updates`), login, and the filter toggles.
## Step 0: the popup kit in one place (no visible change)
- `ReadCard`, `Field`, `Fields` and `ModalButtons` move from `components/customer/ReadCard.tsx` into
`components/ui.tsx`, next to `Modal`, `FormError` and `PageMessage`; every page uses them now.
- `useSubmit` (busy, the error shown by the popup's button, one submit at a time) moves from
`components/install/shared.ts` into `components/ui.tsx`.
- The customer and install components import them from `@/components/ui`; `customer/ReadCard.tsx` goes.
## Hub 2.16.0: list pages (1-10)
Each page that gets popups shows its result with `PageMessage` (the message stays in view and an ok
fades) instead of `Message`.
- **Add server** (`AddServerModal`): two steps in one popup, the form and then the join command with
Copy and Done. The list reloads however it is closed. Once the command is shown, Esc or a click
outside asks first, since the token works once.
- **Add customer** (`AddCustomerModal`): unsaved once any field is filled; still goes to the new
customer's page when saved.
- **New install** (`NewInstallModal`, wide) and **Link existing** (`LinkInstallModal`). Customers and
installs load when the popup opens; the `?warn=` redirect is unchanged.
- **Notices** (`NoticeModal`): one popup for new and edit around `NoticeForm`; the "Email … now?"
confirmation stays in it. `adding`/`editing` become one `open: null | "new" | id`.
- **Releases** (`ReleaseModal`): the same around `ReleaseForm`.
- **Release sources**: a read view (product, repository, tag prefix, notes file, whether a token is
saved) with **Sync now** on the card and an Edit popup (wide) for the rows and the token.
- **One-off invoice**: Billing opens `OneOffInvoice`; with no `customerId` it shows a church picker.
`/billing/invoices/new` redirects to `/billing?oneoff=1`, which opens the popup, and `NewInvoice` goes.
## Hub 2.17.0: server, settings and invoice pages (11-18)
- **Server configuration**: a read view (secrets as dots) with an Edit popup, as `EnvPanel` in 2.15.0.
- **frp config**: the path, Use this path and Read now stay on the card, the file shows read-only, and
**Edit** opens a popup with the textarea, Restart, the two-factor code and Save (its confirm stays).
- **Update agent**: a small popup from the Actions card. Remove server is unchanged.
- **Install defaults**: a read view with an Edit popup. **Mark as taken**: a button and a small popup.
- **Clear public key**: a danger button opening a popup with the explanation and the two-factor code
(`ModalButtons danger`). The install's **Notes** show as text with an Edit popup.
- **Invoice**: always the read view (lines and totals), with **Edit** on drafts and approved invoices
opening a wide popup (dates, recipient, `LinesEditor`, notes). The dirty guard on Approve goes.
- **Void** and **Refund** as popups with a text field instead of `prompt()` (done in 2.17.0).
## Checks for every popup
Esc, the close button and a click outside close it; unsaved changes ask first; the error shows by its
button; at phone width it fills the screen and the page has no horizontal scroll. `npx tsc --noEmit`
and `npx next build` in `frontend`. Each release gets its CHANGELOG entry and a `vX.Y.Z` tag.