Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed crowns issue in leaderboard #323

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 25 additions & 22 deletions app/leaderboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,31 @@ export default function Leaderboard() {
</TableHeader>
{leaderboard.length > 0 ? (
<TableBody>
{leaderboard.map((user, index) => (
<TableRow key={user.username}>
<TableCell>{(page - 1) * 20 + index + 1}</TableCell>
<TableCell>
<Avatar>
<AvatarImage src={user.avatar_url} />
<AvatarFallback>
{user.username.substring(0, 2).toUpperCase()}
</AvatarFallback>
</Avatar>
</TableCell>
<TableCell className="font-medium flex gap-x-2">
<Link
href={`${process.env.NEXT_PUBLIC_URL}/resume/${user.username}`}
>
{user.username}
</Link>
<Crown rank={index + 1} />
</TableCell>
<TableCell>{user.rating}</TableCell>
</TableRow>
))}
{leaderboard.map((user, index) => {
const overallRank = (page - 1) * 20 + index + 1;
return (
<TableRow key={user.username}>
<TableCell>{overallRank}</TableCell>
<TableCell>
<Avatar>
<AvatarImage src={user.avatar_url} />
<AvatarFallback>
{user.username.substring(0, 2).toUpperCase()}
</AvatarFallback>
</Avatar>
</TableCell>
<TableCell className="font-medium flex items-center">
<Crown rank={overallRank} />
<Link
href={`${process.env.NEXT_PUBLIC_URL}/resume/${user.username}`}
>
{user.username}
</Link>
</TableCell>
<TableCell>{user.rating}</TableCell>
</TableRow>
);
})}
</TableBody>
) : (
<TableBody>
Expand Down
Loading