Skip to content

show dominant culture in provinces editor - #1777

Draft
inviktos wants to merge 2 commits into
Azgaar:masterfrom
inviktos:feature/province-dominant-culture
Draft

show dominant culture in provinces editor#1777
inviktos wants to merge 2 commits into
Azgaar:masterfrom
inviktos:feature/province-dominant-culture

Conversation

@inviktos

@inviktos inviktos commented Sep 4, 2026

Copy link
Copy Markdown

Adds dominant culture as a displayable column in the provinces editor

@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit 3167a78
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a9b42c6c8059b00089abb7f
😎 Deploy Preview https://deploy-preview-1777--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 self-requested a review September 4, 2026 06:26
@barrulus barrulus moved this from Backlog to In review in FMG dev board Sep 4, 2026
@barrulus

barrulus commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Welcome, and thanks for the PR! I checked it out locally: tsc, vitest and biome are clean, and a headless run recomputing the dominant culture independently for every province matched your column exactly, so the core logic is right. A few things to line up with the rest of the codebase before merge. I've ordered them so each builds on the last.

1. Count burg population under the cell's culture. Right now line 88 uses burg.culture ?? cellCulture. The Cultures editor (cultures-editor.ts:204) and the charts key burg population by cells.culture[i], and the Burg editor's culture select only updates burg.culture, so after that edit your column and the Cultures editor would disagree on where a city's people belong. Passing cellCulture keeps them consistent. Your first test will then expect culture 1 with 80/130.

2. Store the value on the Province. The Province interface already has area/rural/urban/burgs under "statistics computed by the provinces editor". Adding culture?: number (and cultureShare?: number for the tooltip) there and setting it in the same forEach lets you delete the dominantCultures Map and read p.culture directly in sortBy and the renderer. Check for "no population" with === undefined, since culture 0 (Wildlands) is a real culture.

3. Make the name dialog agree. The province name dialog already shows "Dominant culture:" from the centre cell (cells.culture[p.center], line 760) and uses it for name regeneration (line 898). With your column, the row and the dialog can show different cultures under the same label. Reading p.culture ?? cells.culture[p.center] in both places fixes that and makes naming follow population.

4. CSV export. downloadProvincesData() could add a Dominant Culture column after Capital so the download matches the table (the States editor CSV exports its Culture column).

5. Small polish: width 10em to match the States editor (the 9em header touches "State"); only set the Maps when an entry is created so big maps skip ~1.5M redundant writes; and add a line to latestPublicChanges in src/services/versioning.ts alongside the changelog.

Push the fixes as new commits on the same branch and I'll re-check. Running npm run lint, npx tsc --noEmit and npm test before pushing will keep CI green.

@inviktos

inviktos commented Sep 4, 2026

Copy link
Copy Markdown
Author

@barrulus I believe it made the changes

@inviktos
inviktos marked this pull request as draft September 4, 2026 23:22
@barrulus barrulus self-assigned this Sep 4, 2026
@barrulus barrulus added the theme: ui-editors UI / UX & Editors label Sep 4, 2026
@barrulus barrulus moved this from In review to In progress in FMG dev board Sep 4, 2026
@Azgaar

Azgaar commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Request to rework: dominant culture with percentage display. As it's introduced in Provinces, the same change should be done for States. Columns name must be still simply "Culture", but tooltip can provide more details. The main calculation code should probably live in cultures-generator module.

@barrulus

barrulus commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Request to rework: dominant culture with percentage display. As it's introduced in Provinces, the same change should be done for States. Columns name must be still simply "Culture", but tooltip can provide more details. The main calculation code should probably live in cultures-generator module.

This was moved to draft yesterday because it is currently being reworked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme: ui-editors UI / UX & Editors

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants