,
+ emptyText: 'No users with streaks yet',
+ },
+ ]}
/>
,
+ emptyText: 'No projects submitted this month',
+ },
+ {
+ title: 'Lifetime',
+ users: stats.projectSubmissions.lifetime,
+ emptyIcon:
,
+ emptyText: 'No projects submitted yet',
},
]}
/>
@@ -48,6 +63,8 @@ type LeaderboardLaneProps = {
tabs: {
title: string;
users: LeadeboardUserDetails[];
+ emptyIcon?: ReactNode;
+ emptyText?: string;
}[];
};
@@ -55,7 +72,7 @@ function LeaderboardLane(props: LeaderboardLaneProps) {
const { title, tabs } = props;
const [activeTab, setActiveTab] = useState(tabs[0]);
- const usersToShow = activeTab.users;
+ const { users: usersToShow, emptyIcon, emptyText } = activeTab;
return (
@@ -84,35 +101,50 @@ function LeaderboardLane(props: LeaderboardLaneProps) {
)}
-
- {usersToShow.map((user, counter) => {
- const avatar = user?.avatar
- ? `${import.meta.env.PUBLIC_AVATAR_BASE_URL}/${user.avatar}`
- : '/images/default-avatar.png';
+ {usersToShow.length === 0 && emptyText && (
+
+ {emptyIcon}
+
{emptyText}
+
+ )}
+
+ {usersToShow.length > 0 && (
+
+ {usersToShow.map((user, counter) => {
+ const avatar = user?.avatar
+ ? `${import.meta.env.PUBLIC_AVATAR_BASE_URL}/${user.avatar}`
+ : '/images/default-avatar.png';
+ const rank = counter + 1;
- return (
- -
-
-
- {counter + 1}
-
+ return (
+
-
+
+
+ {rank}
+
-
-
{user.name}
-
+
+ {user.name}
+
- {user.count}
-
- );
- })}
-
+ {user.count}
+
+ );
+ })}
+
+ )}