From f605e0ce9e0adb2504c79f87404f8fa2cb9a9be5 Mon Sep 17 00:00:00 2001 From: MaryWylde Date: Fri, 19 Dec 2025 16:41:32 +0400 Subject: [PATCH] chore: added missing animation of header. - change usage of header in layouts/pages - change approach of using Saved Personas Component - move username and uxcat title update states to Context API - add Layout component where we keep shareable components or logic - remove hardcoded URLs from API Requests - remove staging sitemap from robots.txt --- public/robots.txt | 2 - src/api/uxcat/force-stop.ts | 4 +- src/api/uxcat/getUser.ts | 4 +- src/components/CustomModal/CustomModal.tsx | 2 +- .../NewUpdateModal/NewUpdateModal.module.scss | 5 + .../NewUpdateModal/NewUpdateModal.tsx | 29 +- src/components/ToolFooter/ToolFooter.tsx | 5 +- .../ToolHeader/ToolHeader.module.scss | 76 +++- src/components/ToolHeader/ToolHeader.tsx | 159 ++++---- src/components/UXCoreModal/UXCoreModal.tsx | 1 + .../_biases/BiasLabel/BiasLabel.module.scss | 2 - .../_biases/BiasLabel/BiasLabel.tsx | 4 + .../_biases/MobileView/MobileView.tsx | 6 +- .../_uxcp/DecisionTable/DecisionTable.tsx | 2 +- .../_uxcp/LogInModal/LogInModal.tsx | 27 +- src/data/ourProjects/en.ts | 2 +- src/layouts/ApiLayout/ApiLayout.tsx | 57 +-- src/layouts/Layout.tsx | 88 ++++- .../StartTestLayout/StartTestLayout.tsx | 20 - src/layouts/UXCGLayout/UXCGLayout.tsx | 50 +-- src/layouts/UXCPLayout/UXCPLayout.tsx | 35 +- src/layouts/UXCatLayout/UXCatLayout.tsx | 52 +-- src/layouts/UXCoreLayout/UXCoreLayout.tsx | 29 +- .../UXCoreLayout/UXCoreLayout.types.ts | 7 +- src/layouts/UserProfile/UserProfile.tsx | 348 +++++++++--------- src/layouts/UserProfile/UserProfile.types.ts | 2 - src/pages/_app.tsx | 42 ++- src/pages/user/[userId]/index.tsx | 8 - src/pages/uxcat/index.tsx | 1 - src/pages/uxcat/ongoing.tsx | 37 +- src/pages/uxcat/start-test.tsx | 31 +- src/pages/uxcat/test-result.tsx | 40 +- src/pages/uxcg/[slug].tsx | 1 - src/pages/uxcg/index.tsx | 8 +- src/pages/uxcore-api/index.tsx | 20 +- src/pages/uxcore/[slug].tsx | 1 - src/pages/uxcore/index.tsx | 41 +-- src/pages/uxcp/index.tsx | 6 +- 38 files changed, 533 insertions(+), 721 deletions(-) diff --git a/public/robots.txt b/public/robots.txt index 1c06dd8..550ed2a 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -25,5 +25,3 @@ Disallow: /hy/all-about-user-stories/ Disallow: /hy/client-dev-company-workflow-birds-eye-view/ Disallow: /hy/career-path-of-a-manager-and-a-few-universal-tips/ Disallow: /hy/overengineering_and_demo_readiness/ - -Sitemap: https://staging-strapi.keepsimple.io/sitemap/index.xml diff --git a/src/api/uxcat/force-stop.ts b/src/api/uxcat/force-stop.ts index 6866b4d..79c3f13 100644 --- a/src/api/uxcat/force-stop.ts +++ b/src/api/uxcat/force-stop.ts @@ -1,5 +1,7 @@ +import { UxCatRoute } from '@api/uxcat/configs'; + export const getForceStop = async token => { - const url = `https://uxcat.keepsimple.io/tests/force-stop`; + const url = `${UxCatRoute}tests/force-stop`; try { const response = await fetch(url, { diff --git a/src/api/uxcat/getUser.ts b/src/api/uxcat/getUser.ts index df146d3..8debfe3 100644 --- a/src/api/uxcat/getUser.ts +++ b/src/api/uxcat/getUser.ts @@ -1,5 +1,7 @@ +import { UxCatRoute } from '@api/uxcat/configs'; + export const getPublicUserInfo = async (username: string | string[]) => { - const url = `https://uxcat.keepsimple.io/users/${username}`; + const url = `${UxCatRoute}users/${username}`; try { const response = await fetch(url, { diff --git a/src/components/CustomModal/CustomModal.tsx b/src/components/CustomModal/CustomModal.tsx index e5415be..39992e8 100644 --- a/src/components/CustomModal/CustomModal.tsx +++ b/src/components/CustomModal/CustomModal.tsx @@ -14,7 +14,7 @@ type ContentTypes = 'contactUs' | 'addQuestion'; type CustomModalProps = { isVisible: boolean; contentType: ContentTypes; - tags: TagType[]; + tags?: TagType[]; onClose: () => void; }; diff --git a/src/components/NewUpdateModal/NewUpdateModal.module.scss b/src/components/NewUpdateModal/NewUpdateModal.module.scss index 9c0335c..ac6f05c 100644 --- a/src/components/NewUpdateModal/NewUpdateModal.module.scss +++ b/src/components/NewUpdateModal/NewUpdateModal.module.scss @@ -1,20 +1,25 @@ .modalBody { padding: 0 0 22px 0 !important; + .img { + object-fit: cover; position: relative; width: 100%; } } + .content { text-align: center; padding: 8px 30px 0 30px; } + .instaIcon { position: absolute; right: 34%; top: 21%; cursor: pointer; } + .closeBtn { border-radius: 0; background-color: #000; diff --git a/src/components/NewUpdateModal/NewUpdateModal.tsx b/src/components/NewUpdateModal/NewUpdateModal.tsx index bddef6d..a241f97 100644 --- a/src/components/NewUpdateModal/NewUpdateModal.tsx +++ b/src/components/NewUpdateModal/NewUpdateModal.tsx @@ -11,6 +11,9 @@ import type { NewUpdateModalProps } from './NewUpdateModal.types'; import styles from './NewUpdateModal.module.scss'; const NewUpdateModal: FC = ({ data, onClose }) => { + const closeText = data?.['Close button text']; + const socialLink = data?.['Social media link']; + return ( = ({ data, onClose }) => { >
{'New - + {'Insta = ({ data, onClose }) => {
- {data?.description} -
); diff --git a/src/components/ToolFooter/ToolFooter.tsx b/src/components/ToolFooter/ToolFooter.tsx index 256cd30..cb60498 100644 --- a/src/components/ToolFooter/ToolFooter.tsx +++ b/src/components/ToolFooter/ToolFooter.tsx @@ -9,7 +9,6 @@ import CustomModal from '@components/CustomModal'; import toolFooterData from '@data/toolFooter'; import type { TRouter } from '@local-types/global'; -import type { TagType } from '@local-types/data'; import styles from './ToolFooter.module.scss'; @@ -22,10 +21,9 @@ const releaseIndexes = { type TToolFooter = { page: 'uxcore' | 'uxcg' | 'uxcp' | 'api'; - tags: TagType[]; }; -const ToolFooter: FC = ({ page, tags }) => { +const ToolFooter: FC = ({ page }) => { const router = useRouter(); const { locale } = router as TRouter; const { release, contactUs, contributors, tooltipTxt } = @@ -84,7 +82,6 @@ const ToolFooter: FC = ({ page, tags }) => { toggleModal()} /> diff --git a/src/components/ToolHeader/ToolHeader.module.scss b/src/components/ToolHeader/ToolHeader.module.scss index 55fe6fa..60b7eeb 100644 --- a/src/components/ToolHeader/ToolHeader.module.scss +++ b/src/components/ToolHeader/ToolHeader.module.scss @@ -37,17 +37,73 @@ $headerHeight: 46px; display: flex; margin-left: 50px; align-items: center; + position: relative; + + width: -webkit-fill-available; .Description { padding-top: 3px; } + .openLink { padding-left: 6px; } } + + .Links.is-uxcore { + --pill-w: 96px; + } + + .Links.is-uxcg { + --pill-w: 79px; + } + + .Links.is-uxcp { + --pill-w: 101px; + } + + .Links.is-uxcat { + --pill-w: 157px; + } + + .Links.is-uxcore .Indicator { + transform: translateX(calc((96px + 8px) * 0)); + color: #fff; + } + + .Links.is-uxcg .Indicator { + transform: translateX(calc((94px + 8px) * 1)); + color: #fff; + } + + .Links.is-uxcp .Indicator { + transform: translateX(calc((85px + 8px) * 2)); + color: #fff; + } + + .Links.is-uxcat .Indicator { + transform: translateX(calc((89px + 8px) * 3)); + color: #fff; + } + } + + .Indicator { + position: absolute; + top: 6px; + bottom: 4px; + left: 0; + width: var(--pill-w, 120px); + background-color: #000000d9; + border-radius: 4px; + transform: translateX(0); + transition: transform 450ms cubic-bezier(0.22, 0.95, 0.35, 1); + will-change: transform; + pointer-events: none; + height: 33px; } .MenuItem { + position: relative; font-size: 14px; display: flex; cursor: pointer; @@ -86,10 +142,27 @@ $headerHeight: 46px; &.Active { color: #fafafa; + z-index: 2; + + & svg path { + z-index: 1; + fill: #fafafa; + } + + &:hover { + background-color: unset; + } + } + + &.ActivePodcast, + &.ActiveProjects { background-color: #000000d9; border-radius: 4px; + color: #fff; + & svg path { - fill: #fafafa; + z-index: 1; + fill: #fff; } } } @@ -348,6 +421,7 @@ $headerHeight: 46px; & .PageSwitcherContainer { padding: 16px 16px 0; + .PageSwitcherItem { box-sizing: border-box; width: -webkit-fill-available; diff --git a/src/components/ToolHeader/ToolHeader.tsx b/src/components/ToolHeader/ToolHeader.tsx index fd934eb..0155a4a 100644 --- a/src/components/ToolHeader/ToolHeader.tsx +++ b/src/components/ToolHeader/ToolHeader.tsx @@ -10,6 +10,7 @@ import { useRouter } from 'next/router'; import Image from 'next/image'; import cn from 'classnames'; import dynamic from 'next/dynamic'; +import { usePathname } from 'next/navigation'; import type { TRouter } from '@local-types/global'; import { UserTypes } from '@local-types/uxcat-types/types'; @@ -46,7 +47,6 @@ const SettingsModal = dynamic(() => import('@components/SettingsModal'), { }); type TToolHeader = { - page?: 'uxcp' | 'uxcg' | 'uxcore' | 'uxeducation' | 'uxcat'; homepageLinkTarget?: '_blank' | '_self'; openPodcast?: boolean; showSavedPersonas?: boolean; @@ -59,11 +59,9 @@ type TToolHeader = { setUserInfo?: (data: UserTypes) => void; setUpdatedUsername?: (username: string) => void; blockLanguageSwitcher?: boolean; - tags?: any; // TODO - Added temporarily, will be removed in the next tasks }; const ToolHeader: FC = ({ - page, homepageLinkTarget = '_self', openPodcast, setOpenPodcast, @@ -78,11 +76,26 @@ const ToolHeader: FC = ({ blockLanguageSwitcher, }) => { const router = useRouter(); + const { locale, asPath } = router as TRouter; + + const pathname = usePathname(); const { isMobile } = useMobile()[1]; const [, { isCoreView }] = useUXCoreGlobals(); const { accountData, setAccountData, ourProjectsModalData } = useContext(GlobalContext); - const { locale, asPath } = router as TRouter; + + const isActive = (pathname: string, href: string) => + pathname === href || (href !== '/' && pathname.startsWith(href + '/')); + + const imageSrc = useMemo(() => accountData?.picture, [accountData]); + const [showDropdown, setShowDropdown] = useState(false); + const [openOurProjects, setOpenOurProjects] = useState(false); + const [showUxcoreTooltip, toggleUxcoreHeaderTooltip] = useState(true); + const [showUxcgTooltip, toggleUxcgHeaderTooltip] = useState(true); + const [openSettings, setOpenSettings] = useState(false); + const [token, setToken] = useState(null); + const [usernameIsTakenError, setUsernameIsTakenError] = useState(''); + const [changedTitle, setChangedTitle] = useState(false); const { ourProjects, @@ -97,18 +110,8 @@ const ToolHeader: FC = ({ done, } = toolHeaderData[locale]; - const imageSrc = useMemo(() => accountData?.picture, [accountData]); - const [showDropdown, setShowDropdown] = useState(false); - const [openOurProjects, setOpenOurProjects] = useState(false); - const [showUxcoreTooltip, toggleUxcoreHeaderTooltip] = useState(true); - const [showUxcgTooltip, toggleUxcgHeaderTooltip] = useState(true); - const [openSettings, setOpenSettings] = useState(false); - const [token, setToken] = useState(null); - const [usernameIsTakenError, setUsernameIsTakenError] = useState(''); - const [changedTitle, setChangedTitle] = useState(false); const currentUsername = !!accountData && accountData.username; const currentEmail = accountData && accountData.email; - const publicEmail = accountData && accountData.publicEmail; const linkedIn = userInfo?.user?.linkedin @@ -135,6 +138,16 @@ const ToolHeader: FC = ({ const title = changedTitle ? userInfo?.title : userInfo?.user?.title; + const activePage = pathname.includes('/uxcore') + ? 'uxcore' + : pathname.includes('/uxcg') + ? 'uxcg' + : pathname.includes('/uxcp') + ? 'uxcp' + : pathname.includes('/uxcat') || pathname.includes('/user') + ? 'uxcat' + : 'uxcore'; + const openPodcastHandler = useCallback(() => { setOpenPodcast(prev => !prev); }, []); @@ -171,7 +184,7 @@ const ToolHeader: FC = ({ setUsernameIsTakenError(''); const userData = await getUserInfo(); setUserInfo(userData?.user); - setUpdatedUsername && setUpdatedUsername(username); + setUpdatedUsername(username); } catch (error) { setOpenSettings(true); setUsernameIsTakenError(usernameIsTaken); @@ -231,7 +244,7 @@ const ToolHeader: FC = ({ /> {!disablePageSwitcher && (
- + = ({ keepsimple logo -
- {navItems.map(({ label, href, page: itemPage, icon }, index) => ( - - { - toggleUxcoreHeaderTooltip(false); - toggleUxcgHeaderTooltip(false); - }} - > - {label != 'Bob - AI Assistant' ? ( - icon - ) : ( - {'Bob - )} - - {label === 'Bob - AI Assistant' - ? bobName - ? bobName - : label - : label === 'Awareness Test' - ? awarenessTest - : label} - - {label === 'Bob - AI Assistant' && ( - {'New - )} - - - ))} +
+ + {navItems.map(({ label, href, page, icon }, index) => { + return ( + <> + + + { + toggleUxcoreHeaderTooltip(false); + toggleUxcgHeaderTooltip(false); + }} + > + {label != 'Bob - AI Assistant' ? ( + icon + ) : ( + {'Bob + )} + + {label === 'Bob - AI Assistant' + ? bobName + ? bobName + : label + : label === 'Awareness Test' + ? awarenessTest + : label} + + {label === 'Bob - AI Assistant' && ( + {'New + )} + + + + ); + })}
{showUxcgTooltip && asPath === '/uxcore' && ( @@ -351,7 +383,7 @@ const ToolHeader: FC = ({
@@ -362,6 +394,7 @@ const ToolHeader: FC = ({ setOpenOurProjects(true)} > diff --git a/src/components/UXCoreModal/UXCoreModal.tsx b/src/components/UXCoreModal/UXCoreModal.tsx index 388830c..e091385 100644 --- a/src/components/UXCoreModal/UXCoreModal.tsx +++ b/src/components/UXCoreModal/UXCoreModal.tsx @@ -272,6 +272,7 @@ const UXCoreModal: FC = ({
= ({ '--x': geometry?.x, '--y': geometry?.y, }} + data-state={ + searchResults.includes(Number(biasNumber)) ? 'hovered' : 'faded' + } className={cn(styles.biasLabel, className, { [styles.secondRow]: sectionId === 2, [styles.searched]: searchResults.length > 0 && searchResults.includes(Number(biasNumber)), [styles.isLeftSection]: isLeftSection, + [styles.biasLabelHy]: locale === 'hy', // These are exceptional positions for left-top section labels [styles[`bias-label-${biasNumber}`]]: isLeftSection, [styles.hovered]: diff --git a/src/components/_biases/MobileView/MobileView.tsx b/src/components/_biases/MobileView/MobileView.tsx index f67d297..1bf6f65 100644 --- a/src/components/_biases/MobileView/MobileView.tsx +++ b/src/components/_biases/MobileView/MobileView.tsx @@ -15,7 +15,7 @@ import cn from 'classnames'; import Image from 'next/image'; import type { TRouter } from '@local-types/global'; -import type { StrapiBiasType, TagType } from '@local-types/data'; +import type { StrapiBiasType } from '@local-types/data'; import { UserTypes } from '@local-types/uxcat-types/types'; import { groupFilteredData } from '@lib/helpers'; @@ -47,7 +47,6 @@ const ViewSwitcher = dynamic(() => import('@components/_biases/ViewSwitcher'), { type MobileViewProps = { containerClassName: string; - tags: TagType[]; strapiBiases: StrapiBiasType[]; isSecondView?: boolean; toggleIsCoreView?: () => void; @@ -78,7 +77,6 @@ const MobileView: FC = ({ headerPodcastOpen, isPodcastOpen, handleSnackbarOpening, - tags, description, userInfo, setUserInfo, @@ -276,7 +274,7 @@ const MobileView: FC = ({ onClick={() => setOpenOurProjects(true)} > -
+
{ourProjects}
diff --git a/src/components/_uxcp/DecisionTable/DecisionTable.tsx b/src/components/_uxcp/DecisionTable/DecisionTable.tsx index 67896b4..e7ed8c4 100644 --- a/src/components/_uxcp/DecisionTable/DecisionTable.tsx +++ b/src/components/_uxcp/DecisionTable/DecisionTable.tsx @@ -295,7 +295,7 @@ const DecisionTable: FC = ({ title={article} description={learnHowToUse} icon={} - url={'/uiux'} + url={'/articles/uiux'} /> void; @@ -49,31 +49,26 @@ const LogInModal: FC = ({ setShowModal, source }) => { provider: string, logInSource: string, ) => { + const returnTo = router.asPath; + setRedirectCookie(returnTo); + if (session && accountData === null) { await signOut({ redirect: false }); localStorage.removeItem('accessToken'); localStorage.removeItem('provider'); sessionStorage.clear(); - document.cookie = - 'next-auth.session-token=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;'; - setTimeout(() => { - router.replace(`/auth?provider=${provider}`); - handleMixpanelSignUp(provider); - }, 100); - } else { - router.push(`/auth?provider=${provider}`); + router.replace(`/auth?provider=${provider}`); handleMixpanelSignUp(provider); trackLogInSource(logInSource); + return; } - }; - useEffect(() => { - if (!session) { - setRedirectCookie(window.location.pathname + window.location.search); - } - }, [session, router]); + router.push(`/auth?provider=${provider}`); + handleMixpanelSignUp(provider); + trackLogInSource(logInSource); + }; return ( import('@components/_uxcp/SavedPersonas'), { - ssr: false, -}); - -interface ApiLayoutProps { - tags: TagType[]; - userInfo: UserTypes; - setUserInfo: (userInfo: UserTypes) => void; -} - -const ApiLayout: FC = ({ tags, userInfo, setUserInfo }) => { - const [openPersonas, setOpenPersonas] = useState(false); - const [personas, setPersonas] = useState([]); - const router = useRouter(); - const { locale } = router as TRouter; - const { savedPersonasTitles } = decisionTable[locale]; +const ApiLayout: FC = () => { const sectionDescription = `Welcome to the UXCore API documentation! Our API provides a simple and powerful way to access all information available in the UXCore project. In this documentation, you'll find details about the API's endpoints, parameters, and examples to help you get started quickly. The API is free. Still, we open access per request because of some technicalities. For access request or any other questions please contact us at alexanyanwolf@gmail.com`; - const fetchData = async () => { - const result = await getPersonaList(); - setPersonas(result); - }; - - useEffect(() => { - fetchData().then(r => console.log(r)); - }, []); - return (
-

UX CORE API

@@ -92,17 +50,8 @@ const ApiLayout: FC = ({ tags, userInfo, setUserInfo }) => { ); })}
- +
Be Kind. Do Good.
- {openPersonas && ( - - )}
); }; diff --git a/src/layouts/Layout.tsx b/src/layouts/Layout.tsx index eb3dcfe..72b1687 100644 --- a/src/layouts/Layout.tsx +++ b/src/layouts/Layout.tsx @@ -1,15 +1,91 @@ -// import ToolHeader from '@components/ToolHeader'; +import React, { useContext, useEffect, useState } from 'react'; +import { useRouter } from 'next/router'; +import { usePathname } from 'next/navigation'; +import dynamic from 'next/dynamic'; + +import { GlobalContext } from '@components/Context/GlobalContext'; +import SavedPersonas from '@components/_uxcp/SavedPersonas'; +import UXCorePopup from '@components/UXCorePopup'; +import decisionTable from '@data/decisionTable'; + +import { getPersonaList } from '@api/personas'; + +import { TRouter } from '@local-types/global'; + +import useUCoreMobile from '@hooks/uxcoreMobile'; + +const ToolHeader = dynamic(() => import('@components/ToolHeader'), { + ssr: false, +}); export default function Layout({ children }: { children: React.ReactNode }) { - // tags for custom modal - // saved personas - // routes for active state - // condition for uxcore mobile - if uxcore and mobile + const router = useRouter(); + const { locale } = router as TRouter; + + const [personas, setPersonas] = useState([]); + const { + uxcatUserInfo, + setUxcatUserInfo, + setSelectedTitle, + setUpdatedUsername, + } = useContext(GlobalContext); + const [openPersonas, setOpenPersonas] = useState(false); + const [headerPodcastOpen, setHeaderPodcastOpen] = useState(false); + + const { savedPersonasTitles } = decisionTable[locale]; + const { isUxcoreMobile } = useUCoreMobile()[1]; + + const pathname = usePathname().replace(/\/+$/, ''); + const path = pathname.replace(/\/+$/, ''); + + const isUXCoreRoot = path === '/uxcore'; + const isUXCoreNested = path.startsWith('/uxcore/'); + const isUXCGNested = path.startsWith('/uxcg/'); + const isUXCatNested = path.startsWith('/uxcat/'); + const isUserProfileRoot = path.startsWith('/user/'); + const shouldHideToolHeader = isUXCoreRoot && isUxcoreMobile; + + const fetchData = async () => { + const result = await getPersonaList(); + setPersonas(result); + }; + + useEffect(() => { + fetchData().then(r => console.log(r)); + }, []); return ( <> - {/**/} + {!shouldHideToolHeader && ( + + )}
{children}
+ {openPersonas && ( + + )} + {headerPodcastOpen && ( + + )} ); } diff --git a/src/layouts/StartTestLayout/StartTestLayout.tsx b/src/layouts/StartTestLayout/StartTestLayout.tsx index 7254617..661b0c0 100644 --- a/src/layouts/StartTestLayout/StartTestLayout.tsx +++ b/src/layouts/StartTestLayout/StartTestLayout.tsx @@ -2,12 +2,8 @@ import { FC } from 'react'; import dynamic from 'next/dynamic'; import cn from 'classnames'; -import ToolHeader from '@components/ToolHeader'; import Button from '@components/Button'; -import type { TagType } from '@local-types/data'; -import { UserTypes } from '@local-types/uxcat-types/types'; - import UxCatLogo from '@icons/UxCatLogo'; import styles from './StartTestLayout.module.scss'; @@ -17,21 +13,15 @@ const Modal = dynamic(() => import('@components/Modal'), { }); type StartTestLayoutProps = { - tags?: TagType[]; - setOpenPersonas: (openPersonas: boolean) => void; testDuration: string; description1: string; goodLuckTxt: string; btnTxt: string; handleStartTest: () => void; disabled?: boolean; - userInfo?: UserTypes; - setUserInfo?: (userInfo: UserTypes) => void; description2?: string; }; const StartTestLayout: FC = ({ - tags, - setOpenPersonas, testDuration, handleStartTest, description1, @@ -39,19 +29,9 @@ const StartTestLayout: FC = ({ goodLuckTxt, btnTxt, disabled, - userInfo, - setUserInfo, }) => { return ( <> -
{testDuration} import('@components/_uxcp/SavedPersonas'), { - ssr: false, -}); - interface UXCGLayoutProps { - questions: any; // HYTranslation TODO + questions: any; tags: TagType[]; changedHeadingOrder?: boolean; searchValue?: string; setSearchValue?: (value: string) => void; - userInfo?: UserTypes; - setUserInfo?: (userInfo: UserTypes) => void; allQuestions: any; - blockLanguageSwitcher?: boolean; } const UXCGLayout: FC = ({ @@ -43,17 +29,12 @@ const UXCGLayout: FC = ({ changedHeadingOrder = false, searchValue, setSearchValue, - userInfo, - setUserInfo, allQuestions, - blockLanguageSwitcher, }) => { const { setIsVisible } = useSpinner()[0]; const [isAciveSearch, setIsActiveSearch] = useState(false); const [searchResults, setSearchResults] = useState([]); const [activeFilter, setActiveFilter] = useState('1'); - const [openPersonas, setOpenPersonas] = useState(false); - const [personas, setPersonas] = useState(null); const searchDebounce: any = useRef(); @@ -63,7 +44,6 @@ const UXCGLayout: FC = ({ const initialSearchValue = router.query.search as string; const { subTitle } = uxcgDescriptionData[locale]; - const { savedPersonasTitles } = decisionTable[locale]; const filterQuestionsBySearchTerm = ( searchTerm: string, @@ -163,25 +143,8 @@ const UXCGLayout: FC = ({ }; }, [initialSearchValue, router.asPath, locale]); - useEffect(() => { - const fetchData = async () => { - const result = await getPersonaList(); - setPersonas(result); - }; - - fetchData().then(r => console.log(r)); - }, []); - return (
-
= ({
Be Kind. Do Good.
- - {openPersonas && ( - - )} +
); }; diff --git a/src/layouts/UXCPLayout/UXCPLayout.tsx b/src/layouts/UXCPLayout/UXCPLayout.tsx index 97d5350..3009fc9 100644 --- a/src/layouts/UXCPLayout/UXCPLayout.tsx +++ b/src/layouts/UXCPLayout/UXCPLayout.tsx @@ -11,7 +11,6 @@ import { useRouter } from 'next/router'; import dynamic from 'next/dynamic'; import cn from 'classnames'; -import ToolHeader from '@components/ToolHeader'; import ToolFooter from '@components/ToolFooter'; import UXCPDescription from '@components/_uxcp/UXCPDescription'; import PersonaSection from '@components/_uxcp/PersonaSection'; @@ -41,7 +40,6 @@ import DecisionTable from '@components/_uxcp/DecisionTable'; import { addPersona, getPersonaList, updatePersona } from '@api/personas'; import decisionTable from '@data/decisionTable'; -import { UserTypes } from '@local-types/uxcat-types/types'; import styles from './UXCPLayout.module.scss'; const TeamRelatedInsights = dynamic( @@ -58,10 +56,6 @@ const PersonaExistsModal = dynamic( }, ); -const SavedPersonas = dynamic(() => import('@components/_uxcp/SavedPersonas'), { - ssr: false, -}); - interface UXCPLayoutProps { questions: QuestionType[]; allLangBiases: any; @@ -70,8 +64,6 @@ interface UXCPLayoutProps { isSinglePersona?: boolean; personaDecisionTable?: any; existingPersonaName?: string; - userInfo?: UserTypes; - setUserInfo?: (userInfo: UserTypes) => void; } const UXCPLayout: FC = ({ @@ -81,8 +73,6 @@ const UXCPLayout: FC = ({ existingPersonaName, biases, tags, - userInfo, - setUserInfo, allLangBiases, }) => { const router = useRouter(); @@ -102,7 +92,6 @@ const UXCPLayout: FC = ({ const [show, setShow] = useState(false); const [isInitiated, setIsInitiated] = useState(false); const [isTeamMember, setIsTeamMember] = useState(false); - const [openPersonas, setOpenPersonas] = useState(false); const [temporarySavedData, setTemporarySavedData] = useState(false); const [personaExistWarning, setPersonaExistWarning] = useState(false); const [selectedBiases, setSelectedBiases] = useState([]); @@ -119,8 +108,7 @@ const UXCPLayout: FC = ({ ); const [temporarySavedBiases, setTemporarySavedBiases] = useState(null); const { title, subSectionTitle, copyURL, copied } = uxcpLocalization[locale]; - const { savedPersonasTitles, overWriteText, cancelBtn, pleaseInputName } = - decisionTable[locale]; + const { overWriteText, cancelBtn, pleaseInputName } = decisionTable[locale]; const { accountData } = useContext(GlobalContext); const { relevantQuestions, tagRelevancy, suggestedQuestionsList } = useMemo( () => calculateData(questions, selectedBiases), @@ -449,15 +437,6 @@ const UXCPLayout: FC = ({ return (
- -
= ({ removableBiasId={removableBiasId} maxPersonaQuantity={!!personas && personas.length} setBiasWillBeRemoved={setBiasWillBeRemoved} - setOpenPersonas={setOpenPersonas} handleLoginToEditClick={handleLoginToEditClick} isMatchedPersonaName={findMatchingPersonaName?.name === personaName} loadFromLocal={loadFromLocal} @@ -581,16 +559,7 @@ const UXCPLayout: FC = ({
Be Kind. Do Good.
- - {openPersonas && ( - - )} + {personaExistWarning && ( = ({ - tags, userInfo, nextTestTime, ongoingTest, @@ -88,25 +81,19 @@ const UXCatLayout: FC = ({ notifiedAchievements, disableStartTest, pageDescription, - userDetails, matchingLevelDetails, }) => { const router = useRouter(); const { locale } = router as TRouter; const currentLocale = locale === 'ru' ? 'ru' : 'en'; - + const { updatedUsername } = useContext(GlobalContext); const [showLoginModal, setShowLoginModal] = useState(false); - const [openPersonas, setOpenPersonas] = useState(false); const [openAccordion, setOpenAccordion] = useState(true); - const [personas, setPersonas] = useState(null); const [codeIsActivated, setCodeIsActivated] = useState(false); const [activatedDuration, setActivatedDuration] = useState(0); - const [updatedUsername, setUpdatedUsername] = useState(''); - const { savedPersonasTitles } = decisionTable[locale]; const [userDataLoaded, setUserDataLoaded] = useState(false); const [audioPlayed, setAudioPlayed] = useState(false); const [selectedGender, setSelectedGender] = useState(''); - const [headerUserInfo, setHeaderUserInfo] = useState(null); const username = updatedUsername ? updatedUsername : userInfo?.username; const activatedBarLine = isLevelMilestone(level, 15) ? 2500 : 1000; const { @@ -122,6 +109,7 @@ const UXCatLayout: FC = ({ yourPointsTxt, zeroLevelUser, } = uxcatData[currentLocale]; + const userPoints = userInfo?.points; const fiveAchievements = achievements?.slice(0, 10); const loggedInAchievements = achievements?.slice(0, 15); @@ -136,15 +124,6 @@ const UXCatLayout: FC = ({ setShowLoginModal(true); }; - useEffect(() => { - const fetchData = async () => { - const result = await getPersonaList(); - setPersonas(result); - }; - - fetchData().then(r => r); - }, []); - useEffect(() => { const getOpenedUXCatRules = localStorage.getItem('isOpenedUXCatRules'); if (!!getOpenedUXCatRules) { @@ -218,23 +197,9 @@ const UXCatLayout: FC = ({ } }, [activatedDuration, codeIsActivated]); - useEffect(() => { - if (userInfo) { - setHeaderUserInfo(userDetails); - } - }, [userDetails]); - return ( <>
-

{title}

{shortTitle} @@ -338,15 +303,6 @@ const UXCatLayout: FC = ({ {showLoginModal && ( )} - {openPersonas && ( - - )} {!!notifiedAchievements ? ( import('@components/_biases/MobileView'), { }); const UXCoreLayout: FC = ({ - tags, strapiBiases, isOpen, biasSelected, @@ -59,12 +57,8 @@ const UXCoreLayout: FC = ({ setOpenPodcast, userInfo, setUserInfo, - setOpenPersonas, - uxcatUserInfo, - setUxcatUserInfo = () => {}, blockLanguageSwitcher, mounted, - slug, }) => { const [{ toggleIsCoreView }, { isCoreView }] = useUXCoreGlobals(); const [{ toggleIsProductView }, { isProductView }] = useUXCoreGlobals(); @@ -140,18 +134,6 @@ const UXCoreLayout: FC = ({ return ( <> - {!isUxcoreMobile && ( - - )}
= ({ toggleIsCoreView={toggleIsProductView} defaultViewLabel={'PM'} secondViewLabel={'hr'} - tags={tags} strapiBiases={strapiBiases} containerClassName={styles.body} setIsSwitched={setIsSwitched} @@ -227,16 +208,8 @@ const UXCoreLayout: FC = ({ setUserInfo={setUserInfo} blockLanguageSwitcher={blockLanguageSwitcher} /> -
- {headerPodcastOpen && ( - - )} -
- + {!!snackBarText && ( void; - setOpenPersonas?: (openPersonas: boolean) => void; - uxcatUserInfo?: UserTypes; - setUxcatUserInfo?: (data: UserTypes) => void; blockLanguageSwitcher?: boolean; - slug?: string; } diff --git a/src/layouts/UserProfile/UserProfile.tsx b/src/layouts/UserProfile/UserProfile.tsx index eea5152..78579fe 100644 --- a/src/layouts/UserProfile/UserProfile.tsx +++ b/src/layouts/UserProfile/UserProfile.tsx @@ -1,4 +1,4 @@ -import React, { FC, useEffect, useRef, useState } from 'react'; +import React, { FC, useContext, useEffect, useRef, useState } from 'react'; import Image from 'next/image'; import { useRouter } from 'next/router'; import dynamic from 'next/dynamic'; @@ -15,7 +15,6 @@ import type { UserProfileProps } from './UserProfile.types'; import Toasts from '@components/Toasts'; import Dropdown from '@components/Dropdown'; import Statistics from '@components/Statistics'; -import ToolHeader from '@components/ToolHeader'; import StartTestBtn from '@components/StartTestBtn'; import LogInModal from '@components/_uxcp/LogInModal'; import AccountHeader from '@components/AccountHeader'; @@ -35,13 +34,13 @@ import { updateBackgroundImage, updateCoverImage } from '@api/strapi'; import { sendRef } from '@api/uxcat/sendRef'; import styles from './UserProfile.module.scss'; +import { GlobalContext } from '@components/Context/GlobalContext'; const SelectImageModal = dynamic(() => import('@components/SelectImageModal'), { ssr: false, }); const UserProfile: FC = ({ - tags, userInfo, dummyBoardContent, coverImages, @@ -73,13 +72,13 @@ const UserProfile: FC = ({ nextTestTime, hasSpecialAchievements, headerUserInfo, - setHeaderUserInfo, }) => { const { isMobile } = useMobile()[1]; const router = useRouter(); const { locale } = router as TRouter; const currentLocale = locale === 'ru' ? 'ru' : 'en'; const scrollToAchievementsRef = useRef(null); + const { selectedTitle } = useContext(GlobalContext); const [openCoverImgModal, setOpenCoverImgModal] = useState(false); const [openLoginModal, setOpenLoginModal] = useState(false); @@ -89,7 +88,6 @@ const UserProfile: FC = ({ const [personas, setPersonas] = useState(null); const [token, setToken] = useState(undefined); const [updatedData, setUpdatedData] = useState(userInfo); - const [selectedTitle, setSelectedTitle] = useState(''); const defaultCoverImage = matchingLevelDetails?.attributes.bgImage.data.attributes.url; @@ -199,191 +197,177 @@ const UserProfile: FC = ({ }, []); return ( - <> - + - -
- -
+ {privateMode && isLevelMilestone(level, 15) && ( +
+ +
+ )} +
- {privateMode && isLevelMilestone(level, 15) && ( -
- -
+ + {privateMode && !!statistics && ( + )} -
- + - {privateMode && !!statistics && ( - - )} -
- + {!isMobile && {showTxt}} + -
- {!isMobile && {showTxt}} - -
-
- +
+ +
+ + {privateMode && ( +
+
- - {privateMode && ( -
- -
- )} -
Be Kind. Do Good.
-
-
- {openCoverImgModal && privateMode && ( - ({ - thumbnail: - item.attributes.coverImage.data.attributes.formats.thumbnail - .url, - image: item.attributes.coverImage.data.attributes.url, - })} - defaultImage={coverImage} - /> - )} - {openBgImgModal && ( - ({ - thumbnail: - item.attributes.bgImage.data.attributes.formats.thumbnail.url, - image: item.attributes.bgImage.data.attributes.url, - })} - defaultImage={backgroundImage} - /> - )} - {openPersonas && ( - - )} - {!!notifiedAchievements ? ( - - ) : null} - {openLoginModal && ( - - )} -
- + )} +
Be Kind. Do Good.
+
+
+ {openCoverImgModal && privateMode && ( + ({ + thumbnail: + item.attributes.coverImage.data.attributes.formats.thumbnail.url, + image: item.attributes.coverImage.data.attributes.url, + })} + defaultImage={coverImage} + /> + )} + {openBgImgModal && ( + ({ + thumbnail: + item.attributes.bgImage.data.attributes.formats.thumbnail.url, + image: item.attributes.bgImage.data.attributes.url, + })} + defaultImage={backgroundImage} + /> + )} + {openPersonas && ( + + )} + {!!notifiedAchievements ? ( + + ) : null} + {openLoginModal && ( + + )} + ); }; diff --git a/src/layouts/UserProfile/UserProfile.types.ts b/src/layouts/UserProfile/UserProfile.types.ts index 503cdc4..0955c76 100644 --- a/src/layouts/UserProfile/UserProfile.types.ts +++ b/src/layouts/UserProfile/UserProfile.types.ts @@ -1,4 +1,3 @@ -import { TagType } from '@local-types/data'; import { AchievementsTypes, BgAndCoverImagesTypes, @@ -10,7 +9,6 @@ import { } from '@local-types/uxcat-types/types'; export interface UserProfileProps { - tags: TagType[]; userInfo?: UserTypes; dummyBoardContent?: BoardContentTypes[]; coverImages?: BgAndCoverImagesTypes[]; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index e157690..edecc44 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -5,6 +5,8 @@ import { SessionProvider } from 'next-auth/react'; import dynamic from 'next/dynamic'; import mixpanel, { initMixpanel, trackPageView } from '../../lib/mixpanel'; +import Layout from '@layouts/Layout'; + import FormPopup from '@components/FormPopup'; import { GlobalContext } from '@components/Context/GlobalContext'; import Box from 'src/components/Box'; @@ -67,6 +69,8 @@ function App({ Component, pageProps: { session, ...pageProps } }: TApp) { const [isCookieStateLoaded, setIsCookieStateLoaded] = useState(false); const [isNewUpdateModalVisible, setIsNewUpdateModalVisible] = useState(false); const [showLoader, setShowLoader] = useState(false); + const [selectedTitle, setSelectedTitle] = useState(''); + const [updatedUsername, setUpdatedUsername] = useState(''); const [ourProjectsModalData, setOurProjectsModalData] = useState(null); const videoRef = useRef(null); const router = useRouter(); @@ -307,22 +311,38 @@ function App({ Component, pageProps: { session, ...pageProps } }: TApp) { }, [router.isReady, router.locale]); useEffect(() => { + if (!newUpdateModalData) return; + + const visibility = newUpdateModalData['Frontend modal visibility']; + if (visibility == null) return; + + if (visibility === false) { + setIsNewUpdateModalVisible(false); + document.cookie = `updateModalSeen=; path=/; max-age=0`; + return; + } + const hasSeen = document.cookie.includes('updateModalSeen=true'); if (hasSeen) return; - if (!newUpdateModalData?.showModal) return; + const appearsAfter = Number( + newUpdateModalData['Appears after x seconds'] ?? 0, + ); - const timeout = setTimeout(() => { + const timeout = window.setTimeout(() => { setIsNewUpdateModalVisible(true); - }, newUpdateModalData?.showAfter * 1000); + }, appearsAfter * 1000); - return () => clearTimeout(timeout); - }, [newUpdateModalData?.showModal, newUpdateModalData?.showAfter]); + return () => window.clearTimeout(timeout); + }, [newUpdateModalData]); + + const setUpdateModalSeen = () => { + document.cookie = `updateModalSeen=true; path=/; max-age=31536000`; + }; const handleCloseModal = () => { setIsNewUpdateModalVisible(false); - - document.cookie = 'updateModalSeen=true; path=/; max-age=31536000'; + setUpdateModalSeen(); }; useEffect(() => { @@ -401,9 +421,15 @@ function App({ Component, pageProps: { session, ...pageProps } }: TApp) { setShowLoader, videoRef, ourProjectsModalData, + selectedTitle, + setSelectedTitle, + updatedUsername, + setUpdatedUsername, }} > - + + + {feedbackEnabled && ( )} diff --git a/src/pages/user/[userId]/index.tsx b/src/pages/user/[userId]/index.tsx index 5d33dd0..f587f1c 100644 --- a/src/pages/user/[userId]/index.tsx +++ b/src/pages/user/[userId]/index.tsx @@ -9,7 +9,6 @@ import SeoGenerator from '@components/SeoGenerator'; import pageNotFoundData from '@data/404'; -import { getTags } from '@api/tags'; import { getBackgroundImages, getCoverImages } from '@api/strapi'; import { getPublicUserInfo } from '@api/uxcat/getUser'; import { getUserInfo } from '@api/uxcat/users-me'; @@ -30,7 +29,6 @@ import { findAchievementListBySubType, } from '@lib/uxcat-helpers'; -import { TagType } from '@local-types/data'; import { AchievementsTypes, BoardContentTypes, @@ -53,14 +51,12 @@ const achievementBoard: BoardContentTypes[] = [ }, ]; type UserIdProps = { - tags?: TagType[]; uxCatLevels: uxCatLevels[]; allAchievements: AchievementsTypes[]; killSwitcher: boolean; }; const UserId: FC = ({ - tags, uxCatLevels, allAchievements, killSwitcher, @@ -429,8 +425,6 @@ const UserId: FC = ({ ) : ( = ({ export default UserId; export async function getServerSideProps(context) { - const tags = getTags(); const achievementsEn = await getAllAchievements('en', 40); const achievementsRu = await getAllAchievements('ru', 40); @@ -481,7 +474,6 @@ export async function getServerSideProps(context) { return { props: { - tags, uxCatLevels, allAchievements, killSwitcher, diff --git a/src/pages/uxcat/index.tsx b/src/pages/uxcat/index.tsx index fa294a6..dc96ef3 100644 --- a/src/pages/uxcat/index.tsx +++ b/src/pages/uxcat/index.tsx @@ -201,7 +201,6 @@ const Uxcat: FC = ({ = ({ tags, configs, uxcatData }) => { const router = useRouter(); const { locale } = router as TRouter; const currentLocale = locale === 'ru' ? 'ru' : 'en'; - const { savedPersonasTitles } = decisionTable[locale]; - const { uxcatUserInfo, setUxcatUserInfo } = useContext(GlobalContext); const [userInfo, setUserInfo] = useState(null); const [test, setTest] = useState(null); const [accessToken, setAccessToken] = useState(null); - const [openPersonas, setOpenPersonas] = useState(false); - const [personas, setPersonas] = useState(null); const [pageLoading, setPageLoading] = useState(true); const [isFinalTest, setIsFinalTest] = useState(false); const [testLength, setTestLength] = useState(0); @@ -89,15 +80,6 @@ const Ongoing: FC = ({ tags, configs, uxcatData }) => { testDuration, ); - useEffect(() => { - const fetchData = async () => { - const result = await getPersonaList(); - setPersonas(result); - }; - - fetchData().then(r => r); - }, []); - useEffect(() => { const fetchUserData = async () => { if (accessToken) { @@ -179,14 +161,6 @@ const Ongoing: FC = ({ tags, configs, uxcatData }) => { modifiedDate={uxcatStrapiData?.updatedAt} createdDate={'2025-10-28'} /> -
= ({ tags, configs, uxcatData }) => {
)} - {openPersonas && ( - - )} ); }; diff --git a/src/pages/uxcat/start-test.tsx b/src/pages/uxcat/start-test.tsx index f1f501c..a69e977 100644 --- a/src/pages/uxcat/start-test.tsx +++ b/src/pages/uxcat/start-test.tsx @@ -8,16 +8,13 @@ import { UXCatDataTypes } from '@local-types/uxcat-types/types'; import StartTestLayout from '@layouts/StartTestLayout'; -import SavedPersonas from '@components/_uxcp/SavedPersonas'; import Spinner from '@components/Spinner'; import { GlobalContext } from '@components/Context/GlobalContext'; import SeoGenerator from '@components/SeoGenerator'; import GenderModal from '@components/GenderModal'; import startTestData from '@data/startTest'; -import decisionTable from '@data/decisionTable'; -import { getPersonaList } from '@api/personas'; import { getTags } from '@api/tags'; import { getUXCatData } from '@api/uxcat/uxcat'; import { getUXCatStatistics } from '@api/uxcat/statistics'; @@ -33,19 +30,15 @@ const StartTest: FC = ({ tags, uxcatData, uxcatConfigs }) => { const router = useRouter(); const { locale } = router as TRouter; const currentLocale = locale === 'ru' ? 'ru' : 'en'; - const { accountData, uxcatUserInfo, setUxcatUserInfo } = - useContext(GlobalContext); + const { accountData } = useContext(GlobalContext); - const { savedPersonasTitles } = decisionTable[locale]; const { description1, description2, goodLuckTxt, btnTxt } = startTestData[currentLocale]; const testDuration = '20:00'; - const [openPersonas, setOpenPersonas] = useState(false); const [isPageAccessed, setIsPageAccessed] = useState(false); const [accessToken, setAccessToken] = useState(null); const [statistics, setStatistics] = useState(null); - const [personas, setPersonas] = useState(null); const [openGenderModal, setOpenGenderModal] = useState(false); const forthTest = statistics?.totalTestCount >= 4; @@ -56,15 +49,6 @@ const StartTest: FC = ({ tags, uxcatData, uxcatConfigs }) => { router.push('/uxcat/ongoing'); }; - useEffect(() => { - const fetchData = async () => { - const result = await getPersonaList(); - setPersonas(result); - }; - - fetchData().then(r => console.log(r)); - }, []); - useEffect(() => { const fetchStatistics = async () => { if (!accessToken) return; @@ -113,8 +97,6 @@ const StartTest: FC = ({ tags, uxcatData, uxcatConfigs }) => { createdDate={'2025-10-28'} /> = ({ tags, uxcatData, uxcatConfigs }) => { goodLuckTxt={goodLuckTxt} btnTxt={btnTxt} disabled={uxcatConfigs.TestKillSwitcher} - userInfo={uxcatUserInfo} - setUserInfo={setUxcatUserInfo} /> )} - {openPersonas && ( - - )} {openGenderModal && ( = ({ - tags, uxCatLevels, uxcatStrapiData, achievements, @@ -72,7 +66,6 @@ const TestResult: FC = ({ const { locale } = router as TRouter; const { uxCoreData, uxcgData, accountData } = useContext(GlobalContext); const [userInfo, setUserInfo] = useState(null); - const [headerUserInfo, setHeaderUserInfo] = useState(null); const [randomQuestionsIds, setRandomQuestionsIds] = useState([]); const [accessToken, setAccessToken] = useState(null); const [testResult, setTestResults] = useState(null); @@ -83,8 +76,6 @@ const TestResult: FC = ({ const [notifiedAchievements, setNotifiedAchievements] = useState([]); const [levelsDetails, setLevelsDetails] = useState(null); const [nextTest, setNextTest] = useState(''); - const [openPersonas, setOpenPersonas] = useState(false); - const [personas, setPersonas] = useState(null); const [loading, setLoading] = useState(false); const [allowedToStart, setAllowedToStart] = useState(false); const [achievementLoading, setAchievementLoading] = useState(true); @@ -92,7 +83,6 @@ const TestResult: FC = ({ const [openCongratsModal, setOpenCongratsModal] = useState(false); const [achievementList, setAchievementsList] = useState([]); - const { savedPersonasTitles } = decisionTable[locale]; const { minutesTxtShort, hoursTxtShort, @@ -164,15 +154,6 @@ const TestResult: FC = ({ return () => clearInterval(interval); }, [nextTestTime, locale]); - useEffect(() => { - const fetchData = async () => { - const result = await getPersonaList(); - setPersonas(result); - }; - - fetchData().then(r => console.log(r)); - }, []); - useEffect(() => { const fetchAllAchievements = async () => { const achievements = testResult?.testSummary?.unlockedAchieves; @@ -234,7 +215,6 @@ const TestResult: FC = ({ try { const userData = await getUserInfo(); setUserInfo(userData); - setHeaderUserInfo(userData); const test = await getUXCatLastTest(accessToken); setTestResults(test); } catch (err) { @@ -414,15 +394,6 @@ const TestResult: FC = ({ modifiedDate={uxcatStrapiData?.updatedAt} createdDate={'2025-10-28'} /> - - {analyzingProgress ? ( = ({ killSwitcher={killSwitcher} /> )} - {openPersonas && ( - - )} {openCongratsModal && ( = ({ searchValue={searchValue} setSearchValue={setSearchValue} allQuestions={allQuestions} - blockLanguageSwitcher /> ); diff --git a/src/pages/uxcg/index.tsx b/src/pages/uxcg/index.tsx index 9209ee1..e12a1ca 100644 --- a/src/pages/uxcg/index.tsx +++ b/src/pages/uxcg/index.tsx @@ -1,4 +1,4 @@ -import React, { FC, useContext, useMemo, useState } from 'react'; +import React, { FC, useMemo, useState } from 'react'; import { GetStaticProps } from 'next'; import { useRouter } from 'next/router'; @@ -16,7 +16,6 @@ import UXCGLayout from '@layouts/UXCGLayout'; import SeoGenerator from '@components/SeoGenerator'; import Spinner from '@components/Spinner'; -import { GlobalContext } from '@components/Context/GlobalContext'; import { QuestionType, TagType } from '@local-types/data'; import { TRouter } from '@local-types/global'; @@ -36,9 +35,8 @@ const Index: FC = ({ }) => { const router = useRouter(); const [searchValue, setSearchValue] = useState(''); - const { uxcatUserInfo, setUxcatUserInfo } = useContext(GlobalContext); - const { asPath, locale } = router as TRouter; + const seoData = useMemo(() => { const seoLocale = locale === 'ru' ? 'ru' : 'en'; if (asPath === '/uxcg' || '/uxcg?searchTerm=') { @@ -61,8 +59,6 @@ const Index: FC = ({ allQuestions={allQuestions} searchValue={searchValue} setSearchValue={setSearchValue} - userInfo={uxcatUserInfo} - setUserInfo={setUxcatUserInfo} /> diff --git a/src/pages/uxcore-api/index.tsx b/src/pages/uxcore-api/index.tsx index 5a074a6..b61abae 100644 --- a/src/pages/uxcore-api/index.tsx +++ b/src/pages/uxcore-api/index.tsx @@ -1,28 +1,24 @@ -import { FC, Fragment, useContext, useMemo } from 'react'; +import { FC, Fragment, useMemo } from 'react'; import { useRouter } from 'next/router'; import { GetStaticProps } from 'next'; import ApiLayout from '@layouts/ApiLayout'; import SeoGenerator from '@components/SeoGenerator'; -import { GlobalContext } from '@components/Context/GlobalContext'; -import { getTags } from '@api/tags'; import { getUXCoreApiSeo } from '@api/mainPageSeo'; -import { TagType } from '@local-types/data'; import { TRouter } from '@local-types/global'; interface ApiProps { - tags: TagType[]; mainSeo: { en: any; ru: any }; } -const API: FC = ({ tags, mainSeo }) => { +const API: FC = ({ mainSeo }) => { const router = useRouter(); const { locale } = router as TRouter; - const { uxcatUserInfo, setUxcatUserInfo } = useContext(GlobalContext); const currentLocale = locale === 'ru' ? 'ru' : 'en'; + const seoData = useMemo( () => mainSeo[currentLocale], [mainSeo, currentLocale], @@ -36,19 +32,13 @@ const API: FC = ({ tags, mainSeo }) => { createdDate={'2023-05-15'} modifiedDate={'2023-05-15'} /> - + ); }; export const getStaticProps: GetStaticProps = async () => { - const tags = getTags(); - const mainSeo = await getUXCoreApiSeo(); - return { props: { tags, mainSeo } }; + return { props: { mainSeo } }; }; export default API; diff --git a/src/pages/uxcore/[slug].tsx b/src/pages/uxcore/[slug].tsx index 8af285a..1a4332a 100644 --- a/src/pages/uxcore/[slug].tsx +++ b/src/pages/uxcore/[slug].tsx @@ -199,7 +199,6 @@ const UXCoreIds: FC = ({ )} {biases[locale] ? ( import('@components/_uxcp/SavedPersonas'), { - ssr: false, -}); - interface UXCoreProps { biases: BiasType[]; - tags: TagType[]; seo: { en: any; ru: any }; } -const Index: FC = ({ tags, seo, biases }) => { +const Index: FC = ({ seo, biases }) => { const router = useRouter(); const { locale } = router as TRouter; const { uxcatUserInfo, setUxcatUserInfo } = useContext(GlobalContext); const [openPodcast, setOpenPodcast] = useState(false); - const [openPersonas, setOpenPersonas] = useState(false); - const [personas, setPersonas] = useState(null); const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); }, []); - const { savedPersonasTitles } = decisionTable[locale]; - - useEffect(() => { - const fetchData = async () => { - const result = await getPersonaList(); - setPersonas(result); - }; - - fetchData().then(r => r); - }, []); return ( <> @@ -64,36 +42,21 @@ const Index: FC = ({ tags, seo, biases }) => { mounted={mounted} userInfo={uxcatUserInfo} setUserInfo={setUxcatUserInfo} - tags={tags} strapiBiases={!!biases && biases?.[locale]} openPodcast={openPodcast} setOpenPodcast={setOpenPodcast} - setOpenPersonas={setOpenPersonas} - uxcatUserInfo={uxcatUserInfo} - setUxcatUserInfo={setUxcatUserInfo} /> - {openPersonas && ( - - )} ); }; export const getStaticProps: GetStaticProps = async ({ locale }) => { - const tags = getTags(); const biases = await getStrapiBiases(); const mainSeo = await getUXCoreSeo(locale as 'en' | 'ru' | 'hy'); return { props: { - tags, seo: mainSeo, biases: biases || null, }, diff --git a/src/pages/uxcp/index.tsx b/src/pages/uxcp/index.tsx index b076d98..9755ae2 100644 --- a/src/pages/uxcp/index.tsx +++ b/src/pages/uxcp/index.tsx @@ -1,4 +1,4 @@ -import React, { useMemo, FC, useContext } from 'react'; +import React, { useMemo, FC } from 'react'; import { GetStaticProps } from 'next'; import { useRouter } from 'next/router'; @@ -6,7 +6,6 @@ import UXCPLayout from '@layouts/UXCPLayout'; import SeoGenerator from '@components/SeoGenerator'; import Spinner from '@components/Spinner'; -import { GlobalContext } from '@components/Context/GlobalContext'; import { getStrapiQuestions } from '@api/questions'; import { getStrapiBiases } from '@api/biases'; @@ -25,7 +24,6 @@ interface UXCPProps { const Index: FC = ({ questions, strapiBiases, tags, seo }) => { const router = useRouter(); - const { uxcatUserInfo, setUxcatUserInfo } = useContext(GlobalContext); const { locale } = router as TRouter; const isRu = locale === 'ru'; const seoData = useMemo(() => seo[isRu ? 'ru' : 'en'], [seo, locale]); @@ -61,8 +59,6 @@ const Index: FC = ({ questions, strapiBiases, tags, seo }) => { allLangBiases={strapiBiases} tags={tags} biases={strapiBiasesData} - userInfo={uxcatUserInfo} - setUserInfo={setUxcatUserInfo} />