From b1ec2fe53bde9bd72cc681e60644bc038379dcae Mon Sep 17 00:00:00 2001 From: Ru Chern Chong Date: Sun, 10 Nov 2024 23:46:46 +0800 Subject: [PATCH] Update leaderboard to not show empty car registrations --- components/Leaderboard.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/Leaderboard.tsx b/components/Leaderboard.tsx index f7f69c8..bb1ea1d 100644 --- a/components/Leaderboard.tsx +++ b/components/Leaderboard.tsx @@ -108,6 +108,10 @@ export const Leaderboard = ({ cars }: LeaderboardProps) => { {CATEGORIES.map(({ title, description, icon: Icon, colour }) => { const popularMakes = getPopularMakes(cars, title); + if (popularMakes.length === 0) { + return null; + } + return (
@@ -117,11 +121,6 @@ export const Leaderboard = ({ cars }: LeaderboardProps) => { {description}
- {popularMakes.length === 0 && ( - - No registrations for this period - - )}
{popularMakes.map(({ make, number }) => { const maxValue = Math.max(