diff --git a/src/renderer/src/app.scss b/src/renderer/src/app.scss index 4c5374e8..2fedda61 100644 --- a/src/renderer/src/app.scss +++ b/src/renderer/src/app.scss @@ -47,6 +47,17 @@ button { font-family: inherit; } +dialog { + padding: 0; + margin: 0; + border: none; + background: transparent; + max-width: none; + max-height: none; + width: auto; + height: auto; +} + h1, h2, h3, @@ -90,6 +101,7 @@ img { progress[value] { -webkit-appearance: none; + appearance: none; } .container { diff --git a/src/renderer/src/context/user-profile/user-profile.context.tsx b/src/renderer/src/context/user-profile/user-profile.context.tsx index a5f080cd..d9d131d2 100644 --- a/src/renderer/src/context/user-profile/user-profile.context.tsx +++ b/src/renderer/src/context/user-profile/user-profile.context.tsx @@ -1,6 +1,6 @@ import { darkenColor } from "@renderer/helpers"; import { useAppSelector, useToast } from "@renderer/hooks"; -import type { Badge, UserProfile, UserStats, UserGame } from "@types"; +import type { Badge, UserProfile, UserStats, UserGame, ProfileAchievement } from "@types"; import { average } from "color.js"; import { createContext, useCallback, useEffect, useState } from "react"; @@ -139,20 +139,35 @@ export function UserProfileContextProvider({ const params = new URLSearchParams({ language }); - return window.electron.hydraApi + // Fetch main profile data + const profilePromise = window.electron.hydraApi .get(`/users/${userId}?${params.toString()}`) - .then((userProfile) => { - setUserProfile(userProfile); + .catch(() => { + showErrorToast(t("user_not_found")); + navigate(-1); + throw new Error("Profile not found"); + }); + + // Fetch achievements separately + const achievementsPromise = window.electron.hydraApi + .get(`/users/${userId}/achievements?${params.toString()}`) + .catch(() => null); // If achievements fail, just return null + + return Promise.all([profilePromise, achievementsPromise]) + .then(([userProfile, achievements]) => { + // Merge achievements into the profile + const profileWithAchievements = { + ...userProfile, + achievements: achievements || null, + }; + + setUserProfile(profileWithAchievements); if (userProfile.profileImageUrl) { getHeroBackgroundFromImageUrl(userProfile.profileImageUrl).then( (color) => setHeroBackground(color) ); } - }) - .catch(() => { - showErrorToast(t("user_not_found")); - navigate(-1); }); }, [ navigate,