diff --git a/mock-relying-party-ui/public/images/menu_icon.png b/mock-relying-party-ui/public/images/menu_icon.png new file mode 100644 index 00000000..dcb737e3 Binary files /dev/null and b/mock-relying-party-ui/public/images/menu_icon.png differ diff --git a/mock-relying-party-ui/public/images/signout_icon.png b/mock-relying-party-ui/public/images/signout_icon.png new file mode 100644 index 00000000..a4cd06b1 Binary files /dev/null and b/mock-relying-party-ui/public/images/signout_icon.png differ diff --git a/mock-relying-party-ui/src/components/ProfileUI.js b/mock-relying-party-ui/src/components/ProfileUI.js index cbfc3f1e..d0f243d9 100644 --- a/mock-relying-party-ui/src/components/ProfileUI.js +++ b/mock-relying-party-ui/src/components/ProfileUI.js @@ -42,132 +42,130 @@ export default function ProfileUI({ let el = ( <> -
-
-
-
-

{t("current_medication")} ({medicationCount})

+
+
+
+

{t("current_medication")} ({medicationCount})

-
-
-
+
-
-

{t("next_appointment")}

-
-
-
    - {appointmentInfo?.appointment?.map((data, index) => ( -
  • -
    -
    -

    - {i18n.t(formattedDate)} -

    -

    - - {data["time"]} -

    -
    - - {t(data["location"])} -
    -
    -
    - Jese Leos image -
    -

    - {t(data["doctorName"])} -

    -

    - {t(data["department"])} -

    -
    +
    +

    {t("next_appointment")}

    +
    +
    +
      + {appointmentInfo?.appointment?.map((data, index) => ( +
    • +
      +
      +

      + {i18n.t(formattedDate)} +

      +

      + + {data["time"]} +

      +
      + + {t(data["location"])} +
      +
      +
      + Jese Leos image +
      +

      + {t(data["doctorName"])} +

      +

      + {t(data["department"])} +

      -
    • - ))} -
    • -
    • -
    -
    + ))} +
  • + +
  • +
diff --git a/mock-relying-party-ui/src/components/Sidenav.js b/mock-relying-party-ui/src/components/Sidenav.js index 0872085f..ef807f70 100644 --- a/mock-relying-party-ui/src/components/Sidenav.js +++ b/mock-relying-party-ui/src/components/Sidenav.js @@ -27,6 +27,7 @@ export default function Sidenav({ const [messagesInfo, setMessagesInfo] = useState([]); const [address, setAddress] = useState(null); const [emailAddress, setEmailAddress] = useState(null); + const [showMenu, setShowMenu] = useState(false); const navigate = useNavigate(); const navigateToLogin = (errorCode, errorDescription) => { @@ -60,12 +61,12 @@ export default function Sidenav({ }, [langOptions]); //Gets fired when changeLanguage got called. - i18n.on('languageChanged', function (lng) { + i18n.on('languageChanged', function (lng) { let lang = langOptions.find((option) => { return option.value === lng; }); setSelectedLang(lang); - }) + }) useEffect(() => { const getSearchParams = async () => { @@ -80,7 +81,17 @@ export default function Sidenav({ getMessages(); getUserDetails(authCode); }; + // hiding or showing the side nav + // according to windows height + const handleResize = () => { + const { innerWidth: width } = window; + setShowMenu(width > 767); + }; + // adding event listener for window resize + window.addEventListener("resize", handleResize); getSearchParams(); + // removing event listener for window resize + return () => window.removeEventListener("resize", handleResize); }, []); const getUserDetails = async (authCode) => { @@ -130,7 +141,7 @@ export default function Sidenav({ var messagesInfo = get_messages(); setMessagesInfo(messagesInfo); }; - const messagesCount = messagesInfo.messages?.length + const messagesCount = messagesInfo.messages?.length const getAddress = (userAddress) => { let address = ""; @@ -183,21 +194,165 @@ export default function Sidenav({ return address.substring(0, address.length - 2); }; + // new message component + const newMessageComponent = () => { + return <> +

+ {t("new_messages")} ({messagesCount}) +

+ {messagesInfo?.messages?.map((message, index) => { + const pastDate = new Date( + currentDate.getTime() - message["days"] * 24 * 60 * 60 * 1000 + ); + const formattedDate = new Intl.DateTimeFormat(i18n.language, { dateStyle: 'full' }).format(pastDate); + return ( +
+
+ Jese Leos image + +
+

+ {t(message["doctorName"])} +

+

+ {i18n.t(formattedDate)} +

+ +

+ {t("hi")} {userInfo?.name} , {t(message["message"])} +

+
+ +
+
+ ); + })} + ; + }; + + // vaccination history component + const vaccinationHistoryComponent = () => { + return <> +
+
+

{t("vaccinations")}

+
+ +
+
+ + + + + + + + + + + {claimInfo?.claimproviders?.map((item, idx) => { + const pastDate = new Date( + currentDate.getTime() - + item["days"] * 24 * 60 * 60 * 1000 + ); + return ( + + + + + + + ); + })} + +
+

{t("vaccination_details")}

+
+ {t("date")} + + {t("vaccination_center")} + + {t("total_cost")} +
+

{t(item["vaccinationName"])}

+
+

{pastDate.toLocaleDateString()}

+
+

{t(item["vaccinationCenter"])}

+
+

{item["totalCost"]}

+
+
+ + }; + let el = ( <> -
- {t("language")} - +
{status === states.LOADING && (
@@ -461,8 +654,8 @@ export default function Sidenav({ {status === states.LOADED && ( <> -
-
+
+
{t("welcome")}, {userInfo?.name} @@ -472,7 +665,7 @@ export default function Sidenav({

-
+
-

+

{userInfo?.name}

@@ -513,7 +706,7 @@ export default function Sidenav({ {isOpen && (
- + {t("email")}:  {emailAddress?.split("@")[0]} @@ -553,132 +746,16 @@ export default function Sidenav({
-
- {component} -
-
-
-

{t("vaccinations")}

-
-
+
+ {component}
-
- - - - - - - - - - - - {claimInfo?.claimproviders?.map((item, idx) => { - const pastDate = new Date( - currentDate.getTime() - - item["days"] * 24 * 60 * 60 * 1000 - ); - return ( - - - - - - - ); - })} - -
-

{t("vaccination_details")}

-
- {t("date")} - - {t("vaccination_center")} - - {t("total_cost")} -
-

{t(item["vaccinationName"])}

-
-

{pastDate.toLocaleDateString()}

-
-

{t(item["vaccinationCenter"])}

-
-

{item["totalCost"]}

-
+
+ {newMessageComponent()}
+ {vaccinationHistoryComponent()}
-
-

- {t("new_messages")} ({messagesCount}) -

- {messagesInfo?.messages?.map((message, index) => { - const pastDate = new Date( - currentDate.getTime() - message["days"] * 24 * 60 * 60 * 1000 - ); - const formattedDate = new Intl.DateTimeFormat(i18n.language, { dateStyle: 'full' }).format(pastDate); - return ( -
-
- Jese Leos image - -
-

- {t(message["doctorName"])} -

-

- {i18n.t(formattedDate)} -

- -

- {t("hi")} {userInfo?.name} , {t(message["message"])} -

-
- -
-
- ); - })} +
+ {newMessageComponent()}