Merge branch 'release/v3.7.5'

This commit is contained in:
Zamitto
2025-11-11 18:17:53 -03:00
6 changed files with 17 additions and 24 deletions

View File

@@ -4,7 +4,6 @@ import {
downloadsSublevel, downloadsSublevel,
gamesShopAssetsSublevel, gamesShopAssetsSublevel,
gamesSublevel, gamesSublevel,
gameAchievementsSublevel,
} from "@main/level"; } from "@main/level";
const getLibrary = async (): Promise<LibraryGame[]> => { const getLibrary = async (): Promise<LibraryGame[]> => {
@@ -19,33 +18,19 @@ const getLibrary = async (): Promise<LibraryGame[]> => {
const download = await downloadsSublevel.get(key); const download = await downloadsSublevel.get(key);
const gameAssets = await gamesShopAssetsSublevel.get(key); const gameAssets = await gamesShopAssetsSublevel.get(key);
let unlockedAchievementCount = 0;
let achievementCount = 0;
try {
const achievements = await gameAchievementsSublevel.get(key);
if (achievements) {
achievementCount = achievements.achievements.length;
unlockedAchievementCount =
achievements.unlockedAchievements.length;
}
} catch {
// No achievements data for this game
}
return { return {
id: key, id: key,
...game, ...game,
download: download ?? null, download: download ?? null,
unlockedAchievementCount, unlockedAchievementCount: game.unlockedAchievementCount ?? 0,
achievementCount, achievementCount: game.achievementCount ?? 0,
// Spread gameAssets last to ensure all image URLs are properly set // Spread gameAssets last to ensure all image URLs are properly set
...gameAssets, ...gameAssets,
// Preserve custom image URLs from game if they exist // Preserve custom image URLs from game if they exist
customIconUrl: game.customIconUrl, customIconUrl: game.customIconUrl,
customLogoImageUrl: game.customLogoImageUrl, customLogoImageUrl: game.customLogoImageUrl,
customHeroImageUrl: game.customHeroImageUrl, customHeroImageUrl: game.customHeroImageUrl,
} as LibraryGame; };
}) })
); );
}); });

View File

@@ -9,6 +9,8 @@ type ProfileGame = {
hasManuallyUpdatedPlaytime: boolean; hasManuallyUpdatedPlaytime: boolean;
isFavorite?: boolean; isFavorite?: boolean;
isPinned?: boolean; isPinned?: boolean;
achievementCount: number;
unlockedAchievementCount: number;
} & ShopAssets; } & ShopAssets;
export const mergeWithRemoteGames = async () => { export const mergeWithRemoteGames = async () => {
@@ -39,6 +41,8 @@ export const mergeWithRemoteGames = async () => {
playTimeInMilliseconds: updatedPlayTime, playTimeInMilliseconds: updatedPlayTime,
favorite: game.isFavorite ?? localGame.favorite, favorite: game.isFavorite ?? localGame.favorite,
isPinned: game.isPinned ?? localGame.isPinned, isPinned: game.isPinned ?? localGame.isPinned,
achievementCount: game.achievementCount,
unlockedAchievementCount: game.unlockedAchievementCount,
}); });
} else { } else {
await gamesSublevel.put(gameKey, { await gamesSublevel.put(gameKey, {
@@ -55,6 +59,8 @@ export const mergeWithRemoteGames = async () => {
isDeleted: false, isDeleted: false,
favorite: game.isFavorite ?? false, favorite: game.isFavorite ?? false,
isPinned: game.isPinned ?? false, isPinned: game.isPinned ?? false,
achievementCount: game.achievementCount,
unlockedAchievementCount: game.unlockedAchievementCount,
}); });
} }

View File

@@ -47,7 +47,7 @@ export function GameCard({ game, ...props }: GameCardProps) {
> >
<div className="game-card__backdrop"> <div className="game-card__backdrop">
<img <img
src={game.libraryImageUrl} src={game.libraryImageUrl ?? undefined}
alt={game.title} alt={game.title}
className="game-card__cover" className="game-card__cover"
loading="lazy" loading="lazy"

View File

@@ -50,14 +50,14 @@ export function Hero() {
> >
<div className="hero__backdrop"> <div className="hero__backdrop">
<img <img
src={game.libraryHeroImageUrl} src={game.libraryHeroImageUrl ?? undefined}
alt={game.description ?? ""} alt={game.description ?? ""}
className="hero__media" className="hero__media"
/> />
<div className="hero__content"> <div className="hero__content">
<img <img
src={game.logoImageUrl} src={game.logoImageUrl ?? undefined}
width="250px" width="250px"
alt={game.description ?? ""} alt={game.description ?? ""}
loading="eager" loading="eager"

View File

@@ -42,9 +42,9 @@ export interface ShopAssets {
shop: GameShop; shop: GameShop;
title: string; title: string;
iconUrl: string | null; iconUrl: string | null;
libraryHeroImageUrl: string; libraryHeroImageUrl: string | null;
libraryImageUrl: string; libraryImageUrl: string | null;
logoImageUrl: string; logoImageUrl: string | null;
logoPosition: string | null; logoPosition: string | null;
coverImageUrl: string | null; coverImageUrl: string | null;
downloadSources: string[]; downloadSources: string[];

View File

@@ -56,6 +56,8 @@ export interface Game {
launchOptions?: string | null; launchOptions?: string | null;
favorite?: boolean; favorite?: boolean;
isPinned?: boolean; isPinned?: boolean;
achievementCount?: number;
unlockedAchievementCount?: number;
pinnedDate?: Date | null; pinnedDate?: Date | null;
automaticCloudSync?: boolean; automaticCloudSync?: boolean;
hasManuallyUpdatedPlaytime?: boolean; hasManuallyUpdatedPlaytime?: boolean;