Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI improvement #75

Merged
merged 6 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions webapp/src/components/Footer/Footer.css

This file was deleted.

19 changes: 0 additions & 19 deletions webapp/src/components/Login/Login.css

This file was deleted.

33 changes: 18 additions & 15 deletions webapp/src/components/Login/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,31 @@ const Login = () => {
const apiEndpoint =
process.env.REACT_APP_API_ENDPOINT || "http://localhost:8000";

const loginUser = async () => {
try {
const response = await axios.post(`${apiEndpoint}/login`, {
const loginUser = () => {
axios
.post(`${apiEndpoint}/login`, {
username,
password,
});
const token = response.data;
})
.then((response) => {
const token = response.data;

setLoginSuccess(true);
setOpenSnackbar(true);
localStorage.setItem("token", token);
localStorage.setItem("username", username);
navigate("/home");
} catch (err) {
setError(err.message);
}
setLoginSuccess(true);
setOpenSnackbar(true);
localStorage.setItem("token", token);
localStorage.setItem("username", username);
navigate("/home");
})
.catch((err) => {
console.log(err);
setError(err.response.data.error);
});
};

return (
<>
<Flex alignItems="center" justifyContent="space-between" mt={4}>
<Spacer flex={0}/>
<Flex alignItems="center" justifyContent="space-between" mt={4} w="100%">
<Box pr={5}></Box>
<Heading pl={6} as="h1" size="xl" color="teal.500">
WIQ
</Heading>
Expand Down
42 changes: 0 additions & 42 deletions webapp/src/components/Nav/Nav.css

This file was deleted.

26 changes: 13 additions & 13 deletions webapp/src/components/Nav/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,37 @@ const Nav = () => {

return (
<Box as="nav" display="flex" alignItems="center" justifyContent="space-between" p={4} bg={bgColor} width="100%">
<Box textAlign="center" ml={3}>
<Heading as="h1" size="xl" color={textColor}>WIQ</Heading>
<Box textAlign="center" ml={3} width="25%" justifyContent="start">
<Heading as="h1" size="xl" color={textColor} textAlign="start">WIQ</Heading>
</Box>
<Flex gap={3}>
<Button variant="link" color={textColor} mr={4} onClick={() => handleNavigate("/home")}>Home</Button>
<Button variant="link" color={textColor} mr={4} p={2} _hover={{ backgroundColor: 'gray.400', color: 'white' }} onClick={() => handleNavigate("/home")}>Home</Button>
<Popover>
<PopoverTrigger>
<Button variant="link" color={textColor}>
<Button p={2} _hover={{ backgroundColor: 'gray.400', color: 'white' }} variant="link" color={textColor}>
Modos de Juego
</Button>
</PopoverTrigger>
<PopoverContent>
<PopoverArrow />
<PopoverCloseButton />
<PopoverHeader>Modos de Juego</PopoverHeader>
<PopoverHeader >Modos de Juego</PopoverHeader>
<PopoverBody>
<Text cursor="pointer" onClick={() => handleNavigate("/home/clasico")} color={textColor}>Clásico</Text>
<Text cursor="pointer" onClick={() => handleNavigate("/home/bateria")} color={textColor}>Batería de sabios</Text>
{/* Agrega más modos de juego aquí */}
</PopoverBody>
</PopoverContent>
</Popover>
<Button variant="link" color={textColor} mr={4} onClick={() => handleNavigate("/stats")}>Estadísticas</Button>
<Button variant="link" color={textColor} mr={4} onClick={() => handleNavigate("/ranking")}>Ranking</Button>
<Button variant="link" color={textColor} mr={4} onClick={() => handleNavigate("/perfil")}>Perfil</Button>
<Button variant="link" color={textColor} mr={4} p={2} _hover={{ backgroundColor: 'gray.400', color: 'white' }} onClick={() => handleNavigate("/stats")}>Estadísticas</Button>
<Button variant="link" color={textColor} mr={4} p={2} _hover={{ backgroundColor: 'gray.400', color: 'white' }} onClick={() => handleNavigate("/ranking")}>Ranking</Button>
<Button variant="link" color={textColor} mr={4} p={2} _hover={{ backgroundColor: 'gray.400', color: 'white' }} onClick={() => handleNavigate("/perfil")}>Perfil</Button>
</Flex>
<Flex className="rightItems" alignItems="center">
<Button variant="link" color={textColor} mr={4} onClick={() => handleNavigate("/sobre")}>Sobre nosotros</Button>
<Button variant="link" color={textColor} mr={4} onClick={() => handleConfig()}>Opciones</Button>
<Button variant="link" color={textColor} onClick={() => logout()}>Desconectarse</Button>
<Switch isChecked={isDarkTheme} onChange={toggleColorMode} ml={4} />
<Flex width="25%" className="rightItems" justifyContent="end">
<Button variant="link" color={textColor} mr={4} p={2} _hover={{ backgroundColor: 'gray.400', color: 'white' }} onClick={() => handleNavigate("/sobre")}>Sobre nosotros</Button>
<Button variant="link" color={textColor} mr={4} p={2} _hover={{ backgroundColor: 'gray.400', color: 'white' }} onClick={() => handleConfig()}>Opciones</Button>
<Button variant="link" color={textColor} p={2} _hover={{ backgroundColor: 'gray.400', color: 'white' }} onClick={() => logout()}>Desconectarse</Button>
<Switch isChecked={isDarkTheme} onChange={toggleColorMode} ml={4} alignSelf="center"/>
</Flex>
</Box>
);
Expand Down
15 changes: 0 additions & 15 deletions webapp/src/components/Register/Register.css

This file was deleted.

8 changes: 5 additions & 3 deletions webapp/src/components/Register/Register.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ const AddUser = () => {
axios
.post(`${apiEndpoint}/adduser`, { username, password })
.then(() => setOpenSnackbar(true))
.catch((error) => setError(error.message));
.catch((err) => setError(err.response.data.error));
};

return (
<>
<Flex alignItems="center" justifyContent="space-between" mt={4}>
<Spacer flex={0}/>
<Flex alignItems="center" justifyContent="space-between" mt={4} w="100%">
<Box pr={5}>

</Box>
<Heading pl={6} as="h1" size="xl" color="teal.500">
WIQ
</Heading>
Expand Down
85 changes: 0 additions & 85 deletions webapp/src/pages/Bateria/Bateria.css

This file was deleted.

Loading
Loading