Skip to content

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

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

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 f9d4b49
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a74808bebbd010008f6f79b
😎 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 2 times, most recently from 5513666 to efe827a Compare July 10, 2026 19:36
Large editors render every row into the DOM at once, which is slow on big
maps. Each editor now renders at most one page (100 rows) via a headless
table core (src/components/dialog/table.ts): sorting and footer totals
cover the full dataset, the page resets on open/filter/sort, and the
footer pager fills the table width without widening fit-content dialogs.
Full-dataset sorting helpers extend src/components/dialog/sorting.ts.
No window globals; helpers are imported.
@barrulus
barrulus force-pushed the feat/editor-pagination-upstream branch from efe827a to f9d4b49 Compare August 6, 2026 12:39
@barrulus

barrulus commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Rebuilt on current master now that the editor migration is complete. The shared helpers moved out of the deleted editors.js into src/components/dialog/table.ts + sorting.ts as plain imports — no window globals. Page size is 100 per the technical-channel discussion. Sorting, footer totals, and the CSV exports all operate on the full dataset, not the visible page. Column show/hide follows as a separate PR, per the proposal discussed on Discord.

@Azgaar

Azgaar commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Do we close it, @barrulus?

barrulus added a commit to barrulus/Fantasy-Map-Generator that referenced this pull request Aug 7, 2026
…1469/Azgaar#1564)

Ports the paginated-table column show/hide stack onto the fork's
customized editors: burgs keeps megalopolis badges, the skyburg button,
GL label rebuild hooks and the altitude CSV column; states keeps the
brush/demote/merge panel. The fork's older per-editor pagination
scaffolding is replaced by the shared table.ts helpers. Dialog widths
use the fork's fitContent() helper for Firefox.
@barrulus

barrulus commented Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Do we close it, @barrulus?

Yes, let's close it. #1564 carries this PR's commit as its base, so pagination and columns can be reviewed together there.

@barrulus barrulus closed this Aug 7, 2026
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