complete project using prettier!
This commit is contained in:
@@ -51,7 +51,10 @@ export const Leaderboard: React.FC = () => {
|
||||
|
||||
if (error) {
|
||||
return (
|
||||
<div className="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 rounded-md" role="alert">
|
||||
<div
|
||||
className="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 rounded-md"
|
||||
role="alert"
|
||||
>
|
||||
<div className="flex items-center">
|
||||
<ShieldAlert className="h-6 w-6 mr-3" />
|
||||
<p className="font-bold">Error: {error}</p>
|
||||
@@ -67,21 +70,29 @@ export const Leaderboard: React.FC = () => {
|
||||
Top Users
|
||||
</h2>
|
||||
{leaderboard.length === 0 ? (
|
||||
<p className="text-gray-500 dark:text-gray-400">The leaderboard is currently empty. Be the first to earn points!</p>
|
||||
<p className="text-gray-500 dark:text-gray-400">
|
||||
The leaderboard is currently empty. Be the first to earn points!
|
||||
</p>
|
||||
) : (
|
||||
<ol className="space-y-4">
|
||||
{leaderboard.map((user) => (
|
||||
<li key={user.user_id} className="flex items-center space-x-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg transition hover:bg-gray-100 dark:hover:bg-gray-600">
|
||||
<div className="shrink-0 w-8 text-center">
|
||||
{getRankIcon(user.rank)}
|
||||
</div>
|
||||
<li
|
||||
key={user.user_id}
|
||||
className="flex items-center space-x-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-lg transition hover:bg-gray-100 dark:hover:bg-gray-600"
|
||||
>
|
||||
<div className="shrink-0 w-8 text-center">{getRankIcon(user.rank)}</div>
|
||||
<img
|
||||
src={user.avatar_url || `https://api.dicebear.com/8.x/initials/svg?seed=${user.full_name || user.user_id}`}
|
||||
src={
|
||||
user.avatar_url ||
|
||||
`https://api.dicebear.com/8.x/initials/svg?seed=${user.full_name || user.user_id}`
|
||||
}
|
||||
alt={user.full_name || 'User Avatar'}
|
||||
className="w-12 h-12 rounded-full object-cover"
|
||||
/>
|
||||
<div className="flex-1">
|
||||
<p className="font-semibold text-gray-800 dark:text-gray-100">{user.full_name || 'Anonymous User'}</p>
|
||||
<p className="font-semibold text-gray-800 dark:text-gray-100">
|
||||
{user.full_name || 'Anonymous User'}
|
||||
</p>
|
||||
</div>
|
||||
<div className="text-lg font-bold text-blue-600 dark:text-blue-400">
|
||||
{user.points} pts
|
||||
@@ -94,4 +105,4 @@ export const Leaderboard: React.FC = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Leaderboard;
|
||||
export default Leaderboard;
|
||||
|
||||
Reference in New Issue
Block a user