From 57121b62bd113a4de25354eaa416f293b3ac03e5 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Fri, 28 Nov 2025 12:18:56 -0600 Subject: [PATCH] CLAUDE: Add tabbed Recent/Scoring views to PlayByPlay component MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enhanced PlayByPlay with a tabbed interface: - "Recent" tab shows plays from current half inning only - "Scoring" tab shows all plays where runs were scored - Badge counts on each tab show number of matching plays - Tab-aware empty states with contextual messaging - Footer shows total game plays count Removed unused showFilters prop and showAllPlays toggle. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- frontend-sba/components/Game/PlayByPlay.vue | 112 ++++++++++++++------ 1 file changed, 82 insertions(+), 30 deletions(-) diff --git a/frontend-sba/components/Game/PlayByPlay.vue b/frontend-sba/components/Game/PlayByPlay.vue index 9e7c3de..47847c9 100644 --- a/frontend-sba/components/Game/PlayByPlay.vue +++ b/frontend-sba/components/Game/PlayByPlay.vue @@ -8,15 +8,45 @@ Play-by-Play + - + +
+
@@ -28,16 +58,23 @@ >
- + + + +
-

No plays yet

-

The game will start soon...

+

+ {{ activeTab === 'recent' ? 'No plays this half inning' : 'No runs scored yet' }} +

+

+ {{ activeTab === 'recent' ? 'Plays will appear here as they happen' : 'Scoring plays will appear here' }} +

@@ -141,17 +178,14 @@ - +
- + + {{ plays.length }} total {{ plays.length === 1 ? 'play' : 'plays' }} this game +
@@ -167,7 +201,6 @@ interface Props { compact?: boolean scrollable?: boolean maxHeight?: number - showFilters?: boolean } const props = withDefaults(defineProps(), { @@ -175,15 +208,19 @@ const props = withDefaults(defineProps(), { limit: 10, compact: false, scrollable: true, - maxHeight: 0, - showFilters: true + maxHeight: 0 }) -// Store for player name lookup +// Store for player name lookup and current game state const gameStore = useGameStore() // State -const showAllPlays = ref(false) +type TabType = 'recent' | 'scoring' +const activeTab = ref('recent') + +// Current game state for filtering recent plays +const currentInning = computed(() => gameStore.currentInning) +const currentHalf = computed(() => gameStore.currentHalf) // Helper functions for player names const getPlayerName = (lineupId: number | undefined): string | null => { @@ -233,15 +270,30 @@ const hasRunnerMovements = (play: PlayResult): boolean => { return play.runners_advanced && play.runners_advanced.length > 0 } -// Computed -const displayedPlays = computed(() => { +// Computed - Filtered play lists +const recentPlays = computed(() => { if (!props.plays || props.plays.length === 0) return [] - // Sort by play number descending (most recent first) - const sorted = [...props.plays].sort((a, b) => b.play_number - a.play_number) + // Filter plays from current half inning + return props.plays.filter(play => + play.inning === currentInning.value && play.half === currentHalf.value + ).sort((a, b) => b.play_number - a.play_number) +}) - // Return limited or all - return showAllPlays.value ? sorted : sorted.slice(0, props.limit) +const scoringPlays = computed(() => { + if (!props.plays || props.plays.length === 0) return [] + + // Filter plays where runs were scored + return props.plays.filter(play => play.runs_scored > 0) + .sort((a, b) => b.play_number - a.play_number) +}) + +const displayedPlays = computed(() => { + if (activeTab.value === 'recent') { + return recentPlays.value + } else { + return scoringPlays.value + } }) // Methods