feat: use convertSteamGameToCatalogueEntry

This commit is contained in:
Zamitto 2024-06-12 23:14:59 -03:00
parent 56f0439aaf
commit 3f0a1207e9
2 changed files with 16 additions and 5 deletions

View File

@ -4,6 +4,7 @@ import { logger } from "@main/services";
import { HydraApi } from "@main/services/hydra-api"; import { HydraApi } from "@main/services/hydra-api";
import { steamGamesWorker } from "@main/workers"; import { steamGamesWorker } from "@main/workers";
import { UserProfile } from "@types"; import { UserProfile } from "@types";
import { convertSteamGameToCatalogueEntry } from "../helpers/search-games";
const getUserProfile = async ( const getUserProfile = async (
_event: Electron.IpcMainInvokeEvent, _event: Electron.IpcMainInvokeEvent,
@ -19,7 +20,7 @@ const getUserProfile = async (
name: "getById", name: "getById",
}); });
return { ...game, title: steamGame.name, objectId: game.objectId }; return convertSteamGameToCatalogueEntry(steamGame);
}) })
); );
@ -28,7 +29,7 @@ const getUserProfile = async (
const steamGame = await steamGamesWorker.run(Number(game.objectId), { const steamGame = await steamGamesWorker.run(Number(game.objectId), {
name: "getById", name: "getById",
}); });
return { ...game, title: steamGame.name, objectID: game.objectId }; return convertSteamGameToCatalogueEntry(steamGame);
}) })
); );

View File

@ -16,7 +16,7 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => {
<section className={styles.profileContentBox}> <section className={styles.profileContentBox}>
<img <img
className={styles.profileAvatar} className={styles.profileAvatar}
src="https://avatars.githubusercontent.com/u/167933696?v=4" src="https://cdn.losbroxas.org/3918aa27-9b96-4fdf-b066-4c545d6667ab.png"
/> />
<div className={styles.profileInformation}> <div className={styles.profileInformation}>
@ -53,7 +53,12 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => {
style={{ flexDirection: "column" }} style={{ flexDirection: "column" }}
> >
{userProfile.recentGames.map((game) => { {userProfile.recentGames.map((game) => {
return <p key={game.objectID}>{game.title}</p>; return (
<>
<img src={game.cover} width={50} height={50} />
<p key={game.objectID}>{game.title}</p>
</>
);
})} })}
</div> </div>
</div> </div>
@ -84,7 +89,12 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => {
style={{ flexDirection: "column" }} style={{ flexDirection: "column" }}
> >
{userProfile.libraryGames.map((game) => { {userProfile.libraryGames.map((game) => {
return <p key={game.objectID}>{game.title}</p>; return (
<>
<img src={game.cover} width={50} height={50} />{" "}
<p key={game.objectID}>{game.title}</p>
</>
);
})} })}
</div> </div>
</div> </div>