"use client"; import React from 'react'; import PageTitle from '@/components/ui/PageTitle'; import { Typography, Flex, Row, Col } from 'antd'; import type { Transaction } from '@/types/payment'; import { getAllTransaction } from '@/app/api/general/paymentService'; import { useQuery } from '@tanstack/react-query'; import PaymentCard from '@/components/ui/PaymentCard'; import AltLayout from '@/components/layout/AltLayout'; import LoadingScreen from '@/components/layout/LoadingScreen'; const { Text } = Typography; const now = new Date(); const month = now.toLocaleString('default', { month: 'long' }); const year = now.getFullYear().toString(); const CreatePersona: React.FC = () => { // Fetch payment types using React Query const { data: transactionList, isLoading } = useQuery({ queryKey: ['getAllTransaction'], queryFn: getAllTransaction }); // Show loading state while fetching data if (isLoading) return return ( TRANSACTION HISTORY}> {`Wallet Balance: RM ${transactionList?.reduce((accumVal, transaction) => accumVal + transaction.amount, 0)} `} {`${month} ${year}`} {transactionList?.map(({ id, name, created_at, amount }) => )} ); }; export default CreatePersona;