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.
This commit is contained in:
parent
4129ad4bfd
commit
111c17d499
1 changed files with 5 additions and 11 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue