Skip to content

Commit a6ce3fc

Browse files
committed
fix: make highest scoring match league-specific and add Team Performance icon
- Recalculate highest scoring match when league changes - Now shows correct teams for each league (e.g., Scottish teams for Scottish Premiership) - Replace SQL Ball logo with Activity icon on Team Performance chart - Consistent icon styling across all charts
1 parent dd2b756 commit a6ce3fc

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

src/components/Dashboard.svelte

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,30 @@
348348
goalsChart.datasets[0].data = last15.map(m => (m.home_score || 0) + (m.away_score || 0));
349349
}
350350
351+
// Recalculate highest scoring match for the selected league
352+
let highestMatchGoals = 0;
353+
let highestMatchScore = '0-0';
354+
let highestMatchHomeTeam = '';
355+
let highestMatchAwayTeam = '';
356+
let highestMatchDate = '';
357+
freshData.recent_matches.forEach(m => {
358+
const totalGoals = (m.home_score || 0) + (m.away_score || 0);
359+
if (totalGoals > highestMatchGoals) {
360+
highestMatchGoals = totalGoals;
361+
highestMatchScore = `${m.home_score || 0}-${m.away_score || 0}`;
362+
highestMatchHomeTeam = m.home_team || '';
363+
highestMatchAwayTeam = m.away_team || '';
364+
highestMatchDate = m.match_date || '';
365+
}
366+
});
367+
highestScoringMatch = {
368+
goals: highestMatchGoals,
369+
score: highestMatchScore,
370+
homeTeam: highestMatchHomeTeam,
371+
awayTeam: highestMatchAwayTeam,
372+
date: highestMatchDate
373+
};
374+
351375
console.log('Dashboard refreshed with league data:', {
352376
league: league || 'all',
353377
matches: freshData.recent_matches.length,

src/components/EnhancedVisualizations.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,7 @@
933933
<div class="bg-white dark:bg-slate-900 rounded-xl p-4 sm:p-6 border border-slate-200 dark:border-green-500/20">
934934
<div class="flex items-center justify-between mb-4">
935935
<div class="flex items-center gap-2">
936-
<img src="/sqlballlogo.svg" alt="SQL Ball Logo" class="w-4 h-4 sm:w-5 sm:h-5" />
936+
<Activity class="w-4 h-4 sm:w-5 sm:h-5 text-green-500" />
937937
<h3 class="text-base sm:text-lg font-bold text-slate-900 dark:text-green-400 font-mono">Team Performance</h3>
938938
</div>
939939
<button

0 commit comments

Comments
 (0)