@@ -77,17 +77,11 @@ export async function RoutesData(props: {
77
77
78
78
const totalPages = Math . ceil ( filteredCount / DEFAULT_PAGE_SIZE ) ;
79
79
80
- const activePage = Number ( props . searchParams . page || 1 ) ;
81
- const pageSize = DEFAULT_PAGE_SIZE ;
82
- const startIndex = ( activePage - 1 ) * pageSize ;
83
- const endIndex = startIndex + pageSize ;
84
- const paginatedRoutes = routesToRender . slice ( startIndex , endIndex ) ;
85
-
86
80
return (
87
81
< >
88
82
< main >
89
83
{ /* empty state */ }
90
- { paginatedRoutes . length === 0 ? (
84
+ { routesToRender . length === 0 ? (
91
85
< div className = "flex h-[300px] items-center justify-center rounded-lg border p-8 lg:h-[500px]" >
92
86
< p className = "text-2xl" > No Results found</ p >
93
87
</ div >
@@ -111,7 +105,7 @@ export async function RoutesData(props: {
111
105
</ TableRow >
112
106
</ TableHeader >
113
107
< TableBody >
114
- { paginatedRoutes . map ( ( route ) => (
108
+ { routesToRender . map ( ( route ) => (
115
109
< RouteListRow
116
110
key = { `${ route . originToken . chainId } :${ route . originToken . address } -${ route . destinationToken . chainId } :${ route . destinationToken . address } ` }
117
111
originChainId = { route . originToken . chainId }
@@ -131,7 +125,7 @@ export async function RoutesData(props: {
131
125
</ TableContainer >
132
126
) : (
133
127
< ul className = "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3" >
134
- { paginatedRoutes . map ( ( route ) => (
128
+ { routesToRender . map ( ( route ) => (
135
129
< li
136
130
key = { `${ route . originToken . chainId } :${ route . originToken . address } -${ route . destinationToken . chainId } :${ route . destinationToken . address } ` }
137
131
className = "h-full"
@@ -155,12 +149,15 @@ export async function RoutesData(props: {
155
149
</ main >
156
150
< div className = "h-10" />
157
151
{ totalPages > 1 && (
158
- < ChainlistPagination totalPages = { totalPages } activePage = { activePage } />
152
+ < ChainlistPagination
153
+ totalPages = { totalPages }
154
+ activePage = { Number ( props . searchParams . page ) || 1 }
155
+ />
159
156
) }
160
157
< div className = "h-4" />
161
158
< p className = "text-balance text-center text-muted-foreground text-sm" >
162
159
Showing{ " " }
163
- < span className = "text-accent-foreground" > { paginatedRoutes . length } </ span > { " " }
160
+ < span className = "text-accent-foreground" > { routesToRender . length } </ span > { " " }
164
161
out of{ " " }
165
162
{ filteredCount !== totalCount ? (
166
163
< >
0 commit comments