Skip to content

Commit fb7e347

Browse files
Decrease default changes page size
1 parent d727b75 commit fb7e347

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

apps/osm-merge/src/pages/merge.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,9 +458,13 @@ function If({ children, t }: { children: React.ReactNode; t: boolean }) {
458458
return <>{children}</>
459459
}
460460

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 }) {
462467
const [currentPage, setCurrentPage] = useState(0)
463-
const changesPerPage = 10
464468

465469
// Get all changes for pagination
466470
const allChanges: Array<OsmChange & { type: "node" | "way" | "relation" }> = [
@@ -478,9 +482,9 @@ function ChangesSummary({ changes }: { changes: OsmChanges }) {
478482
})),
479483
]
480484

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
484488
const currentChanges = allChanges.slice(startIndex, endIndex)
485489

486490
const goToNextPage = () => {
@@ -548,13 +552,13 @@ function ChangesSummary({ changes }: { changes: OsmChanges }) {
548552
<Details>
549553
<DetailsSummary>CHANGES PREVIEW</DetailsSummary>
550554
<DetailsContent>
551-
<div className="max-h-64 overflow-y-auto flex flex-col gap-2">
555+
<div className="flex flex-col gap-2">
552556
{currentChanges.map((change, i) => (
553557
<ChangePreview
554558
key={`${change.type}-${change.entity.id}`}
555559
change={change}
556560
entityType={change.type}
557-
count={i + 1}
561+
count={startIndex + i + 1}
558562
/>
559563
))}
560564
</div>

0 commit comments

Comments
 (0)