From 1b6ef8211d4c7a0b80c4ed360ac61e3b9e791ac9 Mon Sep 17 00:00:00 2001 From: Liliana Date: Mon, 18 Mar 2024 19:12:09 +0100 Subject: [PATCH 01/78] footer added --- webapp/src/components/footer/Footer.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 webapp/src/components/footer/Footer.js diff --git a/webapp/src/components/footer/Footer.js b/webapp/src/components/footer/Footer.js new file mode 100644 index 00000000..3f6cc9a0 --- /dev/null +++ b/webapp/src/components/footer/Footer.js @@ -0,0 +1,14 @@ +import * as React from 'react'; +import { AppBar, Toolbar, Typography } from '@mui/material'; + +export const Footer = () => { + return ( + + + + © WIQ ES06C + + + + ); +}; \ No newline at end of file From c94c0ec688a0e97b00c065b5ce5f19926855cdfd Mon Sep 17 00:00:00 2001 From: Liliana Date: Tue, 19 Mar 2024 16:29:02 +0100 Subject: [PATCH 02/78] Nav bar --- webapp/src/components/nav/Nav.js | 58 +++++++++++++++++++++++++++ webapp/src/components/nav/Nav.test.js | 0 2 files changed, 58 insertions(+) create mode 100644 webapp/src/components/nav/Nav.js create mode 100644 webapp/src/components/nav/Nav.test.js diff --git a/webapp/src/components/nav/Nav.js b/webapp/src/components/nav/Nav.js new file mode 100644 index 00000000..3d1442ea --- /dev/null +++ b/webapp/src/components/nav/Nav.js @@ -0,0 +1,58 @@ +import React from 'react'; +import { useContext } from 'react'; +import { AppBar, Toolbar, Box, Button, IconButton, Typography } from '@mui/material'; +import { Link } from 'react-router-dom'; +import { context } from '../Context'; + + +export const Nav = () => { + + const navigate = useNavigate(); + const { username, isLogged, destroySession } = useContext(context); + + + const handleOpenUser = () => { + navigate(" ... "); + }; + + const handleLogout = () => { + destroySession(); + navigate("/login"); + }; + + + return ( + + + + + + + + + + WIQ + + + {isLogged ? ( + + + + + + + + ) : ( + + + + )} + + + ); + +} \ No newline at end of file diff --git a/webapp/src/components/nav/Nav.test.js b/webapp/src/components/nav/Nav.test.js new file mode 100644 index 00000000..e69de29b From c91901e7e8fca2c9dad269462b52bfc82645d5aa Mon Sep 17 00:00:00 2001 From: Liliana Date: Tue, 19 Mar 2024 16:55:05 +0100 Subject: [PATCH 03/78] first version of tests (problems with nav import) --- webapp/src/components/nav/Nav.test.js | 82 +++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/webapp/src/components/nav/Nav.test.js b/webapp/src/components/nav/Nav.test.js index e69de29b..850669d4 100644 --- a/webapp/src/components/nav/Nav.test.js +++ b/webapp/src/components/nav/Nav.test.js @@ -0,0 +1,82 @@ +import React from 'react'; +import { mount } from 'enzyme'; +import { act } from 'react-dom/test-utils'; +import { MemoryRouter } from 'react-router-dom'; +import MockAdapter from 'axios-mock-adapter'; +import { Nav } from './Nav'; +import axios from 'axios'; + +const mockAxios = new MockAdapter(axios); + +describe('Nav Component', () => { + + beforeEach(() => { + mockAxios.reset(); + }); + + it('renders without crashing', () => { + const wrapper = mount( + +