From 8cf6e36928544641a30f983fca158d2242e3f8c4 Mon Sep 17 00:00:00 2001 From: aguilhot Date: Thu, 5 Jan 2023 08:35:49 +0100 Subject: [PATCH] Modifications on the GameList component --- bob_party/src/components/GameList.tsx | 12 +++++++----- bob_party/src/screens/Home.tsx | 7 +++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/bob_party/src/components/GameList.tsx b/bob_party/src/components/GameList.tsx index 710419e..9f4a821 100644 --- a/bob_party/src/components/GameList.tsx +++ b/bob_party/src/components/GameList.tsx @@ -9,6 +9,7 @@ import { Game } from "../core/game" import { useGameStore } from "../context/gameContext" import { GameComponent } from "./GameComponent" import ManagerGame from "../services/gameService/managerGame" +import { MANAGER_GAME, MANAGER_USER } from "../../appManagers" export const GameList : @@ -19,13 +20,14 @@ FC<{nav: any}> = let gameList : Game[] | undefined; - if(currentGameType === "solo" ){ - console.log("sole"); - gameList = useGameStore((state) => state.tabGameSolo); + if(MANAGER_GAME.currentGameType === "solo" ){ + console.log("solo"); + gameList = MANAGER_GAME.getTabGameSolo(); + console.log(gameList); } - else if(currentGameType === "multi"){ + else if(MANAGER_GAME.currentGameType === "multi"){ console.log("multi"); - gameList = useGameStore((state) => state.tabGameMulti); + gameList = MANAGER_GAME.getTabGameMulti(); } else{ console.log("crotte"); diff --git a/bob_party/src/screens/Home.tsx b/bob_party/src/screens/Home.tsx index b165d17..5c8f454 100644 --- a/bob_party/src/screens/Home.tsx +++ b/bob_party/src/screens/Home.tsx @@ -11,6 +11,7 @@ import { MANAGER_CONVERSATION, MANAGER_GAME, MANAGER_USER } from '../../appManag import { socket } from '../../socketConfig'; import { useConversationStore } from '../context/conversationContext'; import { Message } from '../core/message'; +import ManagerUser from '../services/userServices/managerUser'; @@ -23,8 +24,6 @@ function Home(props: { navigation: any; }) { - - //It has to be in the home page that way the database will reload the conversations when the user receive a message een if he is in another page @@ -38,11 +37,11 @@ function Home(props: { navigation: any; }) { { navigation.navigate('GameChoiceTab') }} + onPress={() => { MANAGER_GAME.currentGameType="solo";navigation.navigate('GameChoiceTab') }} /> navigation.navigate('GameChoiceTab')} + onPress={() => { MANAGER_GAME.currentGameType="multi" ; navigation.navigate('GameChoiceTab')}} />