Skip to content

Commit

Permalink
errores de react arreglados deberia de funcionar el despliegue
Browse files Browse the repository at this point in the history
  • Loading branch information
bidof committed Apr 9, 2024
1 parent 3bfba36 commit bdca220
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 21 deletions.
4 changes: 2 additions & 2 deletions webapp/src/components/history/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function History({darkMode}){
.catch(error => {
//console.error('Error cargando el historial de todas las partidas del usuario:', error);
});
}, []);
}, [gamesEndpoint]);//<-cambiar el array de depencias error despliegue

useEffect(() => {
fetch(statisticsEndpoint)
Expand All @@ -48,7 +48,7 @@ export function History({darkMode}){
.catch(error => {
//console.error('Error cargando las estadísticas del usuario:', error);
});
}, []);
}, [statisticsEndpoint]);//<- cambiar el array de depencias error despliegue



Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/history/StatsBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function StatsBlock({ darkMode,playerStats }){

let hasHistory = true;//Por defecto lo pongo a true

if (!playerStats || !playerStats.nombreUsuario || playerStats.tiempoMedio == 0) {
if (!playerStats || !playerStats.nombreUsuario || playerStats.tiempoMedio === 0) {
hasHistory = false;
}

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/logout/Logout.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Logout = () => {

useEffect(() => {
logout();
}, []);
}, [logout]);
// Llamar a handleLogout cuando se monta el componente

return (
Expand Down
6 changes: 2 additions & 4 deletions webapp/src/components/rooms/JoinRoom.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useState,useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { Box, Input, Button, Text, Tooltip, Icon, Center, VStack, HStack } from "@chakra-ui/react";
import { InfoOutlineIcon } from '@chakra-ui/icons';
import { Box, Input, Button, Text, Center, VStack } from "@chakra-ui/react";
import { useToast } from "@chakra-ui/react";
import socket from './socket';
import { useTranslation } from 'react-i18next';
Expand All @@ -11,7 +10,6 @@ const JoinRoomForm = () => {

const [roomId, setRoomId] = useState('');
const [isLoading, setIsLoading] = useState(false);
const apiEndpoint = process.env.REACT_APP_API_URI ||'http://localhost:8000';
const username = localStorage.getItem('username');

const toast = useToast();
Expand Down Expand Up @@ -49,7 +47,7 @@ const JoinRoomForm = () => {
socket.off('roomJoined');
socket.off('roomErrorJoining');
};
}, []);
}, [navigate, toast]);

const handleJoinRoom = async () => {

Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/rooms/RankingRoom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { useLocation } from 'react-router-dom';
import { Box, Heading, Text, VStack, HStack, Badge } from "@chakra-ui/react";
import { Heading, Text, VStack, HStack, Badge } from "@chakra-ui/react";
import { ChakraProvider } from '@chakra-ui/react';

function RankingRoom({darkMode}) {
Expand Down
15 changes: 3 additions & 12 deletions webapp/src/components/rooms/Room.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import React, { useState,useEffect,useRef } from 'react';
import { useParams } from 'react-router-dom';
import { useLocation } from 'react-router-dom';
import { AlertDialog, AlertDialogBody, AlertDialogFooter, AlertDialogHeader, AlertDialogContent, AlertDialogOverlay, Button } from "@chakra-ui/react";
import { useNavigate } from 'react-router-dom';
import Swal from 'sweetalert2';
import socket from './socket';
import Game from '../game/Game';
import { useTranslation } from 'react-i18next';
Expand All @@ -16,7 +14,6 @@ function Room({ darkMode }) {
const isHost = location.state?.isHost;

const [users, setUsers] = useState({});
const [questions, setQuestions] = useState([]);
const [gameStarted, setGameStarted] = useState(false);


Expand All @@ -26,15 +23,9 @@ function Room({ darkMode }) {
const {t, i18n} = useTranslation();
const [roomGame, setRoomGame] = useState(null);


//para el mensaje del ganador
const [isOpen, setIsOpen] = useState(false);
const cancelRef = useRef();
const onClose = () =>{
setIsOpen(false);
navigate('/home');
};


useEffect(() => {

socket.on('currentUsers', (users) => {
Expand All @@ -43,7 +34,7 @@ function Room({ darkMode }) {
});
socket.emit('ready', { id: roomId });

console.log("eres el host "+isHost);
//console.log("eres el host "+isHost);


socket.on('gameStarted', (questionsServer) => {
Expand All @@ -69,7 +60,7 @@ function Room({ darkMode }) {
});


}, [roomId]);
}, [roomId,users,navigate,winner]);


//se encagr ad e que cuando las preguntas esten cargadas crees el modo de juego
Expand Down

0 comments on commit bdca220

Please sign in to comment.