feat(web): currency becomes a closed select (ALL / EUR / USD)
Currency was free text in the tariff editor (composer page + lab draft modal — shared form) and the subscription plan editor; a typo could publish an unknown code onto immutable versions. Both now offer a closed select from lib/currencies.ts. An out-of-set code already stored on an old record is appended as an extra option so it displays + round-trips unchanged. Blank tariff form defaults to ALL (was EUR) — the site's actual currency. Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
type SubscriptionPlan,
|
||||
} from "./api.js";
|
||||
import { Modal } from "./ui/Modal.js";
|
||||
import { currencyOptions } from "./lib/currencies.js";
|
||||
|
||||
// Admin-only subscription PLAN catalog. Plans are admin-composed, versioned config the
|
||||
// operator sells from (so the operator never types a price). Editing a plan PUBLISHES A
|
||||
@@ -348,7 +349,11 @@ export function SubscriptionPlansManager() {
|
||||
<label className="label">{t("plans.pricePer")}</label>
|
||||
<span className="flex items-center gap-2">
|
||||
<input className="input w-28" value={form.priceMajor} inputMode="decimal" onChange={(e) => setForm((f) => f && { ...f, priceMajor: e.target.value })} placeholder="e.g. 800" />
|
||||
<input className="input w-16" value={form.currency} onChange={(e) => setForm((f) => f && { ...f, currency: e.target.value })} />
|
||||
<select className="input w-auto" value={form.currency} onChange={(e) => setForm((f) => f && { ...f, currency: e.target.value })}>
|
||||
{currencyOptions(form.currency).map((c) => (
|
||||
<option key={c} value={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
<span className="text-[0.75rem] text-term-muted">/ {t(PERIOD_KEY[form.period])}</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user