Files
discord-decomp/modules/game_profile/hooks/useGameProfileStoreWebsites.tsx
T
2026-11-01 12:12:55 +02:00

43 lines
2.2 KiB
TypeScript

// Metro module 8489 (f8490).
import { useMemo } from "react";
import { ThirdPartyGameApplicationWebsiteCategory } from "../../../_bundle/Module8490";
import { useSteamWebsiteUrl } from "./useSteamWebsiteUrl";
import useXboxGamePassStoreUrl from "./useXboxGamePassStoreUrl";
import { SteamReleaseStatus } from "../../../_bundle/Module8492";
let c5439_4 = new Set(["1402418703554842694", "356877880938070016"]);
let c5439_5 = [ThirdPartyGameApplicationWebsiteCategory.EPICGAMES, ThirdPartyGameApplicationWebsiteCategory.STEAM, ThirdPartyGameApplicationWebsiteCategory.ROBLOX, ThirdPartyGameApplicationWebsiteCategory.BATTLENET, ThirdPartyGameApplicationWebsiteCategory.RIOT, ThirdPartyGameApplicationWebsiteCategory.MINECRAFT];
export function useGameProfileStoreWebsites(a0) {
const id2 = a0?.id;
const steamWebsiteUrl = useSteamWebsiteUrl(id2);
const url = useXboxGamePassStoreUrl(a0);
const id = a0?.id;
const websites = a0?.websites;
const steamReleaseStatus = a0?.steamReleaseStatus;
return useMemo(() => {
if (!(websites == null && url == null) && id != null) {
let r6 = websites == null ? void 0 : websites.filter((website) => {
const r0 = website.category === ThirdPartyGameApplicationWebsiteCategory.EPICGAMES && !c5439_4.has(id);
return r0 ? !r0 : (website.category !== ThirdPartyGameApplicationWebsiteCategory.STEAM || steamReleaseStatus !== SteamReleaseStatus.RETIRED_ABANDONED) && c5439_5.includes(website.category);
});
if (r6 == null) {
r6 = [];
}
if (!(steamWebsiteUrl == null || steamReleaseStatus === SteamReleaseStatus.RETIRED_ABANDONED || r6.some((item) => item.category === ThirdPartyGameApplicationWebsiteCategory.STEAM))) {
r6.push({
category: ThirdPartyGameApplicationWebsiteCategory.STEAM,
url: steamWebsiteUrl
});
}
const r36 = r6.sort((a, b) => a.category !== ThirdPartyGameApplicationWebsiteCategory.STEAM ? b.category === ThirdPartyGameApplicationWebsiteCategory.STEAM ? 1 : 0 : -1);
if (url != null) {
r36.unshift({
category: "XBOX_GAME_PASS",
url
});
}
return r36;
}
return [];
}, [steamWebsiteUrl, websites, id, steamReleaseStatus, url]);
}