From 5a2979c80de80463f0cfd36d87e227c8adb3d4eb Mon Sep 17 00:00:00 2001 From: Sam Bessey Date: Thu, 21 Sep 2023 10:44:57 -0400 Subject: [PATCH 1/3] refactor: abstract coldspot text --- src/components/dashboard/GapByRace.vue | 129 ++++++++++++------- src/views/datasets/booster-gap/dashboard.vue | 16 +++ src/views/datasets/vaccine-gap/dashboard.vue | 15 +++ 3 files changed, 110 insertions(+), 50 deletions(-) diff --git a/src/components/dashboard/GapByRace.vue b/src/components/dashboard/GapByRace.vue index 4f773a1..a5b51cd 100644 --- a/src/components/dashboard/GapByRace.vue +++ b/src/components/dashboard/GapByRace.vue @@ -24,20 +24,21 @@ />
-

- In {{ activeCluster.name }}, the largest gap is among - {{ minVaxRace?.name }} residents. Only - {{ formatPct(minVaxRace?.pct) }} of - {{ minVaxRace?.name }} residents - are vaccinated compared to {{ formatPct(expected) }} statewide. - Approximately - {{ minVaxRace?.gap }} more {{ minVaxRace?.name }} residents - need to receive a dose to close this gap. -

+ +

@@ -66,46 +67,65 @@
-

- In {{ activeCluster.name }}, - {{ formatPct(activeFocusStats?.pct) }} of - {{ activeFocusStats?.name }} residents are vaccinated compared to our - goal of {{ formatPct(expected) }} total vaccinations statewide. - Approximately - {{ activeFocusStats?.gap }} more - {{ activeFocusStats?.name }} residents - need to be vaccinated to close this gap. -

+ +

- -

- In {{ activeCluster.name }}, - {{ formatPct(activeFocusStats?.pct) }} of - {{ activeFocusStats?.name }} residents are vaccinated compared to - our goal of {{ formatPct(expected) }} total vaccinations statewide. -

+ +

-

- In {{ activeCluster.name }}, there isn't enough vaccine data on - {{ activeFocusStats?.name }} residents to determine - their vaccination status or the number of vaccine doses needed to - close the gap. -

- - -

- The largest gap is among - {{ minVaxRace?.name }} residents. Only - {{ formatPct(minVaxRace?.pct) }} of - {{ minVaxRace?.name }} residents are vaccinated. Approximately - {{ minVaxRace?.gap }} more - {{ minVaxRace?.name }} residents need to be vaccinated to close this - gap. -

+ +

+ + + +

@@ -118,12 +138,15 @@ import { computed } from "vue"; import GapChart from "@/components/dashboard/GapChart.vue"; import KeyPerformanceIndicator from "@/components/dashboard/KeyPerformanceIndicator.vue"; import { formatPct, sortByProperty } from "../../utils/utils"; +import { compile } from "handlebars"; +import sanitizeHtml from "sanitize-html"; const props = defineProps<{ stats: Stat[]; activeCluster: Cluster; fieldNames: Array<{ field: string; name: string }>; focusStat: FocusStat; + phrases: Phrases; }>(); const expected = computed( @@ -181,6 +204,12 @@ const activeFocusStats = computed(() => { (a) => a.name.toUpperCase() === props.focusStat.value.toUpperCase(), ); }); + +const gapPhrase = compile(props.phrases.gap); +const allResidents = compile(props.phrases.allResidents); +const noGap = compile(props.phrases.noGap); +const noInfo = compile(props.phrases.noInfo); +const highest = compile(props.phrases.highest);