-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(leaderboard): display points' name
- Loading branch information
1 parent
f3a4c6c
commit 8c4d465
Showing
4 changed files
with
60 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 27 additions & 18 deletions
45
src/app/(dashboard)/[guildUrlName]/leaderboard/[rewardId]/components/LeaderboardUserCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,36 @@ | ||
import { Card } from "@/components/ui/Card"; | ||
import type { Leaderboard } from "@/lib/schemas/leaderboard"; | ||
import { User } from "@phosphor-icons/react/dist/ssr"; | ||
import { useSuspenseQuery } from "@tanstack/react-query"; | ||
import { useParams } from "next/navigation"; | ||
import { pointsRewardOptions } from "../options"; | ||
|
||
export const LeaderboardUserCard = ({ | ||
user, | ||
}: { user: Leaderboard["user"] }) => ( | ||
<Card className="flex items-center"> | ||
<div className="flex size-16 shrink-0 items-center justify-center border-r bg-blackAlpha px-2 font-display font-extrabold text-lg sm:size-24 dark:bg-blackAlpha-hard"> | ||
{`#${user.rank}`} | ||
</div> | ||
}: { user: Leaderboard["user"] }) => { | ||
const { rewardId } = useParams<{ rewardId: string }>(); | ||
const { data: pointReward } = useSuspenseQuery( | ||
pointsRewardOptions({ rewardId }), | ||
); | ||
|
||
<div className="flex w-full items-center justify-between gap-4 px-4 sm:px-5"> | ||
<div className="flex items-center gap-2"> | ||
<div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-image sm:size-10"> | ||
<User weight="duotone" className="size-4 sm:size-5" /> | ||
return ( | ||
<Card className="flex items-center"> | ||
<div className="flex size-16 shrink-0 items-center justify-center border-r bg-blackAlpha px-2 font-display font-extrabold text-lg sm:size-24 dark:bg-blackAlpha-hard"> | ||
{`#${user.rank}`} | ||
</div> | ||
|
||
<div className="flex w-full items-center justify-between gap-4 px-4 sm:px-5"> | ||
<div className="flex items-center gap-2"> | ||
<div className="flex size-8 shrink-0 items-center justify-center rounded-full bg-image sm:size-10"> | ||
<User weight="duotone" className="size-4 sm:size-5" /> | ||
</div> | ||
<span className="line-clamp-1 shrink font-bold">{user.userId}</span> | ||
</div> | ||
<span className="line-clamp-1 shrink font-bold">{user.userId}</span> | ||
<span className="shrink-0"> | ||
<b>{`${user.amount} `}</b> | ||
<span>{pointReward.data.name}</span> | ||
</span> | ||
</div> | ||
<span className="shrink-0"> | ||
<b>{`${user.amount} `}</b> | ||
{/* TODO: display point' name */} | ||
{/* <span>point name</span> */} | ||
</span> | ||
</div> | ||
</Card> | ||
); | ||
</Card> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters