Redesign create invoice modal

This commit is contained in:
xmrcheckout
2026-01-08 16:43:11 +00:00
parent 6a3156991a
commit 0148caf501
2 changed files with 599 additions and 603 deletions
+19 -17
View File
@@ -77,22 +77,24 @@ export async function createInvoiceAction(
const isFiat = amountMode === "fiat"; const isFiat = amountMode === "fiat";
const instantConfirmation = formData.get("instant_confirmation") === "1"; const instantConfirmation = formData.get("instant_confirmation") === "1";
const confirmationRaw = String(formData.get("confirmation_target") ?? "").trim(); const confirmationRaw = String(formData.get("confirmation_target") ?? "").trim();
const confirmationTarget = instantConfirmation ? 0 : Number(confirmationRaw); let confirmationTarget: number | null = null;
if ( if (instantConfirmation) {
Number.isNaN(confirmationTarget) || confirmationTarget = 0;
confirmationTarget < 0 || } else if (confirmationRaw) {
confirmationTarget > 10 const parsed = Number(confirmationRaw);
) { if (Number.isNaN(parsed) || parsed < 0 || parsed > 10) {
return { return {
error: "Confirmation target must be between 0 and 10.", error: "Confirmation target must be between 0 and 10.",
invoiceId: null, invoiceId: null,
address: null, address: null,
amount: null, amount: null,
recipientName: null, recipientName: null,
description: null, description: null,
subaddressIndex: null, subaddressIndex: null,
warnings: null, warnings: null,
}; };
}
confirmationTarget = parsed;
} }
const amountRaw = String( const amountRaw = String(
formData.get(isFiat ? "amount_fiat" : "amount_xmr") ?? "" formData.get(isFiat ? "amount_fiat" : "amount_xmr") ?? ""
@@ -245,7 +247,7 @@ export async function createInvoiceAction(
amount_xmr: isFiat ? null : amountRaw, amount_xmr: isFiat ? null : amountRaw,
amount_fiat: isFiat ? amountRaw : null, amount_fiat: isFiat ? amountRaw : null,
currency: isFiat ? currency : null, currency: isFiat ? currency : null,
confirmation_target: confirmationTarget, ...(confirmationTarget !== null ? { confirmation_target: confirmationTarget } : {}),
expires_at: expiresAt, expires_at: expiresAt,
checkout_continue_url: checkoutContinueUrlRaw || null, checkout_continue_url: checkoutContinueUrlRaw || null,
metadata: metadata:
File diff suppressed because it is too large Load Diff