From b2477cdf4175c63ac44cfb5b0cd3fcfa6edc0b1a Mon Sep 17 00:00:00 2001 From: RubenFern Date: Thu, 18 Apr 2024 17:08:14 +0200 Subject: [PATCH 1/2] icons with authenticated path access do not appear on login and register screens --- webapp/src/components/nav/Nav.js | 89 +++++++++++++++++++------------- 1 file changed, 53 insertions(+), 36 deletions(-) diff --git a/webapp/src/components/nav/Nav.js b/webapp/src/components/nav/Nav.js index 4a76c162..239db05f 100644 --- a/webapp/src/components/nav/Nav.js +++ b/webapp/src/components/nav/Nav.js @@ -149,6 +149,8 @@ export const Nav = () => { navigate("/settings"); }; + const hasToken = localStorage.getItem('token') !== null; + return ( @@ -217,44 +219,59 @@ export const Nav = () => { {/** Settings Icon */} - - - + { + hasToken && ( + + + + ) + } {/* Botón de cuenta */} - - - - - - - Perfil - Historial - Amigos - - - - - - + { + hasToken && ( + <> + + + + + + + Perfil + Historial + Amigos + + + + ) + } + + { /* Logout */ } + { + hasToken && ( + + + + ) + } From 2223948b5113f9faa901441741bfd2be63d9eb66 Mon Sep 17 00:00:00 2001 From: RubenFern Date: Thu, 18 Apr 2024 17:24:45 +0200 Subject: [PATCH 2/2] fixed transaltions --- webapp/src/components/nav/Nav.js | 13 ++++++++----- webapp/src/i18n.js | 10 ++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/webapp/src/components/nav/Nav.js b/webapp/src/components/nav/Nav.js index 239db05f..18cb4397 100644 --- a/webapp/src/components/nav/Nav.js +++ b/webapp/src/components/nav/Nav.js @@ -19,6 +19,9 @@ import AccountCircle from "@mui/icons-material/AccountCircle"; import NightlightIcon from "@mui/icons-material/Nightlight"; import TranslateIcon from "@mui/icons-material/Translate"; import SettingsIcon from "@mui/icons-material/Settings"; +import AccountCircleIcon from '@mui/icons-material/AccountCircle'; +import HistoryIcon from '@mui/icons-material/History'; +import GroupsIcon from '@mui/icons-material/Groups'; import i18n from "../../i18n"; @@ -207,14 +210,14 @@ export const Nav = () => { onClick={spanish} > - Español + { t('Nav.spanish') } - Inglés + { t('Nav.english') } @@ -250,9 +253,9 @@ export const Nav = () => { anchorEl={userAnchor} > - Perfil - Historial - Amigos + { t('Nav.profile') } + { t('Nav.history') } + { t('Nav.friends') } diff --git a/webapp/src/i18n.js b/webapp/src/i18n.js index e5d8f125..692cebeb 100644 --- a/webapp/src/i18n.js +++ b/webapp/src/i18n.js @@ -31,6 +31,11 @@ i18n alertText: 'Your game will end.', alertConfirm: 'Yes, go out', alertCancel: 'No, continue playing', + profile: 'Profile', + history: 'History', + friends: 'Friends', + spanish: 'Spanish', + english: 'English' }, Home: { home: 'Home', @@ -107,6 +112,11 @@ i18n alertText: 'Terminará tu partida.', alertConfirm: 'Sí, salir', alertCancel: 'No, continuar jugando', + profile: 'Perfil', + history: 'Historial', + friends: 'Amigos', + spanish: 'Español', + english: 'Inglés' }, Home: { home: 'Inicio',