From 9b79a850a99813545a1a11e10a08866e0dc127cc Mon Sep 17 00:00:00 2001 From: Przemek Date: Fri, 22 Nov 2024 13:53:42 +0100 Subject: [PATCH] fixed consultation picker --- src/components/Profile/ProfileAside/index.tsx | 16 +++++++++++----- src/components/_App/Navbar/index.tsx | 19 ++++++++++++++----- src/components/_App/Warning/index.tsx | 4 +++- src/pages/register/index.tsx | 5 +++-- src/utils/meta.ts | 6 +++++- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/components/Profile/ProfileAside/index.tsx b/src/components/Profile/ProfileAside/index.tsx index 6c9e54969..22f11505d 100644 --- a/src/components/Profile/ProfileAside/index.tsx +++ b/src/components/Profile/ProfileAside/index.tsx @@ -12,6 +12,7 @@ import routeRoutes from "@/components/Routes/routes"; import DeleteAccountModal from "@/components/Authentication/DeleteAccountModal"; import useDeleteAccountModal from "@/hooks/useDeleteAccount"; +import { metaDataKeys } from "@/utils/meta"; export type NavigationTab = { title: string; @@ -129,11 +130,16 @@ const ProfileAside: React.FC = ({ tabs, isProfile = true }) => { ))} - {isProfile && settings?.value?.config?.termsPage && ( - - {t("Terms")} - - )} + {isProfile && + settings?.value?.config?.[metaDataKeys.termsPageMetaKey] && ( + + {t("Terms")} + + )} diff --git a/src/components/_App/Navbar/index.tsx b/src/components/_App/Navbar/index.tsx index 61b145393..774649c1b 100644 --- a/src/components/_App/Navbar/index.tsx +++ b/src/components/_App/Navbar/index.tsx @@ -26,6 +26,7 @@ import { ResponsiveImage } from "@escolalms/components/lib/components/organisms/ import useDeleteAccountModal from "@/hooks/useDeleteAccount"; import DeleteAccountModal from "@/components/Authentication/DeleteAccountModal"; import { isMobilePlatform } from "@/utils/index"; +import { metaDataKeys } from "@/utils/meta"; const StyledHeader = styled.header` width: 100%; @@ -327,8 +328,10 @@ const Navbar = () => { key: "menu-4", }, { - title: settings?.value?.config?.termsPage && ( - + title: settings?.value?.config?.[metaDataKeys.termsPageMetaKey] && ( + {t("Terms")} @@ -488,9 +491,13 @@ const Navbar = () => { {t("Navbar.EditProfile")} - {settings?.value?.config?.termsPage && ( + {settings?.value?.config?.[metaDataKeys.termsPageMetaKey] && (
  • - + {t("Terms")}
  • @@ -584,7 +591,9 @@ const Navbar = () => { { id: 5, content: t("Terms"), - redirect: `/${settings?.value?.config?.termsPage}`, + redirect: `/${ + settings?.value?.config?.[metaDataKeys.termsPageMetaKey] + }`, }, // { // id: 3, diff --git a/src/components/_App/Warning/index.tsx b/src/components/_App/Warning/index.tsx index 59b3e7a4d..6ac66e57d 100644 --- a/src/components/_App/Warning/index.tsx +++ b/src/components/_App/Warning/index.tsx @@ -6,6 +6,7 @@ import { useTranslation } from "react-i18next"; import { MarkdownRenderer } from "@escolalms/components/lib/components/molecules/MarkdownRenderer/MarkdownRenderer"; import { Note } from "@escolalms/components/lib/components/atoms/Note/Note"; import { Button } from "@escolalms/components/lib/components/atoms/Button/Button"; +import { metaDataKeys } from "@/utils/meta"; const StyledAside = styled.aside` position: fixed; @@ -34,7 +35,8 @@ const Warning = () => { const { t } = useTranslation(); - const footerFromApi: string = settings?.value?.config?.footerWarning; + const footerFromApi: string = + settings?.value?.config?.[metaDataKeys.footerWarningMetaKey]; const handleClick = () => { localStorage.setItem("hideWarning", "true"); diff --git a/src/pages/register/index.tsx b/src/pages/register/index.tsx index d16353985..871102188 100644 --- a/src/pages/register/index.tsx +++ b/src/pages/register/index.tsx @@ -20,8 +20,8 @@ import routeRoutes from "@/components/Routes/routes"; import { EmailActivationImg } from "@/icons/index"; import { APP_URL } from "@/config/index"; import { redirectPrefix } from "@/utils/router"; -import { Capacitor } from "@capacitor/core"; import { isMobilePlatform } from "@/utils/index"; +import { metaDataKeys } from "@/utils/meta"; const StyledRegisterPage = styled.div` padding-top: 100px; @@ -123,7 +123,8 @@ const RegisterPage = () => { const token = search.split("?token=")[1]; const { t } = useTranslation(); - const footerFromApi: string = settings?.value?.config?.registerWarning; + const footerFromApi: string = + settings?.value?.config?.[metaDataKeys.registerWarningMetaKey]; const fieldLabels = { "AdditionalFields.Privacy Policy": ( diff --git a/src/utils/meta.ts b/src/utils/meta.ts index 99465b769..d5cbba243 100644 --- a/src/utils/meta.ts +++ b/src/utils/meta.ts @@ -1,4 +1,8 @@ export const metaDataKeys = { + // for showing first time questionnaire questionnaireFirstTimeMetaKey: "questionnaire_first_time", - // TODO: add rest of keys from settings here from entire demo project + // to show terms page in navigation becausse is a generic page + termsPageMetaKey: "termsPage", + footerWarningMetaKey: "footerWarning", + registerWarningMetaKey: "registerWarning", };