diff --git a/mock-relying-party-ui/src/components/AppointmentConfirmation.js b/mock-relying-party-ui/src/components/AppointmentConfirmation.js index 4aab2d9f..a05a9126 100644 --- a/mock-relying-party-ui/src/components/AppointmentConfirmation.js +++ b/mock-relying-party-ui/src/components/AppointmentConfirmation.js @@ -39,7 +39,7 @@ export default function AppointmentConfirmation({ isOpen,
- + diff --git a/mock-relying-party-ui/src/components/BookAppointment.js b/mock-relying-party-ui/src/components/BookAppointment.js index a95ec6a8..90bfc4c9 100644 --- a/mock-relying-party-ui/src/components/BookAppointment.js +++ b/mock-relying-party-ui/src/components/BookAppointment.js @@ -26,7 +26,7 @@ export default function BookAppointment({
- + diff --git a/mock-relying-party-ui/src/components/ProfileUI.js b/mock-relying-party-ui/src/components/ProfileUI.js index 4b4005d7..cbfc3f1e 100644 --- a/mock-relying-party-ui/src/components/ProfileUI.js +++ b/mock-relying-party-ui/src/components/ProfileUI.js @@ -128,18 +128,18 @@ export default function ProfileUI({ {i18n.t(formattedDate)}

- + {data["time"]}

- + {t(data["location"])}
Jese Leos image
diff --git a/mock-relying-party-ui/src/components/Sidenav.js b/mock-relying-party-ui/src/components/Sidenav.js index c320deb1..0872085f 100644 --- a/mock-relying-party-ui/src/components/Sidenav.js +++ b/mock-relying-party-ui/src/components/Sidenav.js @@ -6,686 +6,686 @@ import { LoadingStates as states } from "../constants/states"; import Select from "react-select"; import LoadingIndicator from "../common/LoadingIndicator"; export default function Sidenav({ - component, - langOptions, - relyingPartyService, - i18nKeyPrefix = "sidenav", + component, + langOptions, + relyingPartyService, + i18nKeyPrefix = "sidenav", }) { - const userInfo_keyname = "user_info"; - const post_fetchUserInfo = relyingPartyService.post_fetchUserInfo; - const get_claimProvider = relyingPartyService.get_claimProvider; - const get_messages = relyingPartyService.get_messages; - const { t, i18n } = useTranslation("translation", { - keyPrefix: i18nKeyPrefix, - }); - const [isOpen, setIsOpen] = useState(false); - const currentDate = new Date(); - const [searchParams, setSearchParams] = useSearchParams(); - const [userInfo, setUserInfo] = useState(null); - const [status, setStatus] = useState(states.LOADING); - const [claimInfo, setClaimInfo] = useState([]); - const [messagesInfo, setMessagesInfo] = useState([]); - const [address, setAddress] = useState(null); - const [emailAddress, setEmailAddress] = useState(null); - const navigate = useNavigate(); + const userInfo_keyname = "user_info"; + const post_fetchUserInfo = relyingPartyService.post_fetchUserInfo; + const get_claimProvider = relyingPartyService.get_claimProvider; + const get_messages = relyingPartyService.get_messages; + const { t, i18n } = useTranslation("translation", { + keyPrefix: i18nKeyPrefix, + }); + const [isOpen, setIsOpen] = useState(false); + const currentDate = new Date(); + const [searchParams, setSearchParams] = useSearchParams(); + const [userInfo, setUserInfo] = useState(null); + const [status, setStatus] = useState(states.LOADING); + const [claimInfo, setClaimInfo] = useState([]); + const [messagesInfo, setMessagesInfo] = useState([]); + const [address, setAddress] = useState(null); + const [emailAddress, setEmailAddress] = useState(null); + const navigate = useNavigate(); - const navigateToLogin = (errorCode, errorDescription) => { - let params = "?"; - if (errorDescription) { - params = params + "error_description=" + errorDescription + "&"; - } + const navigateToLogin = (errorCode, errorDescription) => { + let params = "?"; + if (errorDescription) { + params = params + "error_description=" + errorDescription + "&"; + } - //REQUIRED - params = params + "error=" + errorCode; - navigate(process.env.PUBLIC_URL + "/" + params, { replace: true }); - }; - const [selectedLang, setSelectedLang] = useState(); - const changeLanguageHandler = (e) => { - i18n.changeLanguage(e.value); - }; + //REQUIRED + params = params + "error=" + errorCode; + navigate(process.env.PUBLIC_URL + "/" + params, { replace: true }); + }; + const [selectedLang, setSelectedLang] = useState(); + const changeLanguageHandler = (e) => { + i18n.changeLanguage(e.value); + }; - const customStyles = { - control: (base) => ({ - ...base, - border: 0, - boxShadow: "none", - }), - }; + const customStyles = { + control: (base) => ({ + ...base, + border: 0, + boxShadow: "none", + }), + }; - useEffect(() => { - let lang = langOptions?.find((option) => { - return option.value === i18n.language; - }); - setSelectedLang(lang); - }, [langOptions]); + useEffect(() => { + let lang = langOptions?.find((option) => { + return option.value === i18n.language; + }); + setSelectedLang(lang); + }, [langOptions]); - //Gets fired when changeLanguage got called. + //Gets fired when changeLanguage got called. i18n.on('languageChanged', function (lng) { - let lang = langOptions.find((option) => { - return option.value === lng; - }); - setSelectedLang(lang); + let lang = langOptions.find((option) => { + return option.value === lng; + }); + setSelectedLang(lang); }) - useEffect(() => { - const getSearchParams = async () => { - let authCode = searchParams.get("code"); - let errorCode = searchParams.get("error"); - let error_desc = searchParams.get("error_description"); - if (errorCode) { - navigateToLogin(errorCode, error_desc); - return; - } - getClaimProvider(); - getMessages(); - getUserDetails(authCode); - }; - getSearchParams(); - }, []); - - const getUserDetails = async (authCode) => { - setUserInfo(null); - setStatus(states.LOADING); - try { - let client_id = clientDetails.clientId; - let redirect_uri = clientDetails.redirect_uri_userprofile; - let grant_type = clientDetails.grant_type; - var userInfo = await post_fetchUserInfo( - authCode, - client_id, - redirect_uri, - grant_type - ); - let address = getAddress(userInfo?.address); - setAddress(address); - setUserInfo(userInfo); - setEmailAddress(userInfo?.email_verified ?? userInfo?.email); - localStorage.setItem(userInfo_keyname, JSON.stringify(userInfo)); - setStatus(states.LOADED); - } catch (errormsg) { - //Load from local storage - if (localStorage.getItem(userInfo_keyname)) { - let userInf = JSON.parse(localStorage.getItem(userInfo_keyname)); - let address = getAddress(userInf?.address); - setAddress(address); - setEmailAddress(userInf?.email_verified ?? userInf?.email); - setUserInfo(userInf); - setStatus(states.LOADED); - } else { - navigateToLogin("session_expired", "Session Expired"); - } - } + useEffect(() => { + const getSearchParams = async () => { + let authCode = searchParams.get("code"); + let errorCode = searchParams.get("error"); + let error_desc = searchParams.get("error_description"); + if (errorCode) { + navigateToLogin(errorCode, error_desc); + return; + } + getClaimProvider(); + getMessages(); + getUserDetails(authCode); }; + getSearchParams(); + }, []); - //claimproviders details - const getClaimProvider = () => { - setClaimInfo(null); - var claimInfo = get_claimProvider(); - setClaimInfo(claimInfo); - }; + const getUserDetails = async (authCode) => { + setUserInfo(null); + setStatus(states.LOADING); + try { + let client_id = clientDetails.clientId; + let redirect_uri = clientDetails.redirect_uri_userprofile; + let grant_type = clientDetails.grant_type; + var userInfo = await post_fetchUserInfo( + authCode, + client_id, + redirect_uri, + grant_type + ); + let address = getAddress(userInfo?.address); + setAddress(address); + setUserInfo(userInfo); + setEmailAddress(userInfo?.email_verified ?? userInfo?.email); + localStorage.setItem(userInfo_keyname, JSON.stringify(userInfo)); + setStatus(states.LOADED); + } catch (errormsg) { + //Load from local storage + if (localStorage.getItem(userInfo_keyname)) { + let userInf = JSON.parse(localStorage.getItem(userInfo_keyname)); + let address = getAddress(userInf?.address); + setAddress(address); + setEmailAddress(userInf?.email_verified ?? userInf?.email); + setUserInfo(userInf); + setStatus(states.LOADED); + } else { + navigateToLogin("session_expired", "Session Expired"); + } + } + }; - //Getting message information from json - const getMessages = () => { - setMessagesInfo(null); - var messagesInfo = get_messages(); - setMessagesInfo(messagesInfo); - }; + //claimproviders details + const getClaimProvider = () => { + setClaimInfo(null); + var claimInfo = get_claimProvider(); + setClaimInfo(claimInfo); + }; + + //Getting message information from json + const getMessages = () => { + setMessagesInfo(null); + var messagesInfo = get_messages(); + setMessagesInfo(messagesInfo); + }; const messagesCount = messagesInfo.messages?.length - const getAddress = (userAddress) => { - let address = ""; + const getAddress = (userAddress) => { + let address = ""; - if (userAddress?.formatted) { - address += userAddress?.formatted + ", "; - } + if (userAddress?.formatted) { + address += userAddress?.formatted + ", "; + } - if (userAddress?.street_address) { - address += userAddress?.street_address + ", "; - } + if (userAddress?.street_address) { + address += userAddress?.street_address + ", "; + } - if (userAddress?.addressLine1) { - address += userAddress?.addressLine1 + ", "; - } + if (userAddress?.addressLine1) { + address += userAddress?.addressLine1 + ", "; + } - if (userAddress?.addressLine2) { - address += userAddress?.addressLine2 + ", "; - } + if (userAddress?.addressLine2) { + address += userAddress?.addressLine2 + ", "; + } - if (userAddress?.addressLine3) { - address += userAddress?.addressLine3 + ", "; - } + if (userAddress?.addressLine3) { + address += userAddress?.addressLine3 + ", "; + } - if (userAddress?.locality) { - address += userAddress?.locality + ", "; - } + if (userAddress?.locality) { + address += userAddress?.locality + ", "; + } - if (userAddress?.city) { - address += userAddress?.city + ", "; - } + if (userAddress?.city) { + address += userAddress?.city + ", "; + } - if (userAddress?.province) { - address += userAddress?.province + ", "; - } + if (userAddress?.province) { + address += userAddress?.province + ", "; + } - if (userAddress?.region) { - address += userAddress?.region + ", "; - } + if (userAddress?.region) { + address += userAddress?.region + ", "; + } - if (userAddress?.postalCode) { - address += "(" + userAddress?.postalCode + "), "; - } + if (userAddress?.postalCode) { + address += "(" + userAddress?.postalCode + "), "; + } - if (userAddress?.country) { - address += userAddress?.country + ", "; - } + if (userAddress?.country) { + address += userAddress?.country + ", "; + } - //returning after removing last ", " characters - return address.substring(0, address.length - 2); - }; + //returning after removing last ", " characters + return address.substring(0, address.length - 2); + }; - let el = ( - <> -