From bfa61aaa6afd78740ec2f6658ac34de811a53daa Mon Sep 17 00:00:00 2001 From: erinz2020 Date: Thu, 14 Nov 2024 00:07:28 +0000 Subject: [PATCH 1/2] show/hide old report encounter page on react side based on showclassicsubmit from api, for both authenticated header and unauthenticated header --- frontend/src/AuthenticatedSwitch.jsx | 3 +- frontend/src/FrontDesk.jsx | 5 ++ frontend/src/UnAuthenticatedSwitch.jsx | 5 +- .../src/components/AuthenticatedAppHeader.jsx | 4 +- .../components/UnAuthenticatedAppHeader.jsx | 4 +- frontend/src/components/header/Menu.jsx | 4 +- frontend/src/constants/navMenu.js | 48 +++++++++++-------- 7 files changed, 44 insertions(+), 29 deletions(-) diff --git a/frontend/src/AuthenticatedSwitch.jsx b/frontend/src/AuthenticatedSwitch.jsx index 5361549ee4..63945cca6c 100644 --- a/frontend/src/AuthenticatedSwitch.jsx +++ b/frontend/src/AuthenticatedSwitch.jsx @@ -13,7 +13,7 @@ import Citation from "./pages/Citation"; import ReportEncounter from "./pages/ReportsAndManagamentPages/ReportEncounter"; import ReportConfirm from "./pages/ReportsAndManagamentPages/ReportConfirm"; -export default function AuthenticatedSwitch({ showAlert, setShowAlert }) { +export default function AuthenticatedSwitch({ showAlert, setShowAlert, showclassicsubmit }) { const { data } = useGetMe(); const username = data?.username; const avatar = @@ -37,6 +37,7 @@ export default function AuthenticatedSwitch({ showAlert, setShowAlert }) { avatar={avatar} showAlert={showAlert} setShowAlert={setShowAlert} + showclassicsubmit={showclassicsubmit} /> diff --git a/frontend/src/FrontDesk.jsx b/frontend/src/FrontDesk.jsx index 9fc042d9dc..10094e2a51 100644 --- a/frontend/src/FrontDesk.jsx +++ b/frontend/src/FrontDesk.jsx @@ -14,6 +14,7 @@ import { sessionWarningTime, sessionCountdownTime, } from "./constants/sessionWarning"; +import useGetSiteSettings from "./models/useGetSiteSettings"; export default function FrontDesk() { const [isLoggedIn, setIsLoggedIn] = useState(false); @@ -25,6 +26,8 @@ export default function FrontDesk() { Cookies.get("showAlert") === "false" ? false : true, ); const [loading, setLoading] = useState(true); + const { data } = useGetSiteSettings(); + const showclassicsubmit = data?.showClassicSubmit; const checkLoginStatus = () => { axios @@ -89,6 +92,7 @@ export default function FrontDesk() { ); @@ -105,6 +109,7 @@ export default function FrontDesk() { ); diff --git a/frontend/src/UnAuthenticatedSwitch.jsx b/frontend/src/UnAuthenticatedSwitch.jsx index 4d7c084339..5e79736207 100644 --- a/frontend/src/UnAuthenticatedSwitch.jsx +++ b/frontend/src/UnAuthenticatedSwitch.jsx @@ -9,9 +9,10 @@ import Citation from "./pages/Citation"; import ReportEncounter from "./pages/ReportsAndManagamentPages/ReportEncounter"; import ReportConfirm from "./pages/ReportsAndManagamentPages/ReportConfirm"; -export default function UnAuthenticatedSwitch({ showAlert, setShowAlert }) { +export default function UnAuthenticatedSwitch({ showAlert, setShowAlert, showclassicsubmit }) { const [header, setHeader] = React.useState(true); const location = useLocation(); + console.log("showclassicsubmit", showclassicsubmit); const redirParam = encodeURIComponent( `${location.pathname}${location.search}${location.hash}`, @@ -29,7 +30,7 @@ export default function UnAuthenticatedSwitch({ showAlert, setShowAlert }) { }} > {showAlert && } - +
- + - {unAuthenticatedMenu.map((item, idx) => ( + {unAuthenticatedMenu(showclassicsubmit).map((item, idx) => (