From cb343d83697ea9755c77133a7077ee4ba73126d5 Mon Sep 17 00:00:00 2001 From: Will Freeman Date: Thu, 29 Jan 2026 08:56:38 -0700 Subject: [PATCH] improved counter, show wins --- webapp/src/components/ALPRCounter.vue | 48 +++++++++----- webapp/src/views/Landing.vue | 95 +++++++++++++++------------ 2 files changed, 84 insertions(+), 59 deletions(-) diff --git a/webapp/src/components/ALPRCounter.vue b/webapp/src/components/ALPRCounter.vue index 92bec5a..95f601c 100644 --- a/webapp/src/components/ALPRCounter.vue +++ b/webapp/src/components/ALPRCounter.vue @@ -1,7 +1,21 @@ @@ -19,6 +33,7 @@ const props = defineProps({ }); const counterEl: Ref = ref(null); +const winsCounterEl: Ref = ref(null); const countupOptions = { useEasing: true, useGrouping: true, @@ -28,13 +43,14 @@ const countupOptions = { suffix: '', }; let counter: CountUp|undefined = undefined; +let winsCounter: CountUp|undefined = undefined; interface Counts { us?: number; - worldwide?: number; + wins: number; } const counts: Ref = ref({ us: undefined, - worldwide: undefined, + wins: 0, }); const showFinalAnimation = ref(false); const { xs: isMobile } = useDisplay(); @@ -50,23 +66,26 @@ onMounted(() => { }); function countUp(newCounts: Counts) { - if (!newCounts.worldwide) return; - if (!counterEl.value) { - console.error('Counter element not found'); + if (!newCounts.us) return; + if (!counterEl.value || !winsCounterEl.value) { + console.error('Counter elements not found'); return; }; - if (!counter) { - counter = new CountUp(counterEl.value, newCounts.worldwide, countupOptions); + if (!counter && !winsCounter) { + counter = new CountUp(counterEl.value, newCounts.us, countupOptions); + winsCounter = new CountUp(winsCounterEl.value, newCounts.wins, countupOptions); if (timeOfMount) { const timeSinceMount = new Date().getTime() - timeOfMount; if (timeSinceMount < props.delayMs) { setTimeout(() => { counter?.start(); + winsCounter?.start(); }, props.delayMs - timeSinceMount); } else { counter.start(); + winsCounter.start(); } } @@ -78,12 +97,7 @@ function countUp(newCounts: Counts) { diff --git a/webapp/src/views/Landing.vue b/webapp/src/views/Landing.vue index 0dbef31..d3a3684 100644 --- a/webapp/src/views/Landing.vue +++ b/webapp/src/views/Landing.vue @@ -1,28 +1,30 @@