()
| 8 | import { usePayoutMethods } from '@/hooks/usePayoutMethod'; |
| 9 | |
| 10 | export default function Page() { |
| 11 | const [isDialogBoxOpen, setIsDialogBoxOpen] = useState<boolean>(false); |
| 12 | const [btnClicked, setBtnClicked] = useState<string>(''); |
| 13 | const { |
| 14 | upiAddresses, |
| 15 | solanaAddresses, |
| 16 | handleUpiDelete, |
| 17 | handleSolanaDelete, |
| 18 | fetchPayoutMethods, |
| 19 | } = usePayoutMethods(); |
| 20 | |
| 21 | const openDialog = (method: string) => { |
| 22 | setIsDialogBoxOpen(true); |
| 23 | setBtnClicked(method); |
| 24 | }; |
| 25 | |
| 26 | useEffect(() => { |
| 27 | fetchPayoutMethods(); |
| 28 | }, [isDialogBoxOpen]); |
| 29 | |
| 30 | const closeDialog = () => setIsDialogBoxOpen(false); |
| 31 | |
| 32 | return ( |
| 33 | <div className="h-max pb-4 transition-colors duration-500 md:p-8"> |
| 34 | <div className="mb-6 flex flex-col items-start justify-center px-4 pt-24 sm:px-8 md:pt-20"> |
| 35 | <div className="my-2 mb-6 text-3xl text-black transition-colors duration-500 dark:text-white"> |
| 36 | <h1 className="mt-16 font-semibold text-black dark:text-white sm:mt-12"> |
| 37 | Payout Methods |
| 38 | </h1> |
| 39 | </div> |
| 40 | |
| 41 | <div className="grid w-full grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3"> |
| 42 | <PayoutMethodCard |
| 43 | title="UPI Address" |
| 44 | description="Add your UPI ID" |
| 45 | imageSrc={UPI} |
| 46 | addresses={upiAddresses} |
| 47 | id={'UPI'} |
| 48 | onAdd={openDialog} |
| 49 | onDelete={handleUpiDelete} |
| 50 | /> |
| 51 | <PayoutMethodCard |
| 52 | title="Solana Address" |
| 53 | id={'Solana'} |
| 54 | description="Add your Solana wallet id" |
| 55 | imageSrc={SOL} |
| 56 | addresses={solanaAddresses} |
| 57 | onAdd={openDialog} |
| 58 | onDelete={handleSolanaDelete} |
| 59 | /> |
| 60 | </div> |
| 61 | |
| 62 | <NewPayoutDialog |
| 63 | onClose={closeDialog} |
| 64 | isOpen={isDialogBoxOpen} |
| 65 | title={btnClicked} |
| 66 | /> |
| 67 |
nothing calls this directly
no test coverage detected