ci: api change + fullscreen modal fix

This commit is contained in:
Moyasee
2025-10-22 22:14:47 +03:00
parent 68b3de9b7f
commit 7109c1542c
2 changed files with 35 additions and 8 deletions

View File

@@ -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 {

View File

@@ -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<UserProfile>(`/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<ProfileAchievement[]>(`/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,