+
-
-
- Your cards
-
-
- {accounts && accounts.data.map((a: Account) => (
-
- ))}
+
+
+ Your cards
+
+
+ {accounts && accounts.data.map((a: Account) => (
+
+ ))}
+
-
-
+
+
)
}
diff --git a/app/(root)/page.tsx b/app/(root)/page.tsx
index 697454b..d00f70e 100644
--- a/app/(root)/page.tsx
+++ b/app/(root)/page.tsx
@@ -4,53 +4,57 @@ import RightSidebar from '@/components/RightSidebar';
import TotalBalanceBox from '@/components/TotalBalanceBox';
import { getAccount, getAccounts } from '@/lib/actions/bank.actions';
import { getLoggedInUser } from '@/lib/actions/user.actions';
+import Loading from './loading';
+import { Suspense } from 'react';
const Home = async ({ searchParams: { id, page } }: SearchParamProps) => {
const currentPage = Number(page as string) || 1;
const loggedIn = await getLoggedInUser();
- const accounts = await getAccounts({
- userId: loggedIn.$id
+ const accounts = await getAccounts({
+ userId: loggedIn.$id
})
- if(!accounts) return;
-
+ if (!accounts) return;
+
const accountsData = accounts?.data;
const appwriteItemId = (id as string) || accountsData[0]?.appwriteItemId;
const account = await getAccount({ appwriteItemId })
return (
-
+
+
)
}
diff --git a/app/(root)/payment-transfer/page.tsx b/app/(root)/payment-transfer/page.tsx
index b11c510..84d14d8 100644
--- a/app/(root)/payment-transfer/page.tsx
+++ b/app/(root)/payment-transfer/page.tsx
@@ -2,29 +2,32 @@ import HeaderBox from '@/components/HeaderBox'
import PaymentTransferForm from '@/components/PaymentTransferForm'
import { getAccounts } from '@/lib/actions/bank.actions';
import { getLoggedInUser } from '@/lib/actions/user.actions';
-import React from 'react'
+import React, { Suspense } from 'react'
+import Loading from '../loading';
const Transfer = async () => {
const loggedIn = await getLoggedInUser();
- const accounts = await getAccounts({
- userId: loggedIn.$id
+ const accounts = await getAccounts({
+ userId: loggedIn.$id
})
- if(!accounts) return;
-
+ if (!accounts) return;
+
const accountsData = accounts?.data;
return (
-
-
+ }>
+
+
)
}
diff --git a/app/(root)/transaction-history/page.tsx b/app/(root)/transaction-history/page.tsx
index d8a16a4..26915de 100644
--- a/app/(root)/transaction-history/page.tsx
+++ b/app/(root)/transaction-history/page.tsx
@@ -4,71 +4,74 @@ import TransactionsTable from '@/components/TransactionsTable';
import { getAccount, getAccounts } from '@/lib/actions/bank.actions';
import { getLoggedInUser } from '@/lib/actions/user.actions';
import { formatAmount } from '@/lib/utils';
-import React from 'react'
+import React, { Suspense } from 'react'
+import Loading from '../loading';
-const TransactionHistory = async ({ searchParams: { id, page }}:SearchParamProps) => {
+const TransactionHistory = async ({ searchParams: { id, page } }: SearchParamProps) => {
const currentPage = Number(page as string) || 1;
const loggedIn = await getLoggedInUser();
- const accounts = await getAccounts({
- userId: loggedIn.$id
+ const accounts = await getAccounts({
+ userId: loggedIn.$id
})
- if(!accounts) return;
-
+ if (!accounts) return;
+
const accountsData = accounts?.data;
const appwriteItemId = (id as string) || accountsData[0]?.appwriteItemId;
const account = await getAccount({ appwriteItemId })
-const rowsPerPage = 10;
-const totalPages = Math.ceil(account?.transactions.length / rowsPerPage);
+ const rowsPerPage = 10;
+ const totalPages = Math.ceil(account?.transactions.length / rowsPerPage);
-const indexOfLastTransaction = currentPage * rowsPerPage;
-const indexOfFirstTransaction = indexOfLastTransaction - rowsPerPage;
+ const indexOfLastTransaction = currentPage * rowsPerPage;
+ const indexOfFirstTransaction = indexOfLastTransaction - rowsPerPage;
-const currentTransactions = account?.transactions.slice(
- indexOfFirstTransaction, indexOfLastTransaction
-)
+ const currentTransactions = account?.transactions.slice(
+ indexOfFirstTransaction, indexOfLastTransaction
+ )
return (
-
-
-
-
+
}>
+
+
+
+
-
-
-
-
{account?.data.name}
-
- {account?.data.officialName}
-
-
- ●●●● ●●●● ●●●● {account?.data.mask}
-
-
-
-
-
Current balance
-
{formatAmount(account?.data.currentBalance)}
+
+
+
+
{account?.data.name}
+
+ {account?.data.officialName}
+
+
+ ●●●● ●●●● ●●●● {account?.data.mask}
+
+
+
+
+
Current balance
+
{formatAmount(account?.data.currentBalance)}
+
-
-
-
+
+
{totalPages > 1 && (
)}
-
+
+
-
+
)
}