- Uninstalls name the product (agent 1.5.0); a whole-church uninstall marks every product of the church on that server removed. Older agents are refused while the church has others. - A second product's uninstall joins one already planned (one export and one uninstall) or gets its own time; the last product removes the whole church. Accounts goes last. - Remove an install from the Hub after 24 hours without a heartbeat (POST .../forget). - Archive and restore customers (migration 20261123090000_customer_archive). - Several addresses for a customer's email and billing email, with a + button. - Statements show R0 invoices' amounts. Vendors contracts 1.16.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
2.0 KiB
TypeScript
42 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import React from "react";
|
|
import { Plus, X } from "lucide-react";
|
|
|
|
/** The addresses in a stored value ("a@x.org, b@x.org"). */
|
|
export const emailsOf = (value: string | null | undefined) => String(value || "").split(/[\s,;]+/).map(s => s.trim()).filter(Boolean);
|
|
|
|
/**
|
|
* Hub 2.12.0: one or more email addresses, one per row, with + to add another. The value is the
|
|
* comma-separated list the API stores ("a@x.org, b@x.org"); empty rows are dropped when saved.
|
|
*/
|
|
export function EmailList({ id, label, value, onChange, placeholder, max = 10 }: {
|
|
id: string; label: string; value: string; onChange: (v: string) => void; placeholder?: string; max?: number;
|
|
}) {
|
|
// Keep an empty row while typing: split on commas only, so a half-typed address stays put.
|
|
const rows = value === "" ? [""] : value.split(",").map(s => s.trim());
|
|
const set = (next: string[]) => onChange(next.join(", "));
|
|
return (
|
|
<div>
|
|
<label className="label" htmlFor={`${id}-0`}>{label}</label>
|
|
<div className="space-y-2">
|
|
{rows.map((r, i) => (
|
|
<div key={i} className="flex gap-2">
|
|
<input id={`${id}-${i}`} type="email" className="input" value={r} placeholder={i === 0 ? placeholder : "another@church.org"}
|
|
aria-label={i === 0 ? undefined : `${label} ${i + 1}`}
|
|
onChange={e => set(rows.map((x, j) => (j === i ? e.target.value.replace(/[,;\s]/g, "") : x)))} />
|
|
{rows.length > 1 && (
|
|
<button type="button" className="btn-secondary px-2" aria-label={`Remove ${r || "this address"}`} onClick={() => set(rows.filter((_, j) => j !== i))}><X className="h-4 w-4" /></button>
|
|
)}
|
|
</div>
|
|
))}
|
|
</div>
|
|
{rows.length < max && (
|
|
<button type="button" className="mt-2 inline-flex items-center gap-1 text-sm text-indigo-600 hover:underline" onClick={() => set([...rows, ""])}>
|
|
<Plus className="h-4 w-4" /> Add another address
|
|
</button>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|