From c4c76a55e62f454400b3465371aa7c7783483363 Mon Sep 17 00:00:00 2001 From: "ms@Nicro" Date: Thu, 28 Dec 2023 13:40:24 +0100 Subject: [PATCH] Created the navbar TODO: waiting for all pages to be completed for optimal redirect and selected icons --- src/main/webapp/CSS/navbar.css | 23 +++++++++ src/main/webapp/JS/navbar.js | 56 +++++++++++++++++++++ src/main/webapp/JSP/navbar.jsp | 28 +++++++++++ src/main/webapp/images/calendar.svg | 1 + src/main/webapp/images/calendarSelected.svg | 1 + src/main/webapp/images/home.svg | 1 + src/main/webapp/images/homeSelected.svg | 1 + src/main/webapp/images/message.svg | 1 + src/main/webapp/images/messageSelected.svg | 1 + src/main/webapp/images/profile.svg | 1 + src/main/webapp/images/profileSelected.svg | 1 + 11 files changed, 115 insertions(+) create mode 100644 src/main/webapp/CSS/navbar.css create mode 100644 src/main/webapp/JS/navbar.js create mode 100644 src/main/webapp/JSP/navbar.jsp create mode 100644 src/main/webapp/images/calendar.svg create mode 100644 src/main/webapp/images/calendarSelected.svg create mode 100644 src/main/webapp/images/home.svg create mode 100644 src/main/webapp/images/homeSelected.svg create mode 100644 src/main/webapp/images/message.svg create mode 100644 src/main/webapp/images/messageSelected.svg create mode 100644 src/main/webapp/images/profile.svg create mode 100644 src/main/webapp/images/profileSelected.svg 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 @@ + + + navbar + + + + + + + + diff --git a/src/main/webapp/images/calendar.svg b/src/main/webapp/images/calendar.svg new file mode 100644 index 0000000..55669ea --- /dev/null +++ b/src/main/webapp/images/calendar.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/images/calendarSelected.svg b/src/main/webapp/images/calendarSelected.svg new file mode 100644 index 0000000..0183db5 --- /dev/null +++ b/src/main/webapp/images/calendarSelected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/images/home.svg b/src/main/webapp/images/home.svg new file mode 100644 index 0000000..066f14d --- /dev/null +++ b/src/main/webapp/images/home.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/images/homeSelected.svg b/src/main/webapp/images/homeSelected.svg new file mode 100644 index 0000000..9bbf605 --- /dev/null +++ b/src/main/webapp/images/homeSelected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/images/message.svg b/src/main/webapp/images/message.svg new file mode 100644 index 0000000..129e1cd --- /dev/null +++ b/src/main/webapp/images/message.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/images/messageSelected.svg b/src/main/webapp/images/messageSelected.svg new file mode 100644 index 0000000..f2142c2 --- /dev/null +++ b/src/main/webapp/images/messageSelected.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/images/profile.svg b/src/main/webapp/images/profile.svg new file mode 100644 index 0000000..f0220ee --- /dev/null +++ b/src/main/webapp/images/profile.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/main/webapp/images/profileSelected.svg b/src/main/webapp/images/profileSelected.svg new file mode 100644 index 0000000..6c9ab13 --- /dev/null +++ b/src/main/webapp/images/profileSelected.svg @@ -0,0 +1 @@ + \ No newline at end of file