From 24123cb68a4fd45aafd9b6dbeadb1853485d4ac8 Mon Sep 17 00:00:00 2001 From: Przemek Date: Wed, 24 Apr 2024 14:54:42 +0200 Subject: [PATCH 1/2] policy for ios --- src/pages/static-page/index.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/pages/static-page/index.tsx b/src/pages/static-page/index.tsx index 1028df5a..5abcb6ae 100644 --- a/src/pages/static-page/index.tsx +++ b/src/pages/static-page/index.tsx @@ -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}; @@ -52,13 +53,24 @@ 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) => ({ + items && + items.map((item) => ({ key: item.slug, - title: item.title.substring(0, 50), + title: removeWord(item.title.substring(0, 50)), url: item.slug, })) ); From 1765c52fe29456563666f4ea4a7e7a5716a913f6 Mon Sep 17 00:00:00 2001 From: Przemek Date: Wed, 24 Apr 2024 15:15:40 +0200 Subject: [PATCH 2/2] policy for ios --- src/pages/static-page/index.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/pages/static-page/index.tsx b/src/pages/static-page/index.tsx index 5abcb6ae..029f35a6 100644 --- a/src/pages/static-page/index.tsx +++ b/src/pages/static-page/index.tsx @@ -56,8 +56,10 @@ const StaticPage = () => { 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) => @@ -68,11 +70,13 @@ const StaticPage = () => { } return ( items && - items.map((item) => ({ - key: item.slug, - title: removeWord(item.title.substring(0, 50)), - url: item.slug, - })) + items // @ts-ignore + .filter((item) => item.active) + .map((item) => ({ + key: item.slug, + title: removeWord(item.title.substring(0, 50)), + url: item.slug, + })) ); }, [pages]);