11"use client" ;
22import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors" ;
3+ import { PaginationButtons } from "@/components/pagination-buttons" ;
34import { UnderlineLink } from "@/components/ui/UnderlineLink" ;
45import { TrackedUnderlineLink } from "@/components/ui/tracked-link" ;
56import {
@@ -62,6 +63,8 @@ function BackendWalletsSection(props: {
6263 const activeWalletChain = useActiveWalletChain ( ) ;
6364 const [ _chainId , setChainId ] = useState < number > ( ) ;
6465 const chainId = _chainId || activeWalletChain ?. id || 1 ;
66+ const pageSize = 10 ;
67+ const [ page , setPage ] = useState ( 1 ) ;
6568
6669 const backendWallets = useEngineBackendWallets ( {
6770 instanceUrl : instance . url ,
@@ -72,6 +75,13 @@ function BackendWalletsSection(props: {
7275 authToken,
7376 } ) ;
7477
78+ const totalPages = Math . ceil ( ( backendWallets . data ?. length ?? 0 ) / pageSize ) ;
79+
80+ const walletsToShow = backendWallets . data ?. slice (
81+ ( page - 1 ) * pageSize ,
82+ page * pageSize ,
83+ ) ;
84+
7585 return (
7686 < section className = "rounded-lg border border-border bg-card" >
7787 < div className = "flex flex-col gap-5 p-6 lg:flex-row lg:items-center lg:justify-between" >
@@ -144,13 +154,24 @@ function BackendWalletsSection(props: {
144154
145155 < BackendWalletsTable
146156 instanceUrl = { instance . url }
147- wallets = { backendWallets . data ?? [ ] }
157+ wallets = { walletsToShow ?? [ ] }
148158 isPending = { backendWallets . isPending }
149159 isFetched = { backendWallets . isFetched }
150160 authToken = { authToken }
151161 chainId = { chainId }
152162 client = { props . client }
153163 />
164+
165+ { totalPages > 1 && (
166+ < div className = "border-t p-4" >
167+ < PaginationButtons
168+ activePage = { page }
169+ totalPages = { totalPages }
170+ onPageClick = { setPage }
171+ className = "mx-0 w-auto"
172+ />
173+ </ div >
174+ ) }
154175 </ section >
155176 ) ;
156177}
0 commit comments