Files
web/src/components/composites/payment/payment-modal.tsx

38 lines
847 B
TypeScript
Raw Normal View History

'use client'
import {MobilePayment} from './mobile-payment'
import {DesktopPayment} from './desktop-payment'
import {TradePlatform} from '@/lib/models/trade'
import {Dialog} from '@/components/ui/dialog'
import {PaymentProps} from './type'
export type PaymentModalProps = {
onSuccess?: () => void
onClose?: () => void
} & PaymentProps
export function PaymentModal(props: PaymentModalProps) {
const handleClose = (success: boolean) => {
if (success && props.onSuccess) {
props.onSuccess()
}
}
return (
<Dialog
defaultOpen={true}
onOpenChange={(open) => {
if (!open) props.onClose?.()
}}>
{props.platform === TradePlatform.Mobile ? (
<MobilePayment
{...props}
/>
) : (
<DesktopPayment
{...props}
/>
)}
</Dialog>
)
}