From 3a75774761a1bbe1c46e479982ebf33dc456e538 Mon Sep 17 00:00:00 2001 From: stopflock Date: Mon, 7 Sep 2026 15:47:14 -0500 Subject: [PATCH] unrecognized "state" values get sorted under an "elsewhere" heading; use "country - region" format for sorting purposes (#152) --- webapp/src/views/Groups.vue | 76 +++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 32 deletions(-) diff --git a/webapp/src/views/Groups.vue b/webapp/src/views/Groups.vue index 46e077e..d4dab79 100644 --- a/webapp/src/views/Groups.vue +++ b/webapp/src/views/Groups.vue @@ -17,37 +17,40 @@
-
-

{{ abbrevToState[state] }}

- - - + +
@@ -147,6 +150,11 @@ const chapters = ref([]) const isLoading = ref(true) + // A chapter's `state` is treated as a US state/territory if it matches one of the + // abbreviations above. Anything else (e.g. "Canada - Ontario") falls into "Elsewhere". + // CMS convention for non-US chapters: state = "Country - Region", so they sort sensibly. + const isUsState = (state: string) => state in abbrevToState + const chaptersByState = computed(() => { const grouped: Record = {} chapters.value.forEach(chapter => { @@ -156,8 +164,12 @@ return grouped }) - const statesWithChapters = computed(() => { - return Object.keys(chaptersByState.value).sort() + const sections = computed(() => { + const states = Object.keys(chaptersByState.value).sort() + return [ + { label: 'US', states: states.filter(isUsState) }, + { label: 'Elsewhere', states: states.filter(state => !isUsState(state)) }, + ].filter(section => section.states.length > 0) }) onMounted(() => {