mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
fix: custom assets not being showed in library page
This commit is contained in:
@@ -12,12 +12,18 @@ interface LibraryGameCardLargeProps {
|
||||
) => void;
|
||||
}
|
||||
|
||||
const normalizePathForCss = (url: string | null | undefined): string => {
|
||||
if (!url) return "";
|
||||
return url.replaceAll("\\", "/");
|
||||
};
|
||||
|
||||
const getImageWithCustomPriority = (
|
||||
customUrl: string | null | undefined,
|
||||
originalUrl: string | null | undefined,
|
||||
fallbackUrl?: string | null | undefined
|
||||
) => {
|
||||
return customUrl || originalUrl || fallbackUrl || "";
|
||||
const selectedUrl = customUrl || originalUrl || fallbackUrl || "";
|
||||
return normalizePathForCss(selectedUrl);
|
||||
};
|
||||
|
||||
export const LibraryGameCardLarge = memo(function LibraryGameCardLarge({
|
||||
@@ -30,15 +36,21 @@ export const LibraryGameCardLarge = memo(function LibraryGameCardLarge({
|
||||
const backgroundImage = useMemo(
|
||||
() =>
|
||||
getImageWithCustomPriority(
|
||||
game.customHeroImageUrl,
|
||||
game.libraryHeroImageUrl,
|
||||
game.libraryImageUrl,
|
||||
game.iconUrl
|
||||
game.libraryImageUrl ?? game.iconUrl
|
||||
),
|
||||
[game.libraryHeroImageUrl, game.libraryImageUrl, game.iconUrl]
|
||||
[
|
||||
game.customHeroImageUrl,
|
||||
game.libraryHeroImageUrl,
|
||||
game.libraryImageUrl,
|
||||
game.iconUrl,
|
||||
]
|
||||
);
|
||||
|
||||
const backgroundStyle = useMemo(
|
||||
() => ({ backgroundImage: `url(${backgroundImage})` }),
|
||||
() =>
|
||||
backgroundImage ? { backgroundImage: `url(${backgroundImage})` } : {},
|
||||
[backgroundImage]
|
||||
);
|
||||
|
||||
@@ -49,7 +61,7 @@ export const LibraryGameCardLarge = memo(function LibraryGameCardLarge({
|
||||
[game.unlockedAchievementCount, game.achievementCount]
|
||||
);
|
||||
|
||||
const logoImage = game.logoImageUrl;
|
||||
const logoImage = game.customLogoImageUrl ?? game.logoImageUrl;
|
||||
|
||||
return (
|
||||
<button
|
||||
|
||||
@@ -25,12 +25,14 @@ export const LibraryGameCard = memo(function LibraryGameCard({
|
||||
const { formatPlayTime, handleCardClick, handleContextMenuClick } =
|
||||
useGameCard(game, onContextMenu);
|
||||
|
||||
const coverImage =
|
||||
const coverImage = (
|
||||
game.customIconUrl ??
|
||||
game.coverImageUrl ??
|
||||
game.libraryImageUrl ??
|
||||
game.libraryHeroImageUrl ??
|
||||
game.iconUrl ??
|
||||
undefined;
|
||||
""
|
||||
).replaceAll("\\", "/");
|
||||
|
||||
return (
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user