chore: formatting

This commit is contained in:
2024-03-06 16:32:21 +00:00
parent a385ca3271
commit 5e58af119d
29 changed files with 264 additions and 224 deletions

View File

@ -3,26 +3,26 @@ import GameDatabase, { GameInfo } from "@/service/game-database";
import { useEffect, useState } from "react";
export default function useGameInfo(gameId?: string, gameInfo?: GameInfo) {
const [game, setGame] = useState<GameInfo | undefined>(gameInfo);
const [game, setGame] = useState<GameInfo | undefined>(gameInfo);
useEffect(() => {
if (!gameInfo && gameId) {
const [prefix, id] = gameId.split(":");
if (prefix === "internal" || !gameId.includes(":")) {
const ix = AllCategories.find(a => a.id === id || a.id === gameId);
if (ix) {
setGame({
id: `internal:${ix.id}`,
name: ix.name,
genres: ix.tags,
className: ix.className
});
}
} else {
new GameDatabase().getGame(gameId).then(setGame);
}
useEffect(() => {
if (!gameInfo && gameId) {
const [prefix, id] = gameId.split(":");
if (prefix === "internal" || !gameId.includes(":")) {
const ix = AllCategories.find(a => a.id === id || a.id === gameId);
if (ix) {
setGame({
id: `internal:${ix.id}`,
name: ix.name,
genres: ix.tags,
className: ix.className,
});
}
}, [gameInfo, gameId]);
} else {
new GameDatabase().getGame(gameId).then(setGame);
}
}
}, [gameInfo, gameId]);
return game;
}
return game;
}