Compare commits

..

No commits in common. 'e94001ce1d7c310d94b5ffb792c83bff3abfe0dd' and '50092b31d67b0b7e7f0f057e90e1bc23d9a8570e' have entirely different histories.

@ -4,6 +4,7 @@
/* background-color: #D7D4C6; */
background-color: #fff;
min-height: 100vh;
display: flex;
font-size: calc(10px + 2vmin);
/* color: #2A4541; */
}

@ -28,7 +28,7 @@ class LobbyDataProps {
}
}
// let cptNavigation = 0
let cptNavigation = 0
function Lobbies() {
const theme=useTheme();
@ -42,8 +42,6 @@ function Lobbies() {
const [showAvailable, setShowAvailable] = useState(true);
const [cptNavigation, setCptNavigation] = useState(0);
const handleShowAllClick = () => {
setShowAvailable(false);
};
@ -52,18 +50,7 @@ function Lobbies() {
setShowAvailable(true);
};
const handleSetFirst = () => {
setFirst(false);
socket.emit("request lobbies");
};
const handleSetCptNavigation = () => {
setCptNavigation((prevCpt) => prevCpt + 1);
if (cptNavigation % 2 === 0 && navigationType.toString() === "POP") {
socket.emit("player quit");
}
};
const filteredLobbies = lobbyData.filter((lobby) =>
lobby.roomNum.toLowerCase().includes(searchTerm.toLowerCase()) ||
lobby.headPlayer.pseudo.toLowerCase().includes(searchTerm.toLowerCase())
@ -72,25 +59,26 @@ function Lobbies() {
const filteredLobbiesToShow = showAvailable
? filteredLobbies.filter((lobby) => lobby.started == false && lobby.nbPlayer < 6) //* retire les lobbies pleins ou commencés
: filteredLobbies;
const setFirstData = (first: boolean) => {
setFirst(first)
}
const navigationType = useNavigationType();
const navigationType = useNavigationType()
cptNavigation++
if (cptNavigation % 2 == 0){
if (navigationType.toString() == "POP"){
socket.emit("player quit")
}
}
handleSetCptNavigation();
if (first){
handleSetFirst();
setFirst(false)
socket.emit("request lobbies")
}
useEffect(() => {
socket.on("request lobbies", (map) => {
const jsonMap = JSON.parse(map)

Loading…
Cancel
Save