Skip to content

Commit

Permalink
Merge pull request #487 from EscolaLMS/feature/hide-register
Browse files Browse the repository at this point in the history
Feature/hide register
  • Loading branch information
victazzz authored Apr 24, 2024
2 parents 6c6d43f + 1765c52 commit 6fa6a73
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/pages/static-page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Container from "@/components/Common/Container";
import routeRoutes from "@/components/Routes/routes";
import ProfileAside from "@/components/Profile/ProfileAside";
import StaticPageSkeleton from "@/components/Skeletons/StaticPage";
import { MOBILE_DEVICE } from "@/config/index";

const StyledStaticPage = styled.section`
background-color: ${({ theme }) => theme.gray4};
Expand Down Expand Up @@ -52,15 +53,30 @@ const StaticPage = () => {
// !page.value && !page.error - when very first load (empty state)
// page.value && page.value?.slug !== slug - when prev static page was different
// page.error && !prevSlug - when we return to static-page after error on static page (ex. when prev static page not exist)
const removeWord = (text: string) => {
return text.replace("Mobile", "");
};

const mainTabs = useMemo(() => {
let items = pages?.list?.data;

if (MOBILE_DEVICE === "true") {
items = pages?.list?.data.filter(
(item) =>
item.slug !== "polityka-prywatnosci" && item.slug !== "kontakt"
);
} else {
items = pages?.list?.data.filter((item) => !item.slug.includes("mobile"));
}
return (
pages &&
pages.list?.data.map((item) => ({
key: item.slug,
title: item.title.substring(0, 50),
url: item.slug,
}))
items &&
items // @ts-ignore
.filter((item) => item.active)
.map((item) => ({
key: item.slug,
title: removeWord(item.title.substring(0, 50)),
url: item.slug,
}))
);
}, [pages]);

Expand Down

0 comments on commit 6fa6a73

Please sign in to comment.