Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/frontend/src/components/ui/charts/Chart.client.vue
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const flipLegend = (legend, newVal) => {
}

const resetChart = () => {
if (!chart.value) return
if (!chart.value?.chart) return
chart.value.updateSeries([...props.data])
chart.value.updateOptions({
xaxis: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ const chartOptions = {
const chart = ref(null)

const resetChart = () => {
chart.value?.updateSeries([...props.data])
chart.value?.updateOptions({
if (!chart.value?.chart) return
chart.value.updateSeries([...props.data])
chart.value.updateOptions({
xaxis: {
categories: props.labels,
},
})
chart.value?.resetSeries()
chart.value.resetSeries()
}

defineExpose({
Expand Down
13 changes: 10 additions & 3 deletions apps/frontend/src/utils/analytics.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import dayjs from 'dayjs'
import { computed, ref, watch } from 'vue'
import { useI18n } from 'vue-i18n'

// note: build step can miss unix import for some reason, so
// we have to import it like this

const { unix } = dayjs

export function useCountryNames(style = 'long') {
const formattingOptions = { type: 'region', style }
const { formats } = useVIntl()
const { locale } = useI18n()
const displayNames = computed(
() => new Intl.DisplayNames([locale.value], { type: 'region', style }),
)
return function formatCountryName(code) {
return formats.displayName(code, formattingOptions)
try {
return displayNames.value.of(code) ?? code
} catch {
return code
}
}
}

Expand Down