Skip to content

Commit

Permalink
fix: items load normally again
Browse files Browse the repository at this point in the history
  • Loading branch information
RasenGUY committed Dec 8, 2023
1 parent 7c64df6 commit 479b55a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/common/GameBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function GameBar({
const { user, network } = useWegaStore();
const tokenDecimals: number = SupportedWagerTokenAddresses[game?.wager.wagerCurrency as AllPossibleCurrencyTypes][game?.networkId as number].decimals as number;

return game && user?.uuid && network ? (
return game && user?.uuid && network && tokenDecimals ? (
<BarWrapper tw="w-full grid grid-cols-5 " {...rest}>
{/* date */}
<DateColumn tw="max-w-[max-content]">{dateFromTs(new Date(game.createdAt as string).getTime() * 1000)}</DateColumn>
Expand Down
4 changes: 3 additions & 1 deletion src/components/WegaGames/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const JoinableAndPlayableGames: React.FC<JoinableAndPlayableGamesProps> =
const { data, isLoading, isSuccess} = useGetGamesQuery({ networkId: networkId ?? defaultNetwork?.id });
const [gameIds, setGameIds] = useState<number[]>([]);
useEffect(() => {
console.log(data)
if(isSuccess && data && data?.entities) {
const dataArray = data.ids.map((id: number) => data.entities[id]) as Wega[];
const playableGames = filterPlayableGames(dataArray, userUuid);
Expand All @@ -30,6 +31,7 @@ export const JoinableAndPlayableGames: React.FC<JoinableAndPlayableGamesProps> =
const sortedGameIds = sortPlayableGames([...playableGames, ...joinableGames, ...waitingGames]).map(game => game.id);
setGameIds(sortedGameIds);
}
console.log(gameIds)
}, [data, gamesCount, isSuccess, defaultNetwork?.id]);

return !isLoading ? (<Section hdr="Join matches instantly" direction="col" tw="gap-2 mt-[35px] " { ...rest }>
Expand All @@ -41,7 +43,7 @@ export const JoinableAndPlayableGames: React.FC<JoinableAndPlayableGamesProps> =
<span tw="invisible"></span>
</JoinableGamesHeaderBar>
{
gameIds && gameIds.map((gameId: number) => (<GameBar gameId={gameId} key={`joinable-and-playable-game-bar${gameId}`} tw="dark:bg-[#1C1C1C] py-2 px-3 rounded-[5px]" /> ))
gameIds ? gameIds.map((gameId: number) => (<GameBar gameId={gameId} key={`joinable-and-playable-game-bar${gameId}`} tw="dark:bg-[#1C1C1C] py-2 px-3 rounded-[5px]" /> )) : <></>
}
</Section>
) : <ComponentLoader tw="mt-[2rem] w-full flex justify-center" />
Expand Down
3 changes: 1 addition & 2 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import { gamesApiSlice } from './components/WegaGames/apiSlice.ts'
import './themes/index.css'
import GlobalStyles from "./themes/GlobalStyles.tsx";
import WalletProvider from './containers/WalletProvider/index.tsx'
import { defaultNetwork } from "./models/constants.ts";
// TODO
// remove old api files
store.dispatch(gamesApiSlice.endpoints.getGames.initiate({ networkId: defaultNetwork?.id }));
store.dispatch(gamesApiSlice.endpoints.getGames.initiate(undefined));
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<ReduxProvider store={store}>
Expand Down

0 comments on commit 479b55a

Please sign in to comment.