import { Description, Dialog, DialogBackdrop, DialogPanel, DialogTitle, } from '@headlessui/react' import type { ReactNode } from 'react' import { LeftArrow } from '~/components/icons/left-arrow' import { Button } from '~/components/ui/button' import { APP } from '~/data/meta' export type ModalProperties = { onClose: () => void children?: ReactNode isOpen?: 'error' | 'warning' | 'resetPassword' | 'register' | 'payment' } type DescriptionMap = { [key in Exclude]: string } const DESCRIPTIONS: DescriptionMap = { resetPassword: 'Link Reset Password telah dikirimkan ke email anda', register: 'Selamat! Pendaftaran anda berhasil!', payment: 'Selamat! Pembayaran anda berhasil!', warning: 'Mohon maaf fitur berikut hanya untuk anggota yang sudah tersubscribe', error: 'Terjadi kesalahan. Silakan coba lagi.', } export const SuccessModal = ({ isOpen, onClose }: ModalProperties) => { if (!isOpen) return const message = DESCRIPTIONS[isOpen] || 'Terjadi kesalahan. Silakan coba lagi.' return (
{APP.title} {message}
{['resetPassword', 'register', 'payment'].includes(isOpen) && (
{APP.title}
)} {isOpen === 'warning' && (
{APP.title}
)}
) }