From bc24e060e5b3f9835d81d06f821aa1870e1230b2 Mon Sep 17 00:00:00 2001 From: Thomas Chazot Date: Tue, 5 Dec 2023 16:01:12 +0100 Subject: [PATCH] variable d'environnement pour le path avec le / --- cryptide_project/src/Components/GraphContainer.tsx | 4 ++-- cryptide_project/src/Components/LobbyContainer.tsx | 2 +- cryptide_project/src/Components/NavBar.tsx | 4 ++-- cryptide_project/src/Pages/Lobby.tsx | 10 +++++----- cryptide_project/src/Pages/LoginForm.tsx | 2 +- cryptide_project/src/Pages/NewPlay.tsx | 10 +++++----- cryptide_project/src/Pages/Play.tsx | 12 ++++++------ cryptide_project/src/Pages/Profile.tsx | 2 +- cryptide_project/src/Pages/SignUpForm.tsx | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cryptide_project/src/Components/GraphContainer.tsx b/cryptide_project/src/Components/GraphContainer.tsx index 634f495..83697dd 100644 --- a/cryptide_project/src/Components/GraphContainer.tsx +++ b/cryptide_project/src/Components/GraphContainer.tsx @@ -811,7 +811,7 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS socket.off("put imossible grey") socket.off("who plays") - navigate(`/${basePath}/endgame`) + navigate(`${basePath}/endgame`) } } }) @@ -1020,7 +1020,7 @@ const MyGraphComponent: React.FC = ({onNodeClick, handleS catch(error){ console.log(error); } - navigate(`/${basePath}/endgame?solo=true+${isDaily}`) + navigate(`${basePath}/endgame?solo=true+${isDaily}`) } } diff --git a/cryptide_project/src/Components/LobbyContainer.tsx b/cryptide_project/src/Components/LobbyContainer.tsx index ac0037c..797cef5 100644 --- a/cryptide_project/src/Components/LobbyContainer.tsx +++ b/cryptide_project/src/Components/LobbyContainer.tsx @@ -49,7 +49,7 @@ const LobbyContainer: React.FC = ({roomNum, HeadPlayer, nbP if (nbPlayer < 6 && !started) { socket.off("request lobbies") setFirst(true) - navigate(`/${basePath}/${dest}`); + navigate(`${basePath}/${dest}`); } else if(started){ handleShowStart() diff --git a/cryptide_project/src/Components/NavBar.tsx b/cryptide_project/src/Components/NavBar.tsx index 75b45c6..5921026 100644 --- a/cryptide_project/src/Components/NavBar.tsx +++ b/cryptide_project/src/Components/NavBar.tsx @@ -37,11 +37,11 @@ function AppNavbar({changeLocale}) { function navigateToProfile(){ - navigate(`/${basePath}/profile`) + navigate(`${basePath}/profile`) } function navigateToHome(){ - navigate(`/${basePath}/`) + navigate(`${basePath}/`) } return ( diff --git a/cryptide_project/src/Pages/Lobby.tsx b/cryptide_project/src/Pages/Lobby.tsx index 248c8cc..572c36a 100644 --- a/cryptide_project/src/Pages/Lobby.tsx +++ b/cryptide_project/src/Pages/Lobby.tsx @@ -136,7 +136,7 @@ function Lobby() { gameStarted = true //socket.off("player left") //socket.off("new player") - navigate(`/${basePath}/game?solo=false&daily=false`); + navigate(`${basePath}/game?solo=false&daily=false`); }); @@ -172,7 +172,7 @@ function Lobby() { setIndicesData(choosenIndices) first = true gameStarted = true - navigate(`/${basePath}/game?solo=false&daily=false`) + navigate(`${basePath}/game?solo=false&daily=false`) }); socket.on("new player", (tab) =>{ @@ -187,17 +187,17 @@ function Lobby() { socket.on("room full", () => { //TODO POP UP pour quand la room est pleine - navigate(`/${basePath}/play`) + navigate(`${basePath}/play`) }) socket.on("game started", () => { //TODO POP UP pour quand la room est pleine - navigate(`/${basePath}/play`) + navigate(`${basePath}/play`) }) socket.on("game already started", () => { //TODO POP UP pour quand la room est pleine - navigate(`/${basePath}/play`) + navigate(`${basePath}/play`) }) socket.on("player left", (tab, i) => { diff --git a/cryptide_project/src/Pages/LoginForm.tsx b/cryptide_project/src/Pages/LoginForm.tsx index 764e0f5..dde8427 100644 --- a/cryptide_project/src/Pages/LoginForm.tsx +++ b/cryptide_project/src/Pages/LoginForm.tsx @@ -37,7 +37,7 @@ const SignIn = () => { setShowConfirmation(true); setTimeout(async () => { await login(); - navigate(`/${basePath}/`); + navigate(`${basePath}/`); }, 1250); } } catch (error: any) { diff --git a/cryptide_project/src/Pages/NewPlay.tsx b/cryptide_project/src/Pages/NewPlay.tsx index 2cc7999..8c658f1 100644 --- a/cryptide_project/src/Pages/NewPlay.tsx +++ b/cryptide_project/src/Pages/NewPlay.tsx @@ -100,7 +100,7 @@ function NewPlay() { setPersonNetworkData(networkPerson) setIndicesData(choosenIndices) setIndicesData(choosenIndices) - navigate(`/${basePath}/game?solo=true&daily=false`); + navigate(`${basePath}/game?solo=true&daily=false`); } @@ -131,12 +131,12 @@ function NewPlay() { useEffect(() => { if (room !== null) { const nouvelleURL = `/lobby?room=${room}`; - navigate(`/${basePath}${nouvelleURL}`) + navigate(`${basePath}${nouvelleURL}`) } }, [room, navigate]); const goBack = () => { - navigate(`/${basePath}/lobby?room=${goBackRoom}`) + navigate(`${basePath}/lobby?room=${goBackRoom}`) } @@ -159,7 +159,7 @@ function NewPlay() { setIndicesData(choosenIndices) setIndicesData(choosenIndices) - navigate(`/${basePath}/game?solo=true&daily=true&easy=true`); + navigate(`${basePath}/game?solo=true&daily=true&easy=true`); setShowOverlay(false); }; @@ -177,7 +177,7 @@ function NewPlay() { const map = EnigmeDuJourCreator.createEnigme(networkPerson, choosenIndices, choosenPerson, Stub.GenerateIndice()) setDailyEnigmeData(map) } - navigate(`/${basePath}/game?solo=true&daily=true&easy=false`); + navigate(`${basePath}/game?solo=true&daily=true&easy=false`); setShowOverlay(false); }; diff --git a/cryptide_project/src/Pages/Play.tsx b/cryptide_project/src/Pages/Play.tsx index 097d73d..e783f53 100644 --- a/cryptide_project/src/Pages/Play.tsx +++ b/cryptide_project/src/Pages/Play.tsx @@ -100,7 +100,7 @@ function Play() { setPersonNetworkData(networkPerson) setIndicesData(choosenIndices) setIndicesData(choosenIndices) - navigate(`/${basePath}/game?solo=true&daily=false`); + navigate(`${basePath}/game?solo=true&daily=false`); } @@ -131,12 +131,12 @@ function Play() { useEffect(() => { if (room !== null) { const nouvelleURL = `/lobby?room=${room}`; - navigate(`/${basePath}${nouvelleURL}`); + navigate(`${basePath}${nouvelleURL}`); } }, [room, navigate]); const goBack = () => { - navigate(`/${basePath}/lobby?room=${goBackRoom}`) + navigate(`${basePath}/lobby?room=${goBackRoom}`) } @@ -159,7 +159,7 @@ function Play() { setIndicesData(choosenIndices) setIndicesData(choosenIndices) - navigate(`/${basePath}/game?solo=true&daily=true&easy=true`); + navigate(`${basePath}/game?solo=true&daily=true&easy=true`); setShowOverlay(false); }; @@ -177,7 +177,7 @@ function Play() { const map = EnigmeDuJourCreator.createEnigme(networkPerson, choosenIndices, choosenPerson, Stub.GenerateIndice()) setDailyEnigmeData(map) } - navigate(`/${basePath}/game?solo=true&daily=true&easy=false`); + navigate(`${basePath}/game?solo=true&daily=true&easy=false`); setShowOverlay(false); }; @@ -240,7 +240,7 @@ function Play() { - +
diff --git a/cryptide_project/src/Pages/Profile.tsx b/cryptide_project/src/Pages/Profile.tsx index 91e1bf9..a59ad2e 100644 --- a/cryptide_project/src/Pages/Profile.tsx +++ b/cryptide_project/src/Pages/Profile.tsx @@ -186,7 +186,7 @@ const Profile = () => { } handleCloseDeleteModal(); - navigate(`/${basePath}/`) + navigate(`${basePath}/`) } else { console.error('Phrase de confirmation incorrecte.'); diff --git a/cryptide_project/src/Pages/SignUpForm.tsx b/cryptide_project/src/Pages/SignUpForm.tsx index f7f2a1a..9e29449 100644 --- a/cryptide_project/src/Pages/SignUpForm.tsx +++ b/cryptide_project/src/Pages/SignUpForm.tsx @@ -35,7 +35,7 @@ const SignUp = () => { setShowConfirmation(true); setTimeout(() => { - navigate(`/${basePath}/login`); // 3 secondes avant de rediriger vers la page de connexion + navigate(`${basePath}/login`); // 3 secondes avant de rediriger vers la page de connexion }, 1250); } } catch (error: any) {