Punctuate the set-chart counts in one place, not the reader's browser

This commit is contained in:
Doxa Maps 2026-09-28 16:09:16 +00:00
parent 04ac124cb7
commit 5e0295add8
3 changed files with 24 additions and 3 deletions

View file

@ -24,6 +24,7 @@
*/
import { ref, computed, onMounted } from 'vue'
import { useShadowStyles } from '@map/composables/useShadowStyles.js'
import { formatCount } from '@map/utils/formatCount.js'
import { useBoardState } from '../useBoard.js'
import { useGiT } from '../useGiT.js'
import { loadNearRows, indexFor } from '../nearRows.js'
@ -58,7 +59,13 @@ const joined = computed(() => {
const layout = computed(() => layoutBoundedSet(joined.value, { r: 120, spread: 260 }))
const tally = computed(() => boundedSetTally(layout.value))
const fmt = (n) => (Number(n) || 0).toLocaleString()
// formatCount, not toLocaleString(): a bare toLocaleString follows the READER'S BROWSER,
// so one page could print 2,074 here and 2.074 in the panel beside it. formatCount holds
// en-US in one place until the Driver rules on numerals.
// The `|| 0` stays: formatCount FORMATS and deliberately does not decide what empty means —
// Number(undefined) is NaN, so handing it a missing count would print "NaN" where this has
// always printed 0. The locale source changes; the empty policy does not.
const fmt = (n) => formatCount(Number(n) || 0)
useShadowStyles(
'.gbs{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#f3f3f1}' +

View file

@ -20,6 +20,7 @@
*/
import { ref, computed, onMounted } from 'vue'
import { useShadowStyles } from '@map/composables/useShadowStyles.js'
import { formatCount } from '@map/utils/formatCount.js'
import { useBoardState } from '../useBoard.js'
import { useGiT } from '../useGiT.js'
import { loadNearRows, indexFor } from '../nearRows.js'
@ -67,7 +68,13 @@ const radii = computed(() => ringRadii({ innerR: 30, ringGap: 22 }))
const arrows = computed(() => layout.value.placed
.map((p) => { const a = inwardArrow(p, { innerR: 30 }); return a && { ...a, ring: p.ring } })
.filter(Boolean).slice(0, 400))
const fmt = (n) => (Number(n) || 0).toLocaleString()
// formatCount, not toLocaleString(): a bare toLocaleString follows the READER'S BROWSER,
// so one page could print 2,074 here and 2.074 in the panel beside it. formatCount holds
// en-US in one place until the Driver rules on numerals.
// The `|| 0` stays: formatCount FORMATS and deliberately does not decide what empty means —
// Number(undefined) is NaN, so handing it a missing count would print "NaN" where this has
// always printed 0. The locale source changes; the empty policy does not.
const fmt = (n) => formatCount(Number(n) || 0)
useShadowStyles(
'.gcs{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#f3f3f1}' +

View file

@ -20,6 +20,7 @@
*/
import { ref, computed } from 'vue'
import { useShadowStyles } from '@map/composables/useShadowStyles.js'
import { formatCount } from '@map/utils/formatCount.js'
import { useGiT } from '../useGiT.js'
import { BANDS, CULTURES, CENTRE_COLOR, ringInfo, ringFor, ringSummary } from '../ringInfo.js'
@ -30,7 +31,13 @@ const props = defineProps({
})
const emit = defineEmits(['select', 'fullscreen'])
const T = useGiT()
const fmt = (n) => (Number(n) || 0).toLocaleString()
// formatCount, not toLocaleString(): a bare toLocaleString follows the READER'S BROWSER,
// so one page could print 2,074 here and 2.074 in the panel beside it. formatCount holds
// en-US in one place until the Driver rules on numerals.
// The `|| 0` stays: formatCount FORMATS and deliberately does not decide what empty means —
// Number(undefined) is NaN, so handing it a missing count would print "NaN" where this has
// always printed 0. The locale source changes; the empty policy does not.
const fmt = (n) => formatCount(Number(n) || 0)
const summary = computed(() => ringSummary(props.groups))
const open = ref(null) // the ring whose explanation is expanded