mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: get iconUrl
This commit is contained in:
parent
c8fa8f99d2
commit
6b2549ed13
4 changed files with 34 additions and 11 deletions
|
@ -5,6 +5,7 @@ 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";
|
import { convertSteamGameToCatalogueEntry } from "../helpers/search-games";
|
||||||
|
import { getSteamAppAsset } from "@main/helpers";
|
||||||
|
|
||||||
const getUserProfile = async (
|
const getUserProfile = async (
|
||||||
_event: Electron.IpcMainInvokeEvent,
|
_event: Electron.IpcMainInvokeEvent,
|
||||||
|
@ -19,8 +20,11 @@ const getUserProfile = async (
|
||||||
const steamGame = await steamGamesWorker.run(Number(game.objectId), {
|
const steamGame = await steamGamesWorker.run(Number(game.objectId), {
|
||||||
name: "getById",
|
name: "getById",
|
||||||
});
|
});
|
||||||
|
const iconUrl = steamGame?.clientIcon
|
||||||
|
? getSteamAppAsset("icon", game.objectId, steamGame.clientIcon)
|
||||||
|
: null;
|
||||||
|
|
||||||
return convertSteamGameToCatalogueEntry(steamGame);
|
return { ...convertSteamGameToCatalogueEntry(steamGame), iconUrl };
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -29,7 +33,11 @@ const getUserProfile = async (
|
||||||
const steamGame = await steamGamesWorker.run(Number(game.objectId), {
|
const steamGame = await steamGamesWorker.run(Number(game.objectId), {
|
||||||
name: "getById",
|
name: "getById",
|
||||||
});
|
});
|
||||||
return convertSteamGameToCatalogueEntry(steamGame);
|
const iconUrl = steamGame?.clientIcon
|
||||||
|
? getSteamAppAsset("icon", game.objectId, steamGame.clientIcon)
|
||||||
|
: null;
|
||||||
|
|
||||||
|
return { ...convertSteamGameToCatalogueEntry(steamGame), iconUrl };
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { UserProfile } from "@types";
|
import { UserProfile } from "@types";
|
||||||
|
import cn from "classnames";
|
||||||
import * as styles from "./profile.css";
|
import * as styles from "./profile.css";
|
||||||
import { SPACING_UNIT, vars } from "@renderer/theme.css";
|
import { SPACING_UNIT, vars } from "@renderer/theme.css";
|
||||||
|
|
||||||
|
@ -22,7 +23,7 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => {
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div className={styles.profileContent}>
|
<div className={styles.profileContent}>
|
||||||
<div style={{ width: "100%" }}>
|
<div className={styles.profileGameSection}>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
@ -52,7 +53,7 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => {
|
||||||
return (
|
return (
|
||||||
<div key={game.objectID}>
|
<div key={game.objectID}>
|
||||||
<img
|
<img
|
||||||
src={game.cover}
|
src={game.iconUrl}
|
||||||
width={50}
|
width={50}
|
||||||
height={50}
|
height={50}
|
||||||
alt={"Icon for " + game.title}
|
alt={"Icon for " + game.title}
|
||||||
|
@ -64,7 +65,7 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.contentSidebar}>
|
<div className={cn(styles.contentSidebar, styles.profileGameSection)}>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
@ -89,11 +90,11 @@ export const ProfileContent = ({ userProfile }: ProfileContentProps) => {
|
||||||
className={styles.profileContentBox}
|
className={styles.profileContentBox}
|
||||||
style={{ flexDirection: "column" }}
|
style={{ flexDirection: "column" }}
|
||||||
>
|
>
|
||||||
{userProfile.libraryGames.map((game, index) => {
|
{userProfile.libraryGames.map((game) => {
|
||||||
return (
|
return (
|
||||||
<div key={game.objectID}>
|
<div key={game.objectID}>
|
||||||
<img
|
<img
|
||||||
src={game.cover}
|
src={game.iconUrl}
|
||||||
width={50}
|
width={50}
|
||||||
height={50}
|
height={50}
|
||||||
alt={"Icon for " + game.title}
|
alt={"Icon for " + game.title}
|
||||||
|
|
|
@ -6,7 +6,7 @@ export const wrapper = style({
|
||||||
width: "100%",
|
width: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
gap: `${SPACING_UNIT * 2}px`,
|
gap: `${SPACING_UNIT * 3}px`,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const profileContentBox = style({
|
export const profileContentBox = style({
|
||||||
|
@ -46,9 +46,15 @@ export const profileContent = style({
|
||||||
gap: `${SPACING_UNIT * 4}px`,
|
gap: `${SPACING_UNIT * 4}px`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const profileGameSection = style({
|
||||||
|
width: "100%",
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
gap: `${SPACING_UNIT}px`,
|
||||||
|
});
|
||||||
|
|
||||||
export const contentSidebar = style({
|
export const contentSidebar = style({
|
||||||
width: "100%",
|
width: "100%",
|
||||||
height: "100%",
|
|
||||||
"@media": {
|
"@media": {
|
||||||
"(min-width: 768px)": {
|
"(min-width: 768px)": {
|
||||||
width: "100%",
|
width: "100%",
|
||||||
|
|
|
@ -85,6 +85,14 @@ export interface CatalogueEntry {
|
||||||
repacks: GameRepack[];
|
repacks: GameRepack[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface ProfileGame {
|
||||||
|
objectID: string;
|
||||||
|
shop: GameShop;
|
||||||
|
title: string;
|
||||||
|
iconUrl;
|
||||||
|
string?;
|
||||||
|
}
|
||||||
|
|
||||||
export interface DownloadQueue {
|
export interface DownloadQueue {
|
||||||
id: number;
|
id: number;
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
@ -236,8 +244,8 @@ export interface RealDebridUser {
|
||||||
|
|
||||||
export interface UserProfile {
|
export interface UserProfile {
|
||||||
username: string;
|
username: string;
|
||||||
libraryGames: Partial<CatalogueEntry>[];
|
libraryGames: ProfileGame[];
|
||||||
recentGames: Partial<CatalogueEntry>[];
|
recentGames: ProfileGame[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DownloadSource {
|
export interface DownloadSource {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue