@@ -267,6 +267,13 @@ class QuoteAssetGridTradeArchiveIcon extends React.Component {
267
267
268
268
const totalPages = Math . ceil ( stats . trades / limit ) ;
269
269
// If total
270
+ paginationItems . push (
271
+ < Pagination . First
272
+ key = 'first'
273
+ disabled = { page === 1 || totalPages === 1 }
274
+ onClick = { ( ) => this . setPage ( 1 ) }
275
+ />
276
+ ) ;
270
277
if ( page === 1 || totalPages === 1 ) {
271
278
paginationItems . push (
272
279
< Pagination . Prev key = 'pagination-item-prev' disabled />
@@ -279,28 +286,19 @@ class QuoteAssetGridTradeArchiveIcon extends React.Component {
279
286
/>
280
287
) ;
281
288
}
282
- [ ...Array ( 3 ) . keys ( ) ] . forEach ( x => {
283
- if ( page === 1 && x === 0 ) {
284
- paginationItems . push (
285
- < Pagination . Item
286
- active
287
- key = { `pagination-item-${ x } ` }
288
- onClick = { ( ) => this . setPage ( page ) } >
289
- { page }
290
- </ Pagination . Item >
291
- ) ;
292
- } else {
293
- const pageNum = page === 1 ? page + x : page + x - 1 ;
294
- paginationItems . push (
295
- < Pagination . Item
296
- active = { pageNum === page }
297
- disabled = { pageNum > totalPages }
298
- key = { `pagination-item-${ x } ` }
299
- onClick = { ( ) => this . setPage ( pageNum ) } >
300
- { pageNum }
301
- </ Pagination . Item >
302
- ) ;
303
- }
289
+ const maxButtons = 8 ;
290
+ const buttons = Math . min ( maxButtons , ~ ~ totalPages ) ;
291
+ [ ...Array ( buttons ) . keys ( ) ] . forEach ( x => {
292
+ const pageNum = Math . min ( Math . max ( x + 1 , page + x + 1 - Math . ceil ( buttons / 2 ) ) , totalPages + x + 1 - buttons ) ;
293
+ paginationItems . push (
294
+ < Pagination . Item
295
+ active = { pageNum === page }
296
+ disabled = { pageNum > totalPages }
297
+ key = { `pagination-item-${ x } ` }
298
+ onClick = { ( ) => this . setPage ( pageNum ) } >
299
+ { pageNum }
300
+ </ Pagination . Item >
301
+ ) ;
304
302
} ) ;
305
303
if ( page === totalPages || page >= totalPages ) {
306
304
paginationItems . push (
@@ -314,6 +312,14 @@ class QuoteAssetGridTradeArchiveIcon extends React.Component {
314
312
/>
315
313
) ;
316
314
}
315
+ const lastPage = totalPages ;
316
+ paginationItems . push (
317
+ < Pagination . Last
318
+ key = 'last'
319
+ disabled = { page === totalPages || page >= totalPages }
320
+ onClick = { ( ) => this . setPage ( lastPage ) }
321
+ />
322
+ ) ;
317
323
318
324
return (
319
325
< div className = 'coin-info-quote-asset-grid-trade-archive-wrapper d-inline-block' >
@@ -462,6 +468,13 @@ class QuoteAssetGridTradeArchiveIcon extends React.Component {
462
468
) : (
463
469
< React . Fragment >
464
470
< div className = 'row' >
471
+ < div className = 'd-flex w-100 flex-row justify-content-between px-3 mb-2' >
472
+ < Pagination
473
+ className = 'justify-content-center mb-0'
474
+ size = 'sm' >
475
+ { paginationItems }
476
+ </ Pagination >
477
+ </ div >
465
478
< Table striped bordered hover size = 'sm' responsive >
466
479
< thead >
467
480
< tr >
0 commit comments