Skip to content

Paginate burgs, states, cultures, religions, rivers & routes editors#1469

Open
barrulus wants to merge 1 commit into
Azgaar:masterfrom
barrulus:feat/editor-pagination-upstream
Open

Paginate burgs, states, cultures, religions, rivers & routes editors#1469
barrulus wants to merge 1 commit into
Azgaar:masterfrom
barrulus:feat/editor-pagination-upstream

Conversation

@barrulus

@barrulus barrulus commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Renders large editor lists 200 rows at a time so they stay responsive on big maps. The States editor in particular was effectively unusable at 1k+ states because it renders a coat-of-arms per row; it now renders the COA only for the current page.

What changed

  • Shared pagination/sort helpers in editors.js: getActiveSort, sortDataByActiveHeader, getEditorPage, renderEditorPagination, bindEditorSortReset.
  • Pagination added to the Burgs, States, Cultures, Religions, Rivers, and Routes overviews/editors.
  • Each one sorts the full filtered set (so sorting spans all pages, an upgrade over the old DOM-only applySorting), computes footer totals/averages over the full set, then renders only the current page and draws Page n of N controls in the footer.
  • CSV exports operate over the full set (some previously read the rendered DOM, which would now be only the visible page).
  • Search and state/culture filters (burgs) and column sort reset to page 1 and filter/sort across all pages; lazily-computed route name/length are populated for the full set so sort/footer/CSV stay correct.
  • Manual re-assignment map-clicks, the culture-center hover, and randomizeStatesExpansion are guarded against rows that aren't on the current page.
  • The footer pager fills the table-driven width without contributing to the dialog's fit-content width, so narrow dialogs (e.g. Rivers) don't get an empty gutter.

Notes

  • No new HTML or CSS — the pager UI is created entirely in JS (page size 200).
  • Seven files touched; all were identical to current master before this change.

Test plan

  • Open each editor on a 1k+ map: paginates at 200; prev/next/jump/clamp work; pager hidden when the list fits one page.
  • Column sort resets to page 1 and orders the full set (top of page 1 is the global max/min).
  • Footer totals/averages stable across pages; percentage mode (states/cultures/religions) correct on a later page.
  • Burgs: state/culture filters + search reset to page 1 and apply across all pages; "regenerate names" applies to the full filtered set.
  • CSV export from a non-first page contains all rows.
  • States manual re-assignment + randomize produce no console errors.

@inviktos

inviktos commented Jun 9, 2026

Copy link
Copy Markdown

Much needed changes for maps with complex and large numbers of states.Greatly aids performance and quality!

@barrulus barrulus changed the title Paginate states, cultures, religions, rivers & routes editors Paginate burgs, states, cultures, religions, rivers & routes editors Jun 9, 2026
@barrulus
barrulus force-pushed the feat/editor-pagination-upstream branch from f5926b4 to f8045f0 Compare June 9, 2026 18:35
@Azgaar
Azgaar self-requested a review June 9, 2026 18:45
@Azgaar

Azgaar commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Good idea, but I don't like the code, has to be "un-vibed". editors.js is ancient, probably would need to refactor it first to reduce the entropy.

@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit f5926b4
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a285acfff117b0008a394ca
😎 Deploy Preview https://deploy-preview-1469--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@barrulus

barrulus commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Good idea, but I don't like the code, has to be "un-vibed". editors.js is ancient, probably would need to refactor it first to reduce the entropy.

Use the idea, don't use the code

@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit efe827a
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a5149de56dab500084883d4
😎 Deploy Preview https://deploy-preview-1469--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@barrulus barrulus closed this Jul 7, 2026
@Azgaar

Azgaar commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Should it be open for a while? We can integrate it when the migration is done.

@barrulus

barrulus commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Happy to keep it open but also happy to redo it once the uk updates are complete.

The code is here whether it is open or not!

@Azgaar Azgaar reopened this Jul 10, 2026
@barrulus

Copy link
Copy Markdown
Contributor Author

do you want me to resolve these conflicts now or later?

@barrulus
barrulus force-pushed the feat/editor-pagination-upstream branch from f8045f0 to 5513666 Compare July 10, 2026 19:31
Large editors render every row into the DOM at once, which is slow and
unwieldy on big maps (thousands of burgs/routes). This adds shared
pagination so each editor renders at most one page (200 rows) at a time.

Shared helpers in editors.js:
- getEditorPage(data, pageRef, size) clamps the page and returns the slice
- sortDataByActiveHeader(header, data, accessors) sorts the FULL dataset by
  the active column so sorting spans all pages, not just the visible one
- renderEditorPagination(footer, info, onGoto) injects prev/next + jump-to
  controls into the editor footer; hidden when everything fits on one page
- bindEditorSortReset(header, onSort) resets to page 1 on a column-sort click

Each editor: sorts + totals over the full set, slices the current page for
rendering, resets to page 1 on open / filter change / sort, guards row
lookups that may target a row on another page, and exports CSV from the
data model rather than the (now partial) DOM.

The footer pager fills the table width without widening the fit-content
dialog. No new HTML/CSS; the pager UI is built in JS.
@barrulus
barrulus force-pushed the feat/editor-pagination-upstream branch from 5513666 to efe827a Compare July 10, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants