Skip to content

Commit

Permalink
fixed consultation picker
Browse files Browse the repository at this point in the history
  • Loading branch information
Przemek committed Nov 22, 2024
1 parent 264d777 commit 9b79a85
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
16 changes: 11 additions & 5 deletions src/components/Profile/ProfileAside/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -129,11 +130,16 @@ const ProfileAside: React.FC<Props> = ({ tabs, isProfile = true }) => {
</NavLink>
))}

{isProfile && settings?.value?.config?.termsPage && (
<NavLink to={`/${settings.value.config.termsPage}`}>
<Text size="16">{t("Terms")}</Text>
</NavLink>
)}
{isProfile &&
settings?.value?.config?.[metaDataKeys.termsPageMetaKey] && (
<NavLink
to={`/${
settings.value.config?.[metaDataKeys.termsPageMetaKey]
}`}
>
<Text size="16">{t("Terms")}</Text>
</NavLink>
)}
</nav>
</UserSidebar>
</div>
Expand Down
19 changes: 14 additions & 5 deletions src/components/_App/Navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
Expand Down Expand Up @@ -327,8 +328,10 @@ const Navbar = () => {
key: "menu-4",
},
{
title: settings?.value?.config?.termsPage && (
<Link to={`/${settings?.value?.config?.termsPage}`}>
title: settings?.value?.config?.[metaDataKeys.termsPageMetaKey] && (
<Link
to={`/${settings?.value?.config?.[metaDataKeys.termsPageMetaKey]}`}
>
<Text noMargin bold>
{t("Terms")}
</Text>
Expand Down Expand Up @@ -488,9 +491,13 @@ const Navbar = () => {
{t("Navbar.EditProfile")}
</NavLink>
</li>
{settings?.value?.config?.termsPage && (
{settings?.value?.config?.[metaDataKeys.termsPageMetaKey] && (
<li>
<NavLink to={`/${settings?.value?.config?.termsPage}`}>
<NavLink
to={`/${
settings?.value?.config?.[metaDataKeys.termsPageMetaKey]
}`}
>
{t("Terms")}
</NavLink>
</li>
Expand Down Expand Up @@ -584,7 +591,9 @@ const Navbar = () => {
{
id: 5,
content: t("Terms"),
redirect: `/${settings?.value?.config?.termsPage}`,
redirect: `/${
settings?.value?.config?.[metaDataKeys.termsPageMetaKey]
}`,
},
// {
// id: 3,
Expand Down
4 changes: 3 additions & 1 deletion src/components/_App/Warning/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
5 changes: 3 additions & 2 deletions src/pages/register/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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": (
Expand Down
6 changes: 5 additions & 1 deletion src/utils/meta.ts
Original file line number Diff line number Diff line change
@@ -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",
};

0 comments on commit 9b79a85

Please sign in to comment.