import { Show, type JSX } from "solid-js" import Modal from "@/components/Modal" import type { CardPortal, NwcSetup } from "@/lib/usePaymentSetup" type PaymentSetupShellProps = { open: boolean onClose: () => void title: string description: string error?: string footer: JSX.Element children: JSX.Element } // Shared chrome for the payment-setup dialogs: the modal frame, the // title/description header with a close button, the error line, and the footer // container. Each caller supplies the body (children) and footer buttons. export function PaymentSetupShell(props: PaymentSetupShellProps) { return (

{props.title}

{props.description}

{props.children}

{props.error}

{props.footer}
) } // The fixed-height content region between the header and footer. export function PaymentSetupBody(props: { children: JSX.Element }) { return
{props.children}
} // Footer for every payment-setup dialog: a "Done" confirm once an action has // succeeded, otherwise a secondary dismiss button. Card setup never "saves" (it // redirects away), so it always shows the dismiss button. export function SetupFooter(props: { saved?: boolean; cancelLabel: string; onClose: () => void }) { return ( {props.cancelLabel} } >
) } // Lightning/NWC body: the URL input + save, or the success state once saved. export function NwcSetupBody(props: { nwc: NwcSetup }) { const nwc = props.nwc return (

Wallet connected!

Automatic payments are now enabled.

} >
nwc.setNwcUrl(e.currentTarget.value)} placeholder="nostr+walletconnect://..." class="w-full border border-gray-300 rounded-lg px-3 py-2" />
) } // Card body: an explanation plus the button that redirects to the Stripe portal. // `isUpdate` adjusts the copy for tenants who already have a card on file. export function CardSetupBody(props: { card: CardPortal; isUpdate?: boolean }) { return (

{props.isUpdate ? "Update or remove your card in the Stripe billing portal. We'll retry any due invoice after you're done." : "Add a payment card via Stripe to enable automatic billing. If an invoice is currently due, we will retry collection after card setup."}

) }