feat: allow view user on user by lang category

This commit is contained in:
Khairul Hidayat 2024-08-10 01:10:07 +07:00
parent 9ed2984dbd
commit a7e024e8d7
2 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@ import { pointWeights } from "../data";
const ViewSheet = () => { const ViewSheet = () => {
const { type, id } = useParams(); const { type, id } = useParams();
const username = type === "user" ? id : null; const username = type !== "lang" ? id : null;
const { data, refetch } = useGetUserLeaderboard(username); const { data, refetch } = useGetUserLeaderboard(username);
const navigate = useNavigate(); const navigate = useNavigate();
@ -88,7 +88,7 @@ const ViewSheet = () => {
<BottomSheet <BottomSheet
open={!!username} open={!!username}
onOpenChange={(open) => { onOpenChange={(open) => {
if (!open) navigate("/user", { replace: true }); if (!open) navigate(`/${type}`, { replace: true });
}} }}
className="h-[90%]" className="h-[90%]"
> >

View File

@ -48,7 +48,7 @@ const HomePage = () => {
name={item.name} name={item.name}
avatar={item.image} avatar={item.image}
sub={item.sub} sub={item.sub}
onClick={type === "user" ? () => onView(item.id!) : undefined} onClick={type !== "lang" ? () => onView(item.id!) : undefined}
/> />
); );
})} })}
@ -66,7 +66,7 @@ const HomePage = () => {
rank={item.rank} rank={item.rank}
columns={data.columns} columns={data.columns}
data={item} data={item}
onClick={type === "user" ? () => onView(item.id!) : undefined} onClick={type !== "lang" ? () => onView(item.id!) : undefined}
/> />
))} ))}
</> </>