Skip to content

Commit

Permalink
Update leaderboard to not show empty car registrations
Browse files Browse the repository at this point in the history
  • Loading branch information
ruchernchong committed Nov 10, 2024
1 parent 8505931 commit b1ec2fe
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions components/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div key={title} className="space-y-4">
<div className="flex items-center gap-2">
Expand All @@ -117,11 +121,6 @@ export const Leaderboard = ({ cars }: LeaderboardProps) => {
<Typography.Muted>{description}</Typography.Muted>
</div>
</div>
{popularMakes.length === 0 && (
<Typography.Muted>
No registrations for this period
</Typography.Muted>
)}
<div className="space-y-2">
{popularMakes.map(({ make, number }) => {
const maxValue = Math.max(
Expand Down

0 comments on commit b1ec2fe

Please sign in to comment.