feat: get image assets from api

This commit is contained in:
Zamitto
2025-05-07 21:05:50 -03:00
parent b6c433dea9
commit 30584492af
11 changed files with 58 additions and 104 deletions

View File

@@ -9,7 +9,6 @@ import { useTranslation } from "react-i18next";
import { Badge } from "../badge/badge";
import { useCallback, useState, useMemo } from "react";
import { useFormat, useRepacks } from "@renderer/hooks";
import { steamUrlBuilder } from "@shared";
export interface GameCardProps
extends React.DetailedHTMLProps<
@@ -63,7 +62,7 @@ export function GameCard({ game, ...props }: GameCardProps) {
>
<div className="game-card__backdrop">
<img
src={steamUrlBuilder.library(game.objectId)}
src={game.libraryImageUrl}
alt={game.title}
className="game-card__cover"
loading="lazy"

View File

@@ -43,7 +43,7 @@ export function Hero() {
<div className="hero__backdrop">
<img
src={game.background}
alt={game.description}
alt={game.description ?? ""}
className="hero__media"
/>
@@ -52,7 +52,7 @@ export function Hero() {
<img
src={game.logo}
width="250px"
alt={game.description}
alt={game.description ?? ""}
loading="eager"
/>
)}

View File

@@ -33,6 +33,7 @@ import type {
Badge,
Auth,
ShortcutLocation,
CatalogueSearchResult,
} from "@types";
import type { AxiosProgressEvent } from "axios";
import type disk from "diskusage";
@@ -69,7 +70,7 @@ declare global {
payload: CatalogueSearchPayload,
take: number,
skip: number
) => Promise<{ edges: any[]; count: number }>;
) => Promise<{ edges: CatalogueSearchResult[]; count: number }>;
getCatalogue: (category: CatalogueCategory) => Promise<any[]>;
getGameShopDetails: (
objectId: string,

View File

@@ -1,4 +1,4 @@
import type { DownloadSource } from "@types";
import type { CatalogueSearchResult, DownloadSource } from "@types";
import {
useAppDispatch,
@@ -44,7 +44,7 @@ export default function Catalogue() {
const [downloadSources, setDownloadSources] = useState<DownloadSource[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [results, setResults] = useState<any[]>([]);
const [results, setResults] = useState<CatalogueSearchResult[]>([]);
const [itemsCount, setItemsCount] = useState(0);

View File

@@ -1,15 +1,15 @@
import { Badge } from "@renderer/components";
import { buildGameDetailsPath } from "@renderer/helpers";
import { useAppSelector, useRepacks } from "@renderer/hooks";
import { steamUrlBuilder } from "@shared";
import { useMemo } from "react";
import { useNavigate } from "react-router-dom";
import "./game-item.scss";
import { useTranslation } from "react-i18next";
import { CatalogueSearchResult } from "@types";
export interface GameItemProps {
game: any;
game: CatalogueSearchResult;
}
export function GameItem({ game }: GameItemProps) {
@@ -51,7 +51,7 @@ export function GameItem({ game }: GameItemProps) {
>
<img
className="game-item__cover"
src={steamUrlBuilder.library(game.objectId)}
src={game.libraryImageUrl}
alt={game.title}
loading="lazy"
/>

View File

@@ -12,7 +12,6 @@ import { userProfileContext } from "@renderer/context";
import { ClockIcon, TrophyIcon } from "@primer/octicons-react";
import { MAX_MINUTES_TO_SHOW_IN_PLAYTIME } from "@renderer/constants";
import { useTranslation } from "react-i18next";
import { steamUrlBuilder } from "@shared";
import "./user-library-game-card.scss";
interface UserLibraryGameCardProps {
@@ -150,7 +149,7 @@ export function UserLibraryGameCard({
</div>
<img
src={steamUrlBuilder.cover(game.objectId)}
src={game.coverImageUrl}
alt={game.title}
className="user-library-game__game-image"
/>