fix: seeing own profile

This commit is contained in:
Zamitto 2024-10-14 14:42:16 -03:00
parent 034e88e286
commit 359733fa40
2 changed files with 11 additions and 7 deletions

View File

@ -15,8 +15,8 @@ import Color from "color";
const HERO_ANIMATION_THRESHOLD = 25; const HERO_ANIMATION_THRESHOLD = 25;
interface AchievementsContentProps { interface AchievementsContentProps {
userId: string | null; otherUserId: string | null;
displayName: string | null; otherUserDisplayName: string | null;
} }
interface AchievementListProps { interface AchievementListProps {
@ -201,8 +201,8 @@ function AchievementList({
} }
export function AchievementsContent({ export function AchievementsContent({
userId, otherUserId: userId,
displayName, otherUserDisplayName: displayName,
}: AchievementsContentProps) { }: AchievementsContentProps) {
const heroRef = useRef<HTMLDivElement | null>(null); const heroRef = useRef<HTMLDivElement | null>(null);
const containerRef = useRef<HTMLDivElement | null>(null); const containerRef = useRef<HTMLDivElement | null>(null);

View File

@ -1,5 +1,5 @@
import { setHeaderTitle } from "@renderer/features"; import { setHeaderTitle } from "@renderer/features";
import { useAppDispatch } from "@renderer/hooks"; import { useAppDispatch, useUserDetails } from "@renderer/hooks";
import type { GameShop } from "@types"; import type { GameShop } from "@types";
import { useEffect } from "react"; import { useEffect } from "react";
import { useSearchParams } from "react-router-dom"; import { useSearchParams } from "react-router-dom";
@ -20,6 +20,8 @@ export function Achievement() {
const userId = searchParams.get("userId"); const userId = searchParams.get("userId");
const displayName = searchParams.get("displayName"); const displayName = searchParams.get("displayName");
const { userDetails } = useUserDetails();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
useEffect(() => { useEffect(() => {
@ -30,6 +32,8 @@ export function Achievement() {
if (!objectId || !shop || !title) return null; if (!objectId || !shop || !title) return null;
const otherUserId = userDetails?.id == userId ? null : userId;
return ( return (
<GameDetailsContextProvider <GameDetailsContextProvider
gameTitle={title} gameTitle={title}
@ -47,8 +51,8 @@ export function Achievement() {
<AchievementsSkeleton /> <AchievementsSkeleton />
) : ( ) : (
<AchievementsContent <AchievementsContent
userId={userId} otherUserId={otherUserId}
displayName={displayName} otherUserDisplayName={displayName}
/> />
)} )}
</SkeletonTheme> </SkeletonTheme>