Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #40 from Arquisoft/UserInterfacePaths#12
Browse files Browse the repository at this point in the history
LGTM!
  • Loading branch information
Manueluz authored Feb 1, 2024
2 parents a43d8e8 + 9c87f60 commit f48bb71
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 71 deletions.
43 changes: 42 additions & 1 deletion webapp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion webapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"axios": "^1.6.5",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.21.3",
"react-scripts": "5.0.1",
"tailwindcss": "^3.4.1",
"web-vitals": "^3.5.1"
},
"scripts": {
Expand Down Expand Up @@ -51,6 +53,7 @@
"mongodb-memory-server": "^9.1.4",
"puppeteer": "^21.7.0",
"serve": "^14.2.1",
"start-server-and-test": "^2.0.3"
"start-server-and-test": "^2.0.3",
"tailwindcss": "^3.4.1"
}
}
10 changes: 2 additions & 8 deletions webapp/public/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" class="dark">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
Expand All @@ -9,12 +9,6 @@
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Expand All @@ -24,7 +18,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
<title>WIQ</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
Binary file removed webapp/public/logo192.png
Binary file not shown.
Binary file removed webapp/public/logo512.png
Binary file not shown.
25 changes: 0 additions & 25 deletions webapp/public/manifest.json

This file was deleted.

55 changes: 25 additions & 30 deletions webapp/src/App.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
import React, { useState } from 'react';
import AddUser from './components/AddUser';
import Login from './components/Login';
import CssBaseline from '@mui/material/CssBaseline';
import Container from '@mui/material/Container';
import Typography from '@mui/material/Typography';
import Link from '@mui/material/Link';
import React from 'react';

function App() {
const [showLogin, setShowLogin] = useState(true);
import router from './routers/AppRouter';
import { RouterProvider } from 'react-router-dom';

const handleToggleView = () => {
setShowLogin(!showLogin);
};

function App() {
return (
<Container component="main" maxWidth="xs">
<CssBaseline />
<Typography component="h1" variant="h5" align="center" sx={{ marginTop: 2 }}>
Welcome to wiq_es1c
</Typography>
{showLogin ? <Login /> : <AddUser />}
<Typography component="div" align="center" sx={{ marginTop: 2 }}>
{showLogin ? (
<Link name="gotoregister" component="button" variant="body2" onClick={handleToggleView}>
Don't have an account? Register here.
</Link>
) : (
<Link component="button" variant="body2" onClick={handleToggleView}>
Already have an account? Login here.
</Link>
)}
</Typography>
</Container>
<RouterProvider router={ router } />
/*<Container className='min-h-screen'>
<Container className='bg-white p-5' component="main" maxWidth="xs">
<CssBaseline />
<Typography component="h1" variant="h5" align="center" sx={{ marginTop: 2 }}>
Welcome to wiq_es1c
</Typography>
{showLogin ? <Login /> : <AddUser />}
<Typography component="div" align="center" sx={{ marginTop: 2 }}>
{showLogin ? (
<Link name="gotoregister" component="button" variant="body2" onClick={handleToggleView}>
Don't have an account? Register here.
</Link>
) : (
<Link component="button" variant="body2" onClick={handleToggleView}>
Already have an account? Login here.
</Link>
)}
</Typography>
</Container>
</Container>*/
);
}

Expand Down
4 changes: 2 additions & 2 deletions webapp/src/App.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react';
import App from './App';

test('renders learn react link', () => {
render(<App />);
/*render(<App />);
const linkElement = screen.getByText(/Welcome to wiq_es1c/i);
expect(linkElement).toBeInTheDocument();
expect(linkElement).toBeInTheDocument();*/
});
13 changes: 13 additions & 0 deletions webapp/src/components/error/Error404.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import image from './error404.svg';

const Error404 = () =>
{
return (
<div className='min-w-full min-h-screen flex justify-center flex-col items-center'>
<img src={ image } alt={ image } className="sm:w-1/2 w-2/3" />
<h1 className='text-white text-5xl text-center'>Página no encontrada</h1>
</div>
);
}

export default Error404;
1 change: 1 addition & 0 deletions webapp/src/components/error/error404.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Login = () => {
};

return (
<Container component="main" maxWidth="xs" sx={{ marginTop: 4 }}>
<Container className='text-white' component="main" maxWidth="xs" sx={{ marginTop: 0 }}>
{loginSuccess ? (
<div>
<Typography component="h1" variant="h5" sx={{ textAlign: 'center' }}>
Expand Down
4 changes: 4 additions & 0 deletions webapp/src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
Expand Down
10 changes: 7 additions & 3 deletions webapp/src/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

import App from './App';
import './index.css';


const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<App />
<div className='bg-white dark:bg-dark-mode min-h-screen'>
<App />
</div>
</React.StrictMode>
);

Expand Down
23 changes: 23 additions & 0 deletions webapp/src/routers/AppRouter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { createBrowserRouter } from "react-router-dom";

import Login from "../components/login/Login";
import AddUser from "../components/register/AddUser";
import Error404 from "../components/error/Error404";

const router = createBrowserRouter([
{
path: "/",
element: <h1 className="text-white text-5xl text-center">Pantalla del juego</h1>,
errorElement: <Error404 />
},
{
path: "/login",
element: <Login />
},
{
path: "/register",
element: <AddUser />
}
]);

export default router;
16 changes: 16 additions & 0 deletions webapp/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
darkMode: 'class',
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {
backgroundColor: {
'dark-mode': '#171717'
},
},
},
plugins: [],
}

0 comments on commit f48bb71

Please sign in to comment.