Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/bson-6.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
renatodellosso authored Dec 31, 2024
2 parents c9a9854 + 5cfa086 commit d108773
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
25 changes: 19 additions & 6 deletions components/XpProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,31 @@ import { User } from "@/lib/Types";
import { xpRequiredForNextLevel } from "@/lib/Xp";
import { useState } from "react";

export default function XpProgressBar({ user, size }: { user: User, size: string }) {
const [hovered, setHovered] = useState(false);
export default function XpProgressBar({
user,
size,
}: {
user: User;
size: string;
}) {
const [hovered, setHovered] = useState(false);

return (
<div
className={`radial-progress text-accent m-2 text-${hovered ? "xs" : "sm"}`}
style={{ "--value": user.xp / xpRequiredForNextLevel(user.level) * 100 , "--size": size } as any}
style={
{
"--value": (user.xp / xpRequiredForNextLevel(user.level)) * 100,
"--size": size,
} as any
}
role="progressbar"
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
onMouseEnter={() => setHovered(true)}
onMouseLeave={() => setHovered(false)}
>
{hovered ? `${user.xp}/${xpRequiredForNextLevel(user.level)}` : `Lvl ${user.level}`}
{hovered
? `${user.xp}/${xpRequiredForNextLevel(user.level)}`
: `Lvl ${user.level}`}
</div>
);
}
7 changes: 6 additions & 1 deletion pages/profile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ export default function Profile(props: { teamList: Team[] }) {
<></>
)}
</Flex>
{ user != null && <XpProgressBar user={user} size="4rem" /> }
{user != null && (
<XpProgressBar
user={user}
size="4rem"
/>
)}
</div>
</Flex>
</Card>
Expand Down

0 comments on commit d108773

Please sign in to comment.