From 5870f22aca85e92ac227ae51779ba66a2ca6dc01 Mon Sep 17 00:00:00 2001 From: Yannick Lyn Fatt Date: Sun, 14 Jun 2026 01:43:16 -0400 Subject: [PATCH] Animate the score when it updates A goal arriving over the realtime channel used to swap the digit silently. Add a small AnimatedScore component that pops and flashes the number whenever its value changes (never on first render), and use it for both the gamecast header and the live scoreboard cards. The flash colour is themeable so it stays legible on the dark pitch header (volt) and the light scoreboard cards (primary); the animation honours prefers-reduced-motion. Co-Authored-By: Claude Opus 4.8 --- resources/js/components/AnimatedScore.vue | 76 +++++++++++++++++++++++ resources/js/pages/Gamecast/Show.vue | 3 +- resources/js/pages/Scoreboard/Index.vue | 5 +- 3 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 resources/js/components/AnimatedScore.vue diff --git a/resources/js/components/AnimatedScore.vue b/resources/js/components/AnimatedScore.vue new file mode 100644 index 0000000..bd793ae --- /dev/null +++ b/resources/js/components/AnimatedScore.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/resources/js/pages/Gamecast/Show.vue b/resources/js/pages/Gamecast/Show.vue index 129d497..41aa581 100644 --- a/resources/js/pages/Gamecast/Show.vue +++ b/resources/js/pages/Gamecast/Show.vue @@ -2,6 +2,7 @@ import { Head, Link, router } from '@inertiajs/vue3'; import { useEchoPublicClient } from '@/composables/useEchoPublicClient'; import { computed, nextTick, ref, watch } from 'vue'; +import AnimatedScore from '@/components/AnimatedScore.vue'; import Breadcrumbs from '@/components/Breadcrumbs.vue'; import GamecastEditor from '@/components/GamecastEditor.vue'; import { matchClockMinute, useNow } from '@/composables/useMatchClock'; @@ -205,7 +206,7 @@ const matchTitle = computed(() => `${props.game.home_team?.name ?? 'TBD'} vs ${p
{{ game.home_team?.name ?? 'TBD' }}
- {{ game.home_team_score ?? '–' }}:{{ game.away_team_score ?? '–' }} + :
{{ game.away_team?.acronym ?? '—' }}
diff --git a/resources/js/pages/Scoreboard/Index.vue b/resources/js/pages/Scoreboard/Index.vue index 0d58b13..ccebd93 100644 --- a/resources/js/pages/Scoreboard/Index.vue +++ b/resources/js/pages/Scoreboard/Index.vue @@ -2,6 +2,7 @@ import { Head, Link, router } from '@inertiajs/vue3'; import { useEchoPublicClient } from '@/composables/useEchoPublicClient'; import { ref } from 'vue'; +import AnimatedScore from '@/components/AnimatedScore.vue'; import Breadcrumbs from '@/components/Breadcrumbs.vue'; import { matchClockMinute, useNow } from '@/composables/useMatchClock'; import { show as gamecastShow } from '@/routes/games'; @@ -168,7 +169,7 @@ const pageBreadcrumbs: BreadcrumbItem[] = [{ title: 'Scoreboard', href: index(). {{ game.home_team.name ?? 'TBD' }} - {{ game.home_team_score ?? '–' }} +
@@ -177,7 +178,7 @@ const pageBreadcrumbs: BreadcrumbItem[] = [{ title: 'Scoreboard', href: index(). {{ game.away_team.name ?? 'TBD' }} - {{ game.away_team_score ?? '–' }} +