Skip to content

Commit

Permalink
Revert leaderboard link change
Browse files Browse the repository at this point in the history
  • Loading branch information
JunichiSugiura committed Nov 12, 2024
1 parent 646856f commit 5ea9ab3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/profile/src/components/trophies/leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import {
SparklesIcon,
StateIconProps,
} from "@cartridge/ui-next";
import { Link } from "react-router-dom";
import { Link, useLocation } from "react-router-dom";
import { Player } from "@/hooks/achievements";
import { useUsername } from "@/hooks/account";
import { useMemo } from "react";

export function Leaderboard({
players,
Expand Down Expand Up @@ -42,9 +43,15 @@ function Row({
rank: number;
}) {
const { username } = useUsername({ address });
const location = useLocation();

const path = useMemo(() => {
if (self) return location.pathname;
return [...location.pathname.split("/"), address].join("/");
}, [location.pathname, address, self]);

return (
<Link className="flex" to="..">
<Link className="flex" to={path}>
{self && <div className="w-[4px] bg-muted" />}
<div
className={cn(
Expand Down

0 comments on commit 5ea9ab3

Please sign in to comment.