mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
ci: api change + fullscreen modal fix
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user