@@ -458,9 +458,13 @@ function If({ children, t }: { children: React.ReactNode; t: boolean }) {
458
458
return < > { children } </ >
459
459
}
460
460
461
- function ChangesSummary ( { changes } : { changes : OsmChanges } ) {
461
+ const PAGE_SIZE = 5
462
+
463
+ function ChangesSummary ( {
464
+ changes,
465
+ pageSize = PAGE_SIZE ,
466
+ } : { changes : OsmChanges ; pageSize ?: number } ) {
462
467
const [ currentPage , setCurrentPage ] = useState ( 0 )
463
- const changesPerPage = 10
464
468
465
469
// Get all changes for pagination
466
470
const allChanges : Array < OsmChange & { type : "node" | "way" | "relation" } > = [
@@ -478,9 +482,9 @@ function ChangesSummary({ changes }: { changes: OsmChanges }) {
478
482
} ) ) ,
479
483
]
480
484
481
- const totalPages = Math . ceil ( allChanges . length / changesPerPage )
482
- const startIndex = currentPage * changesPerPage
483
- const endIndex = startIndex + changesPerPage
485
+ const totalPages = Math . ceil ( allChanges . length / pageSize )
486
+ const startIndex = currentPage * pageSize
487
+ const endIndex = startIndex + pageSize
484
488
const currentChanges = allChanges . slice ( startIndex , endIndex )
485
489
486
490
const goToNextPage = ( ) => {
@@ -548,13 +552,13 @@ function ChangesSummary({ changes }: { changes: OsmChanges }) {
548
552
< Details >
549
553
< DetailsSummary > CHANGES PREVIEW</ DetailsSummary >
550
554
< DetailsContent >
551
- < div className = "max-h-64 overflow-y-auto flex flex-col gap-2" >
555
+ < div className = "flex flex-col gap-2" >
552
556
{ currentChanges . map ( ( change , i ) => (
553
557
< ChangePreview
554
558
key = { `${ change . type } -${ change . entity . id } ` }
555
559
change = { change }
556
560
entityType = { change . type }
557
- count = { i + 1 }
561
+ count = { startIndex + i + 1 }
558
562
/>
559
563
) ) }
560
564
</ div >
0 commit comments