diff --git a/src/app/search/page.tsx b/src/app/search/page.tsx
index 663d954..547b210 100644
--- a/src/app/search/page.tsx
+++ b/src/app/search/page.tsx
@@ -1,7 +1,9 @@
import { MATCH_TYPE } from 'src/constant';
import { notFound, redirect } from 'next/navigation';
-import { getSearchResult, getWalletSwaps } from 'src/services';
+import { getSearchResult } from 'src/services';
import Result from './_components/Result';
+import TableLoading from 'src/components/common/Table/TableLoading';
+import { Suspense } from 'react';
export async function generateMetadata({
searchParams,
@@ -38,21 +40,11 @@ const Page = async ({
if (requestId) redirect(`/swap/${requestId}`);
}
- const data = await getWalletSwaps(query, page);
- const { transactions, total } = data || {};
-
- if (!data || !transactions?.length) {
- notFound();
- }
-
return (
-
+ }>
+
+
);
};
diff --git a/src/components/common/Skeleton/Skeleton.types.ts b/src/components/common/Skeleton/Skeleton.types.ts
new file mode 100644
index 0000000..09c472e
--- /dev/null
+++ b/src/components/common/Skeleton/Skeleton.types.ts
@@ -0,0 +1,6 @@
+export type PropTypes = {
+ width?: number;
+ height?: number;
+ variant?: 'circular' | 'rectangular';
+ className?: string;
+};
diff --git a/src/components/common/Skeleton/index.tsx b/src/components/common/Skeleton/index.tsx
new file mode 100644
index 0000000..6eaef89
--- /dev/null
+++ b/src/components/common/Skeleton/index.tsx
@@ -0,0 +1,18 @@
+import type { PropTypes } from './Skeleton.types';
+
+export function Skeleton(props: PropTypes) {
+ const { height, width, variant = 'rectangular', className = '' } = props;
+ return (
+
+ );
+}
diff --git a/src/components/common/Table/TableLoading.tsx b/src/components/common/Table/TableLoading.tsx
new file mode 100644
index 0000000..332184b
--- /dev/null
+++ b/src/components/common/Table/TableLoading.tsx
@@ -0,0 +1,135 @@
+import { useId } from 'react';
+import TableHead from './TableHead';
+import { Skeleton } from '../Skeleton';
+import Link from 'next/link';
+
+function TableLoading() {
+ const id = useId();
+ return (
+
+
+
+
+ Search Results
+
+
+
+
+
+
+
+
+
+ {Array.from({ length: 14 }, () => {
+ return (
+
+
+
+
+
+
+
+
+ Detail
+
+
+ );
+ })}
+
+
+
+
+
+
+ );
+}
+
+export default TableLoading;
diff --git a/src/services/index.ts b/src/services/index.ts
index 12bb0d9..4eb8edb 100644
--- a/src/services/index.ts
+++ b/src/services/index.ts
@@ -33,7 +33,7 @@ export const getSearchResult = async (query: string) =>
.then(async (res) => await res.json())
.then((data) => data?.searchResult || data);
-export const getWalletSwaps = async (address: string, page?: string) =>
+export const getWalletSwaps = async (address: string, page?: number) =>
await fetch(
`${API_URL}/scanner/tx/wallet?walletAddress=${address}&offset=${SEARCH_RESULT_OFFSET}&page=${
page || 0