feat: Add game thumbnail fetching from external APIs, migrate

This commit is contained in:
2025-12-04 15:15:47 +01:00
parent f49900adad
commit 04e21708b2
7 changed files with 882 additions and 59 deletions
+44
View File
@@ -0,0 +1,44 @@
import { useState } from "react";
interface GameImageProps {
game: string;
}
export function GameImage({ game }: GameImageProps) {
const [error, setError] = useState(false);
if (error) {
return (
<div
style={{
width: "100%",
height: "150px",
background: "#ddd",
display: "flex",
alignItems: "center",
justifyContent: "center",
color: "#666",
borderRadius: "8px",
marginTop: "0.5rem",
}}
>
No Image Available
</div>
);
}
return (
<img
src={`/api/game_thumbnail/${encodeURIComponent(game)}`}
alt={`${game} cover`}
onError={() => setError(true)}
style={{
width: "100%",
height: "auto",
borderRadius: "8px",
marginTop: "0.5rem",
objectFit: "cover",
}}
/>
);
}