From 0e19005337370c98a79f86383622a5304b099b3f Mon Sep 17 00:00:00 2001 From: Joshua Oosthuizen Date: Mon, 23 Nov 2026 12:17:34 +0200 Subject: [PATCH 1/2] Popup kit in components/ui.tsx; plan for popups everywhere - ReadCard, Field, Fields and ModalButtons move from components/customer/ReadCard.tsx into components/ui.tsx, next to Modal, FormError and PageMessage. - useSubmit moves from components/install/shared.ts into components/ui.tsx. - The customer and install components import them from @/components/ui. No visible change. - docs/POPUPS-PLAN.md: every inline add or edit left in the Hub, and the plan for 2.16.0 and 2.17.0. Co-Authored-By: Claude Opus 5.5 --- docs/POPUPS-PLAN.md | 95 +++++++++++++++++++ .../components/customer/AddProductModal.tsx | 3 +- .../src/components/customer/AddressCard.tsx | 3 +- frontend/src/components/customer/AiCard.tsx | 3 +- .../src/components/customer/DetailsCard.tsx | 3 +- .../src/components/customer/ProductCard.tsx | 3 +- frontend/src/components/customer/ReadCard.tsx | 47 --------- .../src/components/customer/ScheduleCard.tsx | 3 +- .../src/components/customer/SitesCard.tsx | 2 +- .../src/components/install/AdoptModal.tsx | 5 +- frontend/src/components/install/DemoModal.tsx | 5 +- .../src/components/install/RemoveModal.tsx | 5 +- .../src/components/install/UninstallModal.tsx | 5 +- .../src/components/install/UpdateModal.tsx | 5 +- frontend/src/components/install/shared.ts | 21 +--- frontend/src/components/ui.tsx | 68 ++++++++++++- 16 files changed, 180 insertions(+), 96 deletions(-) create mode 100644 docs/POPUPS-PLAN.md delete mode 100644 frontend/src/components/customer/ReadCard.tsx diff --git a/docs/POPUPS-PLAN.md b/docs/POPUPS-PLAN.md new file mode 100644 index 0000000..32c0797 --- /dev/null +++ b/docs/POPUPS-PLAN.md @@ -0,0 +1,95 @@ +# Popups everywhere plan + +Status: Step 0 done (not released; no visible change) · 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 | + +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-17) + +- **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`). +- **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. +- Optional: **Void** and **Refund** as popups with a text field instead of `prompt()`. + +## 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. diff --git a/frontend/src/components/customer/AddProductModal.tsx b/frontend/src/components/customer/AddProductModal.tsx index 68cc0e1..0e39991 100644 --- a/frontend/src/components/customer/AddProductModal.tsx +++ b/frontend/src/components/customer/AddProductModal.tsx @@ -4,8 +4,7 @@ import React, { useState } from "react"; import { api, errorText } from "@/lib/api"; import { PRODUCT_NAMES, type Product } from "@/lib/products"; import type { Licence } from "@/lib/types"; -import { FormError, Modal } from "@/components/ui"; -import { ModalButtons } from "./ReadCard"; +import { FormError, Modal, ModalButtons } from "@/components/ui"; import { endOfDay, type Done } from "./shared"; /** A new licence for a product the church doesn't have yet. Accounts comes free with the first other one. */ diff --git a/frontend/src/components/customer/AddressCard.tsx b/frontend/src/components/customer/AddressCard.tsx index b962f89..34c9b0a 100644 --- a/frontend/src/components/customer/AddressCard.tsx +++ b/frontend/src/components/customer/AddressCard.tsx @@ -3,8 +3,7 @@ import React, { useState } from "react"; import { api, errorText } from "@/lib/api"; import { centsFrom, day, money, randInput } from "@/lib/billing"; -import { FormError, Modal } from "@/components/ui"; -import { Field, Fields, ModalButtons, ReadCard } from "./ReadCard"; +import { Field, Fields, FormError, Modal, ModalButtons, ReadCard } from "@/components/ui"; import { ADDRESS_OPTIONS, changed, type AddressType, type CustomerBillingData, type Done } from "./shared"; /** Whether the included domain is due for renewal within 30 days. */ diff --git a/frontend/src/components/customer/AiCard.tsx b/frontend/src/components/customer/AiCard.tsx index 18aff1e..50e24ab 100644 --- a/frontend/src/components/customer/AiCard.tsx +++ b/frontend/src/components/customer/AiCard.tsx @@ -4,8 +4,7 @@ import React, { useState } from "react"; import { api, errorText } from "@/lib/api"; import { money } from "@/lib/billing"; import type { Customer } from "@/lib/types"; -import { FormError, Modal } from "@/components/ui"; -import { Field, Fields, ModalButtons, ReadCard } from "./ReadCard"; +import { Field, Fields, FormError, Modal, ModalButtons, ReadCard } from "@/components/ui"; import { changed, type Done } from "./shared"; /** The church's AI allowance, shared by all its sites (Hub 2.0). Hub 2.14.0: its own card; the page holds the popup (the AI tile opens it too). */ diff --git a/frontend/src/components/customer/DetailsCard.tsx b/frontend/src/components/customer/DetailsCard.tsx index 75ff764..dcc0fbd 100644 --- a/frontend/src/components/customer/DetailsCard.tsx +++ b/frontend/src/components/customer/DetailsCard.tsx @@ -6,8 +6,7 @@ import { api, errorText } from "@/lib/api"; import { day, todayYmd } from "@/lib/billing"; import type { Customer } from "@/lib/types"; import { EmailList, emailsOf } from "@/components/EmailList"; -import { FormError, Modal } from "@/components/ui"; -import { Field, Fields, ModalButtons, ReadCard } from "./ReadCard"; +import { Field, Fields, FormError, Modal, ModalButtons, ReadCard } from "@/components/ui"; import { changed, type CustomerBillingData, type Done } from "./shared"; /** diff --git a/frontend/src/components/customer/ProductCard.tsx b/frontend/src/components/customer/ProductCard.tsx index d1119ee..fd0c90a 100644 --- a/frontend/src/components/customer/ProductCard.tsx +++ b/frontend/src/components/customer/ProductCard.tsx @@ -9,8 +9,7 @@ import { ago, fmtDate } from "@/lib/format"; import { KEY_WHERE, PRODUCT_NAMES } from "@/lib/products"; import { PLANS_BY_PRODUCT } from "@/lib/tiers"; import type { Licence, LicenceStatus } from "@/lib/types"; -import { Badge, FormError, Menu, Modal } from "@/components/ui"; -import { ModalButtons } from "./ReadCard"; +import { Badge, FormError, Menu, Modal, ModalButtons } from "@/components/ui"; import { changed, dateInput, endOfDay, reportText, suggestedTier, type BillingLicence, type Done, type Plan } from "./shared"; const HEARTBEAT = "The site picks it up with its next heartbeat (within 15 minutes)."; diff --git a/frontend/src/components/customer/ReadCard.tsx b/frontend/src/components/customer/ReadCard.tsx deleted file mode 100644 index 419b520..0000000 --- a/frontend/src/components/customer/ReadCard.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React from "react"; -import { Pencil } from "lucide-react"; - -/** A card that shows settings as text, with an Edit button that opens their popup. */ -export function ReadCard({ title, onEdit, editLabel = "Edit", actions, children }: { - title: React.ReactNode; onEdit?: () => void; editLabel?: string; actions?: React.ReactNode; children: React.ReactNode; -}) { - return ( -
-
-

{title}

-
- {actions} - {onEdit && } -
-
- {children} -
- ); -} - -/** One "label: value" row of a read view; a blank value shows as a dash. */ -export function Field({ label, children, wide }: { label: string; children: React.ReactNode; wide?: boolean }) { - const empty = children == null || children === "" || children === false; - return ( -
-
{label}
-
{empty ? "—" : children}
-
- ); -} - -export function Fields({ children }: { children: React.ReactNode }) { - return
{children}
; -} - -/** Save and Cancel at the foot of a popup form. `danger` for what can't be undone (Hub 2.15.0). */ -export function ModalButtons({ busy, onCancel, label = "Save", busyLabel = "Saving…", danger, disabled }: { - busy: boolean; onCancel: () => void; label?: string; busyLabel?: string; danger?: boolean; disabled?: boolean; -}) { - return ( -
- - -
- ); -} diff --git a/frontend/src/components/customer/ScheduleCard.tsx b/frontend/src/components/customer/ScheduleCard.tsx index 93eed47..72eb827 100644 --- a/frontend/src/components/customer/ScheduleCard.tsx +++ b/frontend/src/components/customer/ScheduleCard.tsx @@ -3,8 +3,7 @@ import React, { useState } from "react"; import { api, errorText } from "@/lib/api"; import { CYCLE, day, type BillingCycle } from "@/lib/billing"; -import { FormError, Modal } from "@/components/ui"; -import { Field, Fields, ModalButtons, ReadCard } from "./ReadCard"; +import { Field, Fields, FormError, Modal, ModalButtons, ReadCard } from "@/components/ui"; import { changed, type CustomerBillingData, type Done } from "./shared"; /** The church's billing schedule: one for all its products. The page holds the popup (the Next invoice popup opens it too). */ diff --git a/frontend/src/components/customer/SitesCard.tsx b/frontend/src/components/customer/SitesCard.tsx index ea074f1..0a9edfa 100644 --- a/frontend/src/components/customer/SitesCard.tsx +++ b/frontend/src/components/customer/SitesCard.tsx @@ -3,7 +3,7 @@ import Link from "next/link"; import { ago } from "@/lib/format"; import { PRODUCT_NAMES, byProduct } from "@/lib/products"; import type { Customer } from "@/lib/types"; -import { ReadCard } from "./ReadCard"; +import { ReadCard } from "@/components/ui"; /** The church's sites: where each product runs and when it last checked in. */ export function SitesCard({ c }: { c: Customer }) { diff --git a/frontend/src/components/install/AdoptModal.tsx b/frontend/src/components/install/AdoptModal.tsx index b7b1fb4..ab2ccb7 100644 --- a/frontend/src/components/install/AdoptModal.tsx +++ b/frontend/src/components/install/AdoptModal.tsx @@ -1,10 +1,9 @@ "use client"; import React, { useState } from "react"; -import { FormError, Modal } from "@/components/ui"; +import { FormError, Modal, ModalButtons, useSubmit } from "@/components/ui"; import { fromInput, toInput } from "@/components/servers"; -import { ModalButtons } from "@/components/customer/ReadCard"; -import { H, changed, post, useSubmit, withWarnings, type Done, type Install } from "./shared"; +import { H, changed, post, withWarnings, type Done, type Install } from "./shared"; /** Move an old (2.1.x) Events install onto the monorepo: `crosscode adopt` at a planned time. */ export function AdoptModal({ x, onClose, onDone }: { x: Install; onClose: () => void; onDone: Done }) { diff --git a/frontend/src/components/install/DemoModal.tsx b/frontend/src/components/install/DemoModal.tsx index 5424869..afeca6e 100644 --- a/frontend/src/components/install/DemoModal.tsx +++ b/frontend/src/components/install/DemoModal.tsx @@ -1,9 +1,8 @@ "use client"; import React, { useState } from "react"; -import { FormError, Modal } from "@/components/ui"; -import { ModalButtons } from "@/components/customer/ReadCard"; -import { post, useSubmit, withWarnings, type Done, type Install } from "./shared"; +import { FormError, Modal, ModalButtons, useSubmit } from "@/components/ui"; +import { post, withWarnings, type Done, type Install } from "./shared"; const PROFILES = [ { key: "small", label: "Small church: the essentials" }, diff --git a/frontend/src/components/install/RemoveModal.tsx b/frontend/src/components/install/RemoveModal.tsx index c644049..f0e0bd0 100644 --- a/frontend/src/components/install/RemoveModal.tsx +++ b/frontend/src/components/install/RemoveModal.tsx @@ -3,9 +3,8 @@ import React, { useState } from "react"; import { api } from "@/lib/api"; import { ago, fmtDate } from "@/lib/format"; -import { FormError, Modal } from "@/components/ui"; -import { ModalButtons } from "@/components/customer/ReadCard"; -import { useSubmit, type Detail, type Install } from "./shared"; +import { FormError, Modal, ModalButtons, useSubmit } from "@/components/ui"; +import { type Detail, type Install } from "./shared"; export type RemoveKind = "record" | "forget"; diff --git a/frontend/src/components/install/UninstallModal.tsx b/frontend/src/components/install/UninstallModal.tsx index 8f22802..d9acc51 100644 --- a/frontend/src/components/install/UninstallModal.tsx +++ b/frontend/src/components/install/UninstallModal.tsx @@ -2,10 +2,9 @@ import React, { useState } from "react"; import { fmtDate } from "@/lib/format"; -import { FormError, Modal } from "@/components/ui"; +import { FormError, Modal, ModalButtons, useSubmit } from "@/components/ui"; import { fromInput, toInput } from "@/components/servers"; -import { ModalButtons } from "@/components/customer/ReadCard"; -import { H, post, productName, useSubmit, withWarnings, type Done, type Install, type UninstallPlan } from "./shared"; +import { H, post, productName, withWarnings, type Done, type Install, type UninstallPlan } from "./shared"; /** * Plan an uninstall of one product (2.12.0): the church's data is exported first, then the site diff --git a/frontend/src/components/install/UpdateModal.tsx b/frontend/src/components/install/UpdateModal.tsx index 896d2e3..4ee0a4c 100644 --- a/frontend/src/components/install/UpdateModal.tsx +++ b/frontend/src/components/install/UpdateModal.tsx @@ -3,10 +3,9 @@ import React, { useState } from "react"; import type { Release } from "@/lib/types"; import { PRODUCT_NAMES } from "@/lib/products"; -import { FormError, Modal } from "@/components/ui"; +import { FormError, Modal, ModalButtons, useSubmit } from "@/components/ui"; import { fromInput, toInput } from "@/components/servers"; -import { ModalButtons } from "@/components/customer/ReadCard"; -import { H, changed, post, productName, useSubmit, withWarnings, type Done, type Install } from "./shared"; +import { H, changed, post, productName, withWarnings, type Done, type Install } from "./shared"; /** * Schedule an update of one install: at a time at least 4 hours away (the church gets notice), or diff --git a/frontend/src/components/install/shared.ts b/frontend/src/components/install/shared.ts index fe7a80c..761467b 100644 --- a/frontend/src/components/install/shared.ts +++ b/frontend/src/components/install/shared.ts @@ -1,7 +1,6 @@ "use client"; -import { useRef, useState } from "react"; -import { api, ApiError, errorText } from "@/lib/api"; +import { api, ApiError } from "@/lib/api"; import { PRODUCT_NAMES } from "@/lib/products"; import type { Deployment, Job, ServerSummary } from "@/components/servers"; @@ -52,24 +51,6 @@ export async function post(path: string, body: Reco /** A success message with the Hub's warnings after it. */ export const withWarnings = (ok: string, r?: { warnings?: string[] } | null) => `${ok}${r?.warnings?.length ? ` Note: ${r.warnings.join(" ")}` : ""}`; -/** - * 2.7.1: one click is one job: `run` does nothing while the last one hasn't answered. A thrown - * error lands in `error`, for the popup to show by its button. - */ -export function useSubmit() { - const [busy, setBusy] = useState(false); - const [error, setError] = useState(null); - const inFlight = useRef(false); - const run = async (fn: () => Promise) => { - if (inFlight.current) return; - inFlight.current = true; - setBusy(true); - setError(null); - try { await fn(); } catch (e) { setError(errorText(e)); } finally { inFlight.current = false; setBusy(false); } - }; - return { busy, error, run }; -} - /** 2.12.0: what an uninstall of this install takes with it, and what stops it. */ export function uninstallPlan(d: Detail) { const x = d.deployment; diff --git a/frontend/src/components/ui.tsx b/frontend/src/components/ui.tsx index d2b1e9a..740545a 100644 --- a/frontend/src/components/ui.tsx +++ b/frontend/src/components/ui.tsx @@ -3,7 +3,8 @@ import React from "react"; import { createPortal } from "react-dom"; -import { ChevronLeft, ChevronRight, MoreHorizontal, Search, X } from "lucide-react"; +import { ChevronLeft, ChevronRight, MoreHorizontal, Pencil, Search, X } from "lucide-react"; +import { errorText } from "@/lib/api"; import type { LicenceStatus, Problem } from "@/lib/types"; const STATUS_TONE: Record = { @@ -169,6 +170,71 @@ export function FormError({ error }: { error: string | null }) { return error ?

{error}

: null; } +/** + * One click is one job (2.7.1; shared since 2.16.0): `run` does nothing while the last one hasn't + * answered. A thrown error lands in `error`, for the popup to show by its button. + */ +export function useSubmit() { + const [busy, setBusy] = React.useState(false); + const [error, setError] = React.useState(null); + const inFlight = React.useRef(false); + const run = async (fn: () => Promise) => { + if (inFlight.current) return; + inFlight.current = true; + setBusy(true); + setError(null); + try { await fn(); } catch (e) { setError(errorText(e)); } finally { inFlight.current = false; setBusy(false); } + }; + return { busy, error, run }; +} + +// Hub 2.14.0 (shared from 2.16.0): read views with an Edit that opens their popup. + +/** A card that shows settings as text, with an Edit button that opens their popup. */ +export function ReadCard({ title, onEdit, editLabel = "Edit", actions, children }: { + title: React.ReactNode; onEdit?: () => void; editLabel?: string; actions?: React.ReactNode; children: React.ReactNode; +}) { + return ( +
+
+

{title}

+
+ {actions} + {onEdit && } +
+
+ {children} +
+ ); +} + +/** One "label: value" row of a read view; a blank value shows as a dash. */ +export function Field({ label, children, wide }: { label: string; children: React.ReactNode; wide?: boolean }) { + const empty = children == null || children === "" || children === false; + return ( +
+
{label}
+
{empty ? "—" : children}
+
+ ); +} + +export function Fields({ children }: { children: React.ReactNode }) { + return
{children}
; +} + +/** Save and Cancel at the foot of a popup form. `danger` for what can't be undone (Hub 2.15.0). */ +export function ModalButtons({ busy, onCancel, label = "Save", busyLabel = "Saving…", danger, disabled }: { + busy: boolean; onCancel: () => void; label?: string; busyLabel?: string; danger?: boolean; disabled?: boolean; +}) { + return ( +
+ + +
+ ); +} + /** A "⋯" button with a short list of actions under it. */ export function Menu({ label = "More actions", items }: { label?: string; items: ({ label: string; onClick: () => void; danger?: boolean } | false | null | undefined)[] }) { const [open, setOpen] = React.useState(false); From 97ae79f4c2789efc08d46c444f4b941530d1bb2e Mon Sep 17 00:00:00 2001 From: Joshua Oosthuizen Date: Mon, 23 Nov 2026 12:34:22 +0200 Subject: [PATCH 2/2] Hub 2.16.0: popups for every add and edit on the list pages - Add server, Add customer, New install and Link existing open in popups (Modal from 2.14.0): ask before discarding, error by the button; saving still opens the new page. - Add server: the join command in the same popup; closing before Copy asks first (Modal's `dirty` can now be the question to ask). - Notices and Releases: one popup for new and edit (NoticeModal, ReleaseModal); the cards are read views. Release sources: a table with Sync now and Use the defaults; Edit opens the rows and the access token in a popup and saving syncs. - One-off invoice on Billing is the OneOffInvoice popup with a church picker; NewInvoice goes and /billing/invoices/new opens the popup (/billing?oneoff=1). - These pages use PageMessage. Frontend only: no migration, no API changes. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 17 + backend/package-lock.json | 4 +- backend/package.json | 2 +- docs/POPUPS-PLAN.md | 2 +- frontend/package-lock.json | 4 +- frontend/package.json | 2 +- .../app/(hub)/billing/invoices/[id]/page.tsx | 57 +--- frontend/src/app/(hub)/billing/page.tsx | 20 +- frontend/src/app/(hub)/customers/page.tsx | 54 ++-- frontend/src/app/(hub)/notices/page.tsx | 179 +++++------ frontend/src/app/(hub)/releases/page.tsx | 301 ++++++++++-------- .../src/app/(hub)/servers/installs/page.tsx | 228 ++++++------- frontend/src/app/(hub)/servers/page.tsx | 94 +++--- .../src/components/billing/OneOffInvoice.tsx | 27 +- frontend/src/components/ui.tsx | 11 +- 15 files changed, 533 insertions(+), 469 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0572d65..d4d6d20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,23 @@ versions follow [Semantic Versioning](https://semver.org/). ## [Unreleased] +## [2.16.0] - 2026-11-23 + +Frontend only: no migration, no API changes. + +### Changed + +- **Every add and edit on the list pages is a popup**, like the customer and install pages: Add + server, Add customer, New install, Link existing, New notice and Edit notice, Add release and Edit + release. Each asks before discarding what you have typed, shows its error by its button, and the + page keeps one message under its header. +- **Add server** shows the join command in the same popup; closing it before Copy asks first, since + the command is shown only once. +- **Release sources** shows the sources as a table, with Sync now and Use the defaults on the card; + Edit opens the sources and the access token in a popup, and saving syncs straight away. +- **One-off invoice on Billing is a popup**, with the church to choose (on the customer page it is + for that church). `/billing/invoices/new` opens it. + ## [2.15.0] - 2026-11-23 Frontend only: no migration, no API changes. diff --git a/backend/package-lock.json b/backend/package-lock.json index f5fa15f..b44e711 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -1,12 +1,12 @@ { "name": "events-hub-backend", - "version": "2.15.0", + "version": "2.16.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "events-hub-backend", - "version": "2.15.0", + "version": "2.16.0", "hasInstallScript": true, "dependencies": { "@anthropic-ai/sdk": "^1.3.0", diff --git a/backend/package.json b/backend/package.json index 90412c8..9a4b892 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "events-hub-backend", - "version": "2.15.0", + "version": "2.16.0", "private": true, "description": "Cross Events Hub — API for managing Cross Events installs, licences and heartbeats", "main": "src/index.js", diff --git a/docs/POPUPS-PLAN.md b/docs/POPUPS-PLAN.md index 32c0797..94e9a86 100644 --- a/docs/POPUPS-PLAN.md +++ b/docs/POPUPS-PLAN.md @@ -1,6 +1,6 @@ # Popups everywhere plan -Status: Step 0 done (not released; no visible change) · 2026-11-23 +Status: Step 0 and Hub 2.16.0 done; 2.17.0 next · 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 diff --git a/frontend/package-lock.json b/frontend/package-lock.json index be33128..b657428 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "events-hub-frontend", - "version": "2.15.0", + "version": "2.16.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "events-hub-frontend", - "version": "2.15.0", + "version": "2.16.0", "dependencies": { "lucide-react": "^0.536.0", "next": "^15.5.24", diff --git a/frontend/package.json b/frontend/package.json index c017ed4..13fe4f6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "events-hub-frontend", - "version": "2.15.0", + "version": "2.16.0", "private": true, "scripts": { "dev": "next dev -p 3200", diff --git a/frontend/src/app/(hub)/billing/invoices/[id]/page.tsx b/frontend/src/app/(hub)/billing/invoices/[id]/page.tsx index fbcde03..9252925 100644 --- a/frontend/src/app/(hub)/billing/invoices/[id]/page.tsx +++ b/frontend/src/app/(hub)/billing/invoices/[id]/page.tsx @@ -8,59 +8,13 @@ import { api, errorText, openPdf } from "@/lib/api"; import { fmtDate } from "@/lib/format"; import { Loading, Message, PageTitle } from "@/components/ui"; import { EMAIL_KIND, METHOD, StateBadge, day, money, todayYmd, type BillingEmail, type Invoice, type LicenceChange } from "@/lib/billing"; -import { LinesEditor, editTotal, fromEdit, toEdit, type EditLine } from "@/components/billing/LinesEditor"; +import { LinesEditor, fromEdit, toEdit, type EditLine } from "@/components/billing/LinesEditor"; import { RecordPayment } from "@/components/billing/RecordPayment"; import { PRODUCT_NAMES } from "@/lib/products"; type Msg = { type: "ok" | "err"; text: string } | null; type Detail = Invoice & { licenceChanges: LicenceChange[]; emails: BillingEmail[] }; -/** A one-off invoice (standby support, set-up…), made as a draft. */ -function NewInvoice() { - const router = useRouter(); - const [customers, setCustomers] = useState<{ id: string; name: string }[]>([]); - const [form, setForm] = useState({ customerId: "", issueDate: todayYmd(), notes: "" }); - const [lines, setLines] = useState([{ description: "", quantity: "1", unit: "" }]); - const [msg, setMsg] = useState(null); - - useEffect(() => { - api<{ id: string; name: string }[]>("/api/admin/billing/customers").then(setCustomers).catch(e => setMsg({ type: "err", text: errorText(e) })); - const c = new URLSearchParams(window.location.search).get("customer"); - if (c) setForm(f => ({ ...f, customerId: c })); - }, []); - - const save = async (e: React.FormEvent) => { - e.preventDefault(); - try { - const inv = await api("/api/admin/billing/invoices", { method: "POST", body: { ...form, lines: fromEdit(lines) } }); - router.replace(`/billing/invoices/${inv.id}`); - } catch (err) { setMsg({ type: "err", text: errorText(err) }); } - }; - - return ( - <> - Billing - -
-
-
-
- - -
-
setForm({ ...form, issueDate: e.target.value })} required />
-
- -