Hub 2.14.0: customer page as a summary and tabs, popups for every edit
- Customer page: header tiles (products, owing, next invoice, address, AI) and three tabs (Overview, Products, Invoices and payments), the tab in the URL; #billing links open Invoices and payments and Billing's links use ?tab=invoices. - Every add or edit is a popup (new Modal in components/ui.tsx: Esc / click outside, asks before discarding changes, focus kept inside, full screen on a phone). The page shows only read views. Record payment is a popup on Billing and the invoice page too. - One card per product: licence and billing fields in one Edit with one Save (each endpoint called only if its fields changed); suspend/revoke/reactivate/release in a ⋯ menu. Contact and billing details edited together. One page-level message. - History as one timeline with a filter; each kind on its own keeps its sortable table. - CustomerBilling.tsx split into components/customer/; plan in docs/CUSTOMER-PAGE-PLAN.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
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 (
|
||||
<section className="card space-y-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
<h2 className="font-semibold">{title}</h2>
|
||||
<div className="flex gap-2">
|
||||
{actions}
|
||||
{onEdit && <button type="button" className="btn-secondary px-2.5 py-1.5" onClick={onEdit}><Pencil className="h-3.5 w-3.5" /> {editLabel}</button>}
|
||||
</div>
|
||||
</div>
|
||||
{children}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
/** 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 (
|
||||
<div className={wide ? "sm:col-span-2" : ""}>
|
||||
<dt className="text-xs text-slate-500">{label}</dt>
|
||||
<dd className={`mt-0.5 break-words text-sm ${empty ? "text-slate-400" : "text-slate-900"}`}>{empty ? "—" : children}</dd>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export function Fields({ children }: { children: React.ReactNode }) {
|
||||
return <dl className="grid gap-3 sm:grid-cols-2">{children}</dl>;
|
||||
}
|
||||
|
||||
/** Save and Cancel at the foot of a popup form. */
|
||||
export function ModalButtons({ busy, onCancel, label = "Save" }: { busy: boolean; onCancel: () => void; label?: string }) {
|
||||
return (
|
||||
<div className="flex flex-wrap gap-2 pt-1">
|
||||
<button className="btn-primary" disabled={busy}>{busy ? "Saving…" : label}</button>
|
||||
<button type="button" className="btn-secondary" onClick={onCancel}>Cancel</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user