Skip to content

Commit

Permalink
refactor: update placements design (#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddenizakpinar authored Jun 30, 2023
1 parent d74c9ec commit ddd7f77
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions client/src/modules/Leaderboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Community from '@components/shared/Community';
import ListingCard from '@components/shared/ListingCard';
import Progression from '@components/shared/Progression';
import Avatar from '@components/ui/Avatar';
import Card from '@components/ui/Card';
import Button from '@components/ui/Button';
import { useUsers } from '@hooks/data/useUsers';
import { getSeedAvatar, getSeedName } from '@utils/common';
import { Tooltip } from 'flowbite-react';
import Image from 'next/image';

const Leaderboard = () => {
const filter = {
Expand All @@ -12,17 +15,38 @@ const Leaderboard = () => {
};
const { users } = useUsers(filter);

const getUserLink = (id: string) => `/user/${id}`;

return (
<>
<div className="flex flex-1 gap-4">
<Card className="h-fit min-h-[600px] overflow-x-auto rounded-lg">
<div className="text-xl font-semibold text-primary-400">Leaderboard</div>
<div className="mt-3 flex flex-col gap-4">
{users?.map(({ id, name, avatar, points }) => (
<Avatar id={id} key={id} name={name} avatar={avatar} points={points} />
))}
</div>
</Card>
<div className="flex flex-1 flex-col gap-4 ">
{users?.map(({ id, name, avatar, points, bio, email }) => (
<ListingCard
key={id}
href={getUserLink(id)}
title={name || getSeedName(id)}
subtitle={`${points} points`}
content={bio}
action={
<Tooltip content="Available soon">
<Button disabled size={'small'}>
Follow
</Button>
</Tooltip>
}
image={
<Image
className="rounded-md object-cover"
alt="avatar"
width={50}
height={50}
src={avatar || getSeedAvatar(id)}
/>
}
/>
))}
</div>
<div className="flex w-sidebar flex-shrink-0 flex-col gap-4 xl:w-[270px] md:hidden">
<Progression />
<Community />
Expand Down

0 comments on commit ddd7f77

Please sign in to comment.