From 111c17d4990dc2fa8abe4d3bfc6171d3997b0907 Mon Sep 17 00:00:00 2001 From: Doxa Maps Date: Wed, 30 Sep 2026 22:54:56 +0000 Subject: [PATCH] Poster Design: draw the sample country sheet through makeCountrySheet The Styles tab called generateCountrySheet directly and built the country without its region, so the sample would have printed in the old flat teal while the Country Posters wall prints it region-hued. It now draws through the one shared path (library/packet/countrySheet.js), which carries the region and computes the series the way the wall does; the inline series arithmetic is gone. check:country-sheet-one-path passes. --- plugin-designs/poster-design/poster-styles.vue | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/plugin-designs/poster-design/poster-styles.vue b/plugin-designs/poster-design/poster-styles.vue index c1ccc6bf2..94cb1e558 100644 --- a/plugin-designs/poster-design/poster-styles.vue +++ b/plugin-designs/poster-design/poster-styles.vue @@ -22,6 +22,7 @@ import { createPeopleGroupRecords } from '@map/lists/peopleGroupRecords.js' import { getApiBaseUrl } from '@map/api/apiBaseUrl.js' import { getRuntimeLocale, detectLocale } from '@map/i18n/index.js' import countryData from '@map/data/country-posters.json' +import { makeCountrySheet } from '@map/packet/countrySheet.js' import { listConfigurations, FAMILY_KEYS, SAMPLE_COUNTRY_ID } from './src/templates.js' import FullDetailsDialog from './src/FullDetailsDialog.vue' @@ -54,17 +55,10 @@ const recordsFor = createPeopleGroupRecords({ lang: () => getRuntimeLocale() || detectLocale(), profileConfig, }) -// The same call the country wall makes for a country's sheet, with the series facts of the sample's tier. -async function countrySheet(format) { - if (!sample) return '' - const [{ generateCountrySheet }, { ISO3_NAME }, records] = await Promise.all([ - import('@map/packet/posterSheets.js'), import('@map/data/iso3-name.js'), - recordsFor({ type: 'country', values: [sample.iso3] }), - ]) - const tier = (countryData.countries || []).filter((x) => x.sheet === sample.sheet) - const series = { totalGroups: tier.reduce((a, x) => a + (x.count || 0), 0), totalLists: tier.length, index: tier.findIndex((x) => x.id === sample.id) + 1 } - return generateCountrySheet({ country: sample, records, assetsBase: assetsBase.value, ISO3_NAME, format, series }) -} +// The ONE path every surface draws a country sheet through (the Country Posters wall, the Regions tab), +// so the sample carries its region hue and its "map N of M" exactly as the wall prints it. +const sheetFor = makeCountrySheet({ records: recordsFor, assetsBase: () => assetsBase.value, countries: countryData.countries || [] }) +const countrySheet = (format) => (sample ? sheetFor(sample, format) : Promise.resolve('')) const ctx = { countrySheet } // The printed document's size, measured when it is drawn: what "file size" means in the details.