diff --git a/src/main/webapp/CSS/navbar.css b/src/main/webapp/CSS/navbar.css new file mode 100644 index 0000000..d947bb2 --- /dev/null +++ b/src/main/webapp/CSS/navbar.css @@ -0,0 +1,23 @@ +*{ + margin: 0; + padding: 0; +} + +body{ + width: 100%; +} + +#navbarDiv{ + width: 100%; + height: 100%; + display: flex; + flex-direction: row; + justify-content: center; +} + +.divButtons{ + display: flex; + justify-content: center; + width: 25%; + height: 10%; +} \ No newline at end of file diff --git a/src/main/webapp/JS/navbar.js b/src/main/webapp/JS/navbar.js new file mode 100644 index 0000000..1c32a6c --- /dev/null +++ b/src/main/webapp/JS/navbar.js @@ -0,0 +1,56 @@ +const homeIcon = $("#homeIcon") +const homeIconS = $("#homeIconSelected") +const messageIcon = $("#messageIcon") +const messageIconS = $("#messageIconSelected") +const calendarIcon = $("#calendarIcon") +const calendarIconS = $("#calendarIconSelected") +const profileIcon = $("#profileIcon") +const profileIconS = $("#profileIconSelected") + +const page = window.location.pathname.split('/').pop() +const homePages = [] //TODO: Mettere le pagine da considerare "Home" +const messagePages = [] //TODO: Mettere le pagine da considerare "Message" +const calendarPages = [] //TODO: Mettere le pagine da considerare "Calendar" +const profilePages = [] //TODO: Mettere le pagine da considerare "Profile" + +$("document").ready(()=>{ + hideSelectedIcons(); + showRightIcons(); + manageOnClick(); +}) + +function hideSelectedIcons(){ + homeIconS.hide() + messageIconS.hide() + calendarIconS.hide() + profileIconS.hide() +} + +function showRightIcons(){ + if (homePages.includes(page)){ + homeIcon.hide(); + homeIconS.show(); + }else if (messagePages.includes(page)){ + messageIcon.hide(); + messageIconS.show(); + }else if (calendarPages.includes(page)){ + calendarIcon.hide(); + calendarIconS.show(); + }else if (profilePages.includes(page)){ + profileIcon.hide(); + profileIconS.show(); + }else{ + $("#navbarDiv").hide(); + } +} + +function manageOnClick(){ + $("#home").click(() => redirect("home.jsp")); //TODO: METTERE I GIUSTI REDIRECT + $("#message").click(() => redirect("message.jsp")); //TODO: METTERE I GIUSTI REDIRECT + $("#calendar").click(() => redirect("calendar.jsp")); //TODO: METTERE I GIUSTI REDIRECT + $("#profile").click(() => redirect("profile.jsp")); //TODO: METTERE I GIUSTI REDIRECT +} + +function redirect(where){ + window.location.href = where +} \ No newline at end of file diff --git a/src/main/webapp/JSP/navbar.jsp b/src/main/webapp/JSP/navbar.jsp new file mode 100644 index 0000000..997958e --- /dev/null +++ b/src/main/webapp/JSP/navbar.jsp @@ -0,0 +1,28 @@ + +
+