From 691f46844d3d56be611d302b0cfd4c02d6649364 Mon Sep 17 00:00:00 2001 From: Joshua Oosthuizen Date: Mon, 23 Nov 2026 12:42:52 +0200 Subject: [PATCH] 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 --- CHANGELOG.md | 18 ++ backend/package-lock.json | 4 +- backend/package.json | 2 +- docs/POPUPS-PLAN.md | 9 +- frontend/package-lock.json | 4 +- frontend/package.json | 2 +- .../app/(hub)/billing/invoices/[id]/page.tsx | 167 +++++++++++------- frontend/src/app/(hub)/installs/[id]/page.tsx | 85 +++++---- frontend/src/app/(hub)/servers/[id]/page.tsx | 105 +++++++---- .../src/app/(hub)/servers/settings/page.tsx | 123 +++++++++---- frontend/src/components/FrpConfig.tsx | 75 +++++--- 11 files changed, 385 insertions(+), 209 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d4d6d20..23cce9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,24 @@ versions follow [Semantic Versioning](https://semver.org/). ## [Unreleased] +## [2.17.0] - 2026-11-23 + +Frontend only: no migration, no API changes. With 2.16.0, no add or edit is left open on a page. + +### Changed + +- **A server's page**: Configuration shows its values, and Edit opens them in a popup. **Update + agent** is a popup from the Actions card. +- **frp config** shows the file read-only, with Where the file is and Read now on the card; Edit + opens the file in a popup with Restart afterwards, the two-factor code and Save on the server. +- **Ports & defaults**: the install defaults, port range and central server IP show as values with + an Edit popup; **Mark as taken** is a button on the port list that opens a popup. +- **An install's page (Installs)**: Clear public key is a popup with the two-factor code, and the + notes show as text with an Edit popup. Its message is under the header. +- **An invoice** always shows its lines and totals; Edit (drafts and approved invoices) opens them + in a popup, so Approve no longer asks you to save first. **Void** asks for its reason and + **Refund** for its note in a popup instead of the browser's prompt. + ## [2.16.0] - 2026-11-23 Frontend only: no migration, no API changes. diff --git a/backend/package-lock.json b/backend/package-lock.json index b44e711..d35fca7 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -1,12 +1,12 @@ { "name": "events-hub-backend", - "version": "2.16.0", + "version": "2.17.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "events-hub-backend", - "version": "2.16.0", + "version": "2.17.0", "hasInstallScript": true, "dependencies": { "@anthropic-ai/sdk": "^1.3.0", diff --git a/backend/package.json b/backend/package.json index 9a4b892..1b443b1 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "events-hub-backend", - "version": "2.16.0", + "version": "2.17.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 94e9a86..7961a82 100644 --- a/docs/POPUPS-PLAN.md +++ b/docs/POPUPS-PLAN.md @@ -1,6 +1,6 @@ # Popups everywhere plan -Status: Step 0 and Hub 2.16.0 done; 2.17.0 next · 2026-11-23 +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 @@ -38,6 +38,7 @@ Paths are under `frontend/src/`. | 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. @@ -75,7 +76,7 @@ fades) instead of `Message`. - **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) +## 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 @@ -83,10 +84,10 @@ fades) instead of `Message`. - **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`). + (`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. -- Optional: **Void** and **Refund** as popups with a text field instead of `prompt()`. +- **Void** and **Refund** as popups with a text field instead of `prompt()` (done in 2.17.0). ## Checks for every popup diff --git a/frontend/package-lock.json b/frontend/package-lock.json index b657428..719b0fe 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "events-hub-frontend", - "version": "2.16.0", + "version": "2.17.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "events-hub-frontend", - "version": "2.16.0", + "version": "2.17.0", "dependencies": { "lucide-react": "^0.536.0", "next": "^15.5.24", diff --git a/frontend/package.json b/frontend/package.json index 13fe4f6..e95ee1c 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "events-hub-frontend", - "version": "2.16.0", + "version": "2.17.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 9252925..5b9e699 100644 --- a/frontend/src/app/(hub)/billing/invoices/[id]/page.tsx +++ b/frontend/src/app/(hub)/billing/invoices/[id]/page.tsx @@ -1,35 +1,101 @@ "use client"; -import React, { useCallback, useEffect, useState } from "react"; +import React, { useCallback, useEffect, useMemo, useState } from "react"; import Link from "next/link"; import { useParams, useRouter } from "next/navigation"; -import { AlertTriangle, ArrowLeft, Check, FileText, RefreshCw, Send, Star, Undo2, XCircle } from "lucide-react"; +import { AlertTriangle, ArrowLeft, Check, FileText, Pencil, RefreshCw, Send, Star, Undo2, XCircle } from "lucide-react"; import { api, errorText, openPdf } from "@/lib/api"; import { fmtDate } from "@/lib/format"; -import { Loading, Message, PageTitle } from "@/components/ui"; +import { FormError, Loading, Message, Modal, ModalButtons, PageMessage, PageTitle, useSubmit } from "@/components/ui"; import { EMAIL_KIND, METHOD, StateBadge, day, money, todayYmd, type BillingEmail, type Invoice, type LicenceChange } from "@/lib/billing"; -import { LinesEditor, fromEdit, toEdit, type EditLine } from "@/components/billing/LinesEditor"; +import { LinesEditor, fromEdit, toEdit } 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[] }; +type Payment = Invoice["payments"][number]; + +/** Hub 2.17.0: a draft or approved invoice edited in a popup (it was always open on the page). */ +function EditInvoiceModal({ inv, onClose, onSaved }: { inv: Detail; onClose: () => void; onSaved: (text: string) => void }) { + const initial = useMemo(() => ({ form: { issueDate: inv.issueDate, dueDate: inv.dueDate, recipientEmail: inv.recipientEmail || "", notes: inv.notes || "" }, lines: toEdit(inv.lines) }), [inv]); + const [form, setForm] = useState(initial.form); + const [lines, setLines] = useState(initial.lines); + const { busy, error, run } = useSubmit(); + const save = (e: React.FormEvent) => { + e.preventDefault(); + run(async () => { + await api(`/api/admin/billing/invoices/${inv.id}`, { method: "PUT", body: { ...form, lines: fromEdit(lines) } }); + onSaved(inv.status === "approved" ? "Saved. It's still approved and goes out on its date." : "Saved."); + }); + }; + return ( + +
+
+
setForm({ ...form, issueDate: e.target.value })} />
+
setForm({ ...form, dueDate: e.target.value })} />
+
setForm({ ...form, recipientEmail: e.target.value })} />
+
+ +