Skip to content

Paginate states, cultures, religions, rivers & routes editors#3

Merged
barrulus merged 15 commits into
mainfrom
feat/editor-pagination
Jun 9, 2026
Merged

Paginate states, cultures, religions, rivers & routes editors#3
barrulus merged 15 commits into
mainfrom
feat/editor-pagination

Conversation

@barrulus

@barrulus barrulus commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Adds page-by-page rendering (200 rows/page) to the five list editors that bog down on large maps — States, Cultures, Religions, Rivers, Routes. The States editor was effectively unusable at 1k+ states because it renders a coat-of-arms per row; it now only renders the COA for the current page.

  • New shared toolkit in editors.js: getActiveSort, sortDataByActiveHeader, getEditorPage, renderEditorPagination, bindEditorSortReset (+ EDITOR_PAGE_SIZE).
  • Each editor sorts the full filtered set (sort spans all pages, an upgrade over the old DOM-only applySorting), computes footer totals over the full set, renders only the current page, and draws Page n of N controls.
  • CSV exports made page-independent (previously read the DOM, so would export only the visible page).
  • Manual-assignment map-click handlers and culture-center hover guarded against off-page rows; randomizeStatesExpansion guarded.
  • Routes: lazily-computed name/length populated for the full set so sort/footer/CSV stay correct across pages.
  • Pager fix: footer fills the table-driven width without contributing to the dialog fit-content width (width:0; min-width:100%, pager wraps) so narrow dialogs (Rivers) don't get an empty gutter.
  • Chore: gitignore .claude/ (unblocks biome pre-commit hook); cache-bust ?v= bumps for changed scripts.

Spec: docs/superpowers/specs/2026-06-08-editor-pagination-design.md
Plan: docs/superpowers/plans/2026-06-08-editor-pagination.md

Test Plan

  • npx vitest run — 137/137 pass
  • npm run build — clean
  • Rivers pager/gutter verified in-browser
  • Each editor on a 1k+ map: paginates at 200; next/prev/jump/clamp; pager hidden at <=200
  • Column sort resets to page 1 and orders the full set
  • Footer totals stable across pages; percentage mode correct on later page
  • CSV export from a non-first page contains all rows
  • Rivers/Routes search resets to page 1 and filters across all pages
  • States manual re-assignment + randomize: no console errors

barrulus added 15 commits June 8, 2026 23:25
… gutter

The pager was appended into the editor footer, and the dialogs size with
fit-content (max-content of children). For narrow tables like Rivers the
footer+pager became the widest child and stretched the dialog, leaving an
empty gutter beside the rows. Make the footer fill the table-driven width
without contributing to it (width:0 + min-width:100%) and let the pager
wrap to its own line (flex-wrap).
@inviktos

inviktos commented Jun 9, 2026

Copy link
Copy Markdown

Changes look great and would help for large-scale maps a lot!

@barrulus barrulus merged commit e0e6521 into main Jun 9, 2026
3 of 4 checks passed
@netlify

netlify Bot commented Jun 9, 2026

Copy link
Copy Markdown

Deploy Preview for bazgaars-fmg ready!

Name Link
🔨 Latest commit 858ea2a
🔍 Latest deploy log https://app.netlify.com/projects/bazgaars-fmg/deploys/6a2844b57c9ea9000888a0f2
😎 Deploy Preview https://deploy-preview-3--bazgaars-fmg.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.

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.

2 participants