diff --git a/public/uxcore_/assets/project-icons/api-dark.png b/public/uxcore_/assets/project-icons/api-dark.png new file mode 100644 index 0000000..7f2205c Binary files /dev/null and b/public/uxcore_/assets/project-icons/api-dark.png differ diff --git a/public/uxcore_/assets/project-icons/api-light.png b/public/uxcore_/assets/project-icons/api-light.png new file mode 100644 index 0000000..48ac4b9 Binary files /dev/null and b/public/uxcore_/assets/project-icons/api-light.png differ diff --git a/public/uxcore_/assets/project-icons/github-dark.png b/public/uxcore_/assets/project-icons/github-dark.png new file mode 100644 index 0000000..94b49a1 Binary files /dev/null and b/public/uxcore_/assets/project-icons/github-dark.png differ diff --git a/public/uxcore_/assets/project-icons/github-light.png b/public/uxcore_/assets/project-icons/github-light.png new file mode 100644 index 0000000..3a574bf Binary files /dev/null and b/public/uxcore_/assets/project-icons/github-light.png differ diff --git a/public/uxcore_/assets/project-icons/open-link.png b/public/uxcore_/assets/project-icons/open-link.png new file mode 100644 index 0000000..94f1c0b Binary files /dev/null and b/public/uxcore_/assets/project-icons/open-link.png differ diff --git a/src/api/our-projects.ts b/src/api/our-projects.ts new file mode 100644 index 0000000..15872fc --- /dev/null +++ b/src/api/our-projects.ts @@ -0,0 +1,12 @@ +export const getOurProjects = async (locale: string) => { + const url = `${process.env.NEXT_PUBLIC_STRAPI}/api/our-project?locale=${locale}&pagination[pageSize]=100 + &populate[aboutProject][populate]=* + &populate[github][populate]=* + &populate[api][populate]=*`; + + return await fetch(url, { + method: 'GET', + }) + .then(data => data.json()) + .then(data => data?.data?.attributes); +}; diff --git a/src/components/Modal/Modal.module.scss b/src/components/Modal/Modal.module.scss index 0b7e2f5..ceda65d 100644 --- a/src/components/Modal/Modal.module.scss +++ b/src/components/Modal/Modal.module.scss @@ -178,5 +178,13 @@ .fullSizeMobile { max-width: unset; } + + .fullHeightMobile { + max-height: unset; + max-width: unset; + width: 100vw; + height: 100vh; + margin: unset; + } } } diff --git a/src/components/Modal/Modal.tsx b/src/components/Modal/Modal.tsx index 1a4606d..ae66e6b 100644 --- a/src/components/Modal/Modal.tsx +++ b/src/components/Modal/Modal.tsx @@ -19,6 +19,7 @@ type ModalProps = { bodyClassName?: string; wrapperClassName?: string; fullSizeMobile?: boolean; + fullHeightMobile?: boolean; removeBorderMobile?: boolean; disableBackgroundClick?: boolean; disableClose?: boolean; @@ -46,6 +47,7 @@ const Modal: FC = ({ disableClose, grayTitle, dataCy, + fullHeightMobile, }) => { const handleClose = () => { onClick(); @@ -103,6 +105,7 @@ const Modal: FC = ({ [styles.bobModal]: size === 'bob-modal', [wrapperClassName]: wrapperClassName, [styles.fullSizeMobile]: fullSizeMobile, + [styles.fullHeightMobile]: fullHeightMobile, })} > {!removeHeader && ( diff --git a/src/components/OurProjectsModal/OurProjectsModal.module.scss b/src/components/OurProjectsModal/OurProjectsModal.module.scss new file mode 100644 index 0000000..8941583 --- /dev/null +++ b/src/components/OurProjectsModal/OurProjectsModal.module.scss @@ -0,0 +1,59 @@ +.projectInfo { + display: flex; + gap: 6px; + align-items: center; + + .name { + font-size: 16px; + color: #000000d9; + text-decoration: underline dotted; + text-underline-offset: 5px; + display: flex; + gap: 6px; + align-items: center; + } +} + +.linksWrapper { + display: flex; + gap: 16px; + padding-bottom: 40px; + padding-top: 20px; +} + +.buttonStyleLink { + background-color: unset; + border: 1px solid #000000; + width: 100%; + padding: 4px 0; + display: flex; + justify-content: center; + align-items: center; + cursor: pointer; + transition: 0.2s; + gap: 6px; + color: #000000d9; + font-size: 16px; + text-decoration: none; + + &:hover { + background-color: #000000; + color: #ffffff; + + .darkIcon { + display: none; + } + + .lightIcon { + display: inline-block; + } + } + + .lightIcon { + display: none; + } +} + +.doneBtn { + text-align: right; +} diff --git a/src/components/OurProjectsModal/OurProjectsModal.tsx b/src/components/OurProjectsModal/OurProjectsModal.tsx new file mode 100644 index 0000000..8c18c60 --- /dev/null +++ b/src/components/OurProjectsModal/OurProjectsModal.tsx @@ -0,0 +1,125 @@ +import React, { FC } from 'react'; +import Image from 'next/image'; +import Link from 'next/link'; + +import Modal from '@components/Modal'; +import Button from '@components/Button'; + +import type { OurProjectsModalProps } from './OurProjectsModal.types'; + +import styles from './OurProjectsModal.module.scss'; + +const OurProjectsModal: FC = ({ + onClose, + title, + projects, + github, + api, +}) => { + return ( + + {projects && + projects.map((project: any, index: number) => { + return ( +
+
+ {project.name} + + {project.name} + {''} + +
+
+
+
+ ); + })} +
+
+ + {'GitHubIcon'} + {'GitHubIcon'} + + {github[0]?.linkName} + + + {'GitHubIcon'} + {'GitHubIcon'} + {api[0]?.linkName} + +
+ +
+
+ + ); +}; + +export default OurProjectsModal; diff --git a/src/components/OurProjectsModal/OurProjectsModal.types.ts b/src/components/OurProjectsModal/OurProjectsModal.types.ts new file mode 100644 index 0000000..2dfd9f5 --- /dev/null +++ b/src/components/OurProjectsModal/OurProjectsModal.types.ts @@ -0,0 +1,25 @@ +export type OurProjectsModalProps = { + title: string; + onClose: () => void; + projects?: { + name: string; + link: string; + description: string; + image: { + data: { + attributes: { + url: string; + }; + }; + }; + }[]; + api: { + link: string; + linkName: string; + }; + github: { + link: string; + linkName: string; + }; + doneTxt?: string; +}; diff --git a/src/components/OurProjectsModal/index.ts b/src/components/OurProjectsModal/index.ts new file mode 100644 index 0000000..b9061e3 --- /dev/null +++ b/src/components/OurProjectsModal/index.ts @@ -0,0 +1,3 @@ +import OurProjectsModal from './OurProjectsModal'; + +export default OurProjectsModal; diff --git a/src/components/PageSwitcher/PageSwitcher.module.scss b/src/components/PageSwitcher/PageSwitcher.module.scss index 9a2f472..9a365d9 100644 --- a/src/components/PageSwitcher/PageSwitcher.module.scss +++ b/src/components/PageSwitcher/PageSwitcher.module.scss @@ -20,6 +20,7 @@ $active-color: #359eff; &:link { text-decoration: none; } + .bob { opacity: 85%; width: 23px !important; @@ -29,6 +30,7 @@ $active-color: #359eff; opacity: 100%; } } + & svg, .bob { width: 18px; @@ -61,8 +63,9 @@ $active-color: #359eff; grid-template-columns: auto auto; gap: 6px; width: 100%; - margin-bottom: 16px; + margin-bottom: 6px; } + .GridWrapper > .Button:nth-child(5) { grid-column: 1 / -1; } diff --git a/src/components/ToolHeader/ToolHeader.module.scss b/src/components/ToolHeader/ToolHeader.module.scss index 80b13f2..55fe6fa 100644 --- a/src/components/ToolHeader/ToolHeader.module.scss +++ b/src/components/ToolHeader/ToolHeader.module.scss @@ -348,6 +348,19 @@ $headerHeight: 46px; & .PageSwitcherContainer { padding: 16px 16px 0; + .PageSwitcherItem { + box-sizing: border-box; + width: -webkit-fill-available; + height: 40px; + border: 1px solid #c4c4c4; + border-radius: 4px; + display: flex; + align-items: center; + padding-left: 10px; + cursor: default; + margin-right: 5px; + gap: 8px; + } } } } diff --git a/src/components/ToolHeader/ToolHeader.tsx b/src/components/ToolHeader/ToolHeader.tsx index 0e64c5b..fd934eb 100644 --- a/src/components/ToolHeader/ToolHeader.tsx +++ b/src/components/ToolHeader/ToolHeader.tsx @@ -11,7 +11,6 @@ import Image from 'next/image'; import cn from 'classnames'; import dynamic from 'next/dynamic'; -import type { TagType } from '@local-types/data'; import type { TRouter } from '@local-types/global'; import { UserTypes } from '@local-types/uxcat-types/types'; @@ -19,9 +18,8 @@ import Link from '@components/NextLink'; import PageSwitcher from '@components/PageSwitcher'; import UserDropdown from '@components/UserDropdown'; import MobileHeader from '@components/_biases/MobileHeader'; -import UsfulLinksDropdown from '@components/UsfulLinksDropdown'; -import UsefulLinksContent from '@components/UsefulLinksContent'; import { GlobalContext } from '@components/Context/GlobalContext'; +import OurProjectsModal from '@components/OurProjectsModal'; import LanguageSwitcher from '@components/LanguageSwitcher'; import { navItems } from './navItems'; @@ -50,7 +48,6 @@ const SettingsModal = dynamic(() => import('@components/SettingsModal'), { type TToolHeader = { page?: 'uxcp' | 'uxcg' | 'uxcore' | 'uxeducation' | 'uxcat'; homepageLinkTarget?: '_blank' | '_self'; - tags: TagType[]; openPodcast?: boolean; showSavedPersonas?: boolean; setOpenPodcast?: (updater: (prev: boolean) => boolean) => void; @@ -62,13 +59,13 @@ 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, - tags, setOpenPodcast, openPersonaModal, showSavedPersonas = true, @@ -83,11 +80,12 @@ const ToolHeader: FC = ({ const router = useRouter(); const { isMobile } = useMobile()[1]; const [, { isCoreView }] = useUXCoreGlobals(); - const { accountData, setAccountData } = useContext(GlobalContext); + const { accountData, setAccountData, ourProjectsModalData } = + useContext(GlobalContext); const { locale, asPath } = router as TRouter; const { - usefulLinksLabel, + ourProjects, usernameIsTaken, settingsTxt, myProfileTxt, @@ -96,20 +94,19 @@ const ToolHeader: FC = ({ podcast, findSolutions, learnAboutUXCore, + 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 - : accountData?.username; - + const currentUsername = !!accountData && accountData.username; const currentEmail = accountData && accountData.email; const publicEmail = accountData && accountData.publicEmail; @@ -234,8 +231,16 @@ const ToolHeader: FC = ({ /> {!disablePageSwitcher && (
- + + + setOpenOurProjects(true)} + > + {ourProjects} + +
)}
@@ -358,10 +363,10 @@ const ToolHeader: FC = ({ className={cn(styles.MenuItem, { [styles.MenuItemHy]: locale === 'hy', })} + onClick={() => setOpenOurProjects(true)} > - {usefulLinksLabel} - + {ourProjects}
= ({ setChangedTitle={setChangedTitle} /> )} + {openOurProjects && ( + setOpenOurProjects(false)} + github={!!ourProjectsModalData && ourProjectsModalData.github} + api={!!ourProjectsModalData && ourProjectsModalData.api} + doneTxt={done} + /> + )} ); diff --git a/src/components/UsfulLinksDropdown/UsfulLinksDropdown.module.scss b/src/components/UsfulLinksDropdown/UsfulLinksDropdown.module.scss deleted file mode 100644 index 9b156a8..0000000 --- a/src/components/UsfulLinksDropdown/UsfulLinksDropdown.module.scss +++ /dev/null @@ -1,66 +0,0 @@ -.UsefulLinksDropdown { - position: relative; - height: 40px; - border: 1px solid #c4c4c4; - box-sizing: border-box; - border-radius: 4px; - margin-bottom: 24px; - padding: 0 10px; - background-color: #fff; - z-index: 4; - - .Title { - display: flex; - align-items: center; - height: 100%; - - > svg { - &:nth-child(1) { - margin-right: 10px; - } - - &:nth-child(3) { - transition: 0.2s; - } - } - - > span { - width: 100%; - } - - + div { - display: none; - top: calc(100% + 4px); - width: 100%; - z-index: 4; - } - } -} - -.Opened { - border-color: #5b88bd; - - .Title { - > svg { - &:nth-child(1) > path { - fill: #5b88bd; - } - - &:nth-child(3) { - transform: rotate(180deg); - - > path { - stroke: #5b88bd; - } - } - } - - > span { - color: #5b88bd; - } - - & + div { - display: block; - } - } -} diff --git a/src/components/UsfulLinksDropdown/UsfulLinksDropdown.tsx b/src/components/UsfulLinksDropdown/UsfulLinksDropdown.tsx deleted file mode 100644 index 791c97e..0000000 --- a/src/components/UsfulLinksDropdown/UsfulLinksDropdown.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import { FC, useCallback, useState } from 'react'; -import cn from 'classnames'; -import { useRouter } from 'next/router'; -import dynamic from 'next/dynamic'; - -import toolHeaderData from '@data/toolHeader'; - -import type { TRouter } from '@local-types/global'; -import type { TagType } from '@local-types/data'; - -const UsefulLinksContent = dynamic(() => import('../UsefulLinksContent'), { - ssr: false, -}); - -import DiamondIcon from '@icons/DiamondIcon'; -import CaretDownIcon from '@icons/CaretDownIcon'; - -import styles from './UsfulLinksDropdown.module.scss'; - -type UsfulLinksDropdownProps = { - page: 'uxcp' | 'uxcg' | 'uxcore' | 'uxeducation' | 'uxcat'; - tags: TagType[]; -}; - -const UsfulLinksDropdown: FC = ({ tags, page }) => { - const router = useRouter(); - const [isOpened, setIsOpened] = useState(false); - const { locale } = router as TRouter; - const { usefulLinksLabel } = toolHeaderData[locale]; - - const toggleDropdown = useCallback(() => { - setIsOpened(prevState => !prevState); - }, []); - - return ( -
-
- - {usefulLinksLabel} - -
- -
- ); -}; - -export default UsfulLinksDropdown; diff --git a/src/components/UsfulLinksDropdown/index.ts b/src/components/UsfulLinksDropdown/index.ts deleted file mode 100644 index ec932d1..0000000 --- a/src/components/UsfulLinksDropdown/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -import UsfulLinksDropdown from './UsfulLinksDropdown'; - -export default UsfulLinksDropdown; diff --git a/src/components/_biases/MobileView/MobileView.module.scss b/src/components/_biases/MobileView/MobileView.module.scss index 70f5701..a7c0f08 100644 --- a/src/components/_biases/MobileView/MobileView.module.scss +++ b/src/components/_biases/MobileView/MobileView.module.scss @@ -127,6 +127,20 @@ :nth-child(10) { margin: -16px -16px 0; } + + .OurProjectsLabel { + box-sizing: border-box; + width: -webkit-fill-available; + height: 40px; + border: 1px solid #c4c4c4; + border-radius: 4px; + display: flex; + align-items: center; + padding-left: 10px; + cursor: default; + margin-right: 5px; + gap: 8px; + } } .MobileLegendBlock { diff --git a/src/components/_biases/MobileView/MobileView.tsx b/src/components/_biases/MobileView/MobileView.tsx index 5a789e6..f67d297 100644 --- a/src/components/_biases/MobileView/MobileView.tsx +++ b/src/components/_biases/MobileView/MobileView.tsx @@ -3,6 +3,7 @@ import React, { Fragment, memo, useCallback, + useContext, useEffect, useRef, useState, @@ -19,21 +20,26 @@ import { UserTypes } from '@local-types/uxcat-types/types'; import { groupFilteredData } from '@lib/helpers'; +import toolHeaderData from '@data/toolHeader'; import biasesMetadata from '@data/biases'; import biasesCategories from '@data/biasesCategories'; + import useBiasSearch from '@hooks/useBiasSearch'; + import PageSwitcher from '@components/PageSwitcher'; import MobileHeader from '@components/_biases/MobileHeader'; import Search from '../Search'; -import UsfulLinksDropdown from '@components/UsfulLinksDropdown'; import Logos from '@components/Logos'; +import OurProjectsModal from '@components/OurProjectsModal'; -import { PMIcon } from '@icons/PMIcon'; import { PMIconGrey } from '@icons/PMIconGrey'; import { HRIconGrey } from '@icons/HRIconGrey'; import { HRIconBlue } from '@icons/HRIconBlue'; +import DiamondIcon from '@icons/DiamondIcon'; +import { PMIcon } from '@icons/PMIcon'; import styles from './MobileView.module.scss'; +import { GlobalContext } from '@components/Context/GlobalContext'; const ViewSwitcher = dynamic(() => import('@components/_biases/ViewSwitcher'), { ssr: false, @@ -87,9 +93,12 @@ const MobileView: FC = ({ const activeStickyElementIndexRef = useRef(0); const stickyElementHeight = 45; const [content, setContent] = useState([]); + const [openOurProjects, setOpenOurProjects] = useState(false); const router = useRouter(); const { locale } = router as TRouter; const { explanationLink } = biasesMetadata[locale]; + const { ourProjects, done } = toolHeaderData[locale]; + const { ourProjectsModalData } = useContext(GlobalContext); const [mobileScrollPosition, setMobileScrollPosition] = useState(0); function getStickyElements() { @@ -262,9 +271,15 @@ const MobileView: FC = ({ blockLanguageSwitcher={blockLanguageSwitcher} />
-
- +
setOpenOurProjects(true)} + > +
+ + {ourProjects} +

UX CORE

uxcore.io

{description}

@@ -352,6 +367,18 @@ const MobileView: FC = ({ ); })} + {openOurProjects && ( + setOpenOurProjects(false)} + github={!!ourProjectsModalData && ourProjectsModalData.github} + api={!!ourProjectsModalData && ourProjectsModalData.api} + doneTxt={done} + /> + )} ); }; diff --git a/src/components/_biases/UXCoreLines/UXCoreLines.tsx b/src/components/_biases/UXCoreLines/UXCoreLines.tsx index 660d104..304742f 100644 --- a/src/components/_biases/UXCoreLines/UXCoreLines.tsx +++ b/src/components/_biases/UXCoreLines/UXCoreLines.tsx @@ -42,6 +42,7 @@ const UXCoreLines: FC = ({ }; const activePaths = PATH_MAP[pathName] || defaultPaths; const svgHeightRes = pathName === 'third' ? 350 : 325; + useEffect(() => { const geoms = activePaths.map((d, index) => { if ( diff --git a/src/data/toolHeader/en.ts b/src/data/toolHeader/en.ts index 9e387b6..17e3b55 100644 --- a/src/data/toolHeader/en.ts +++ b/src/data/toolHeader/en.ts @@ -1,5 +1,5 @@ const en = { - usefulLinksLabel: 'Useful Links', + ourProjects: 'Our Projects', usernameIsTaken: 'Username is already taken. Please try another one.', settingsTxt: 'Settings', myProfileTxt: 'My Profile', @@ -8,6 +8,7 @@ const en = { findSolutions: 'Find solutions for your problems', learnAboutUXCore: 'Learn human thinking patterns', podcast: 'Podcast', + done: 'Done', usefulLinks: [ { title: '', diff --git a/src/data/toolHeader/hy.ts b/src/data/toolHeader/hy.ts index 951644f..8483ce0 100644 --- a/src/data/toolHeader/hy.ts +++ b/src/data/toolHeader/hy.ts @@ -1,5 +1,5 @@ const hy = { - usefulLinksLabel: 'Օգտակար հղումներ', + ourProjects: 'Մեր նախագծերը', usernameIsTaken: 'Username is already taken. Please try another one.', settingsTxt: 'Կարգավորումներ', myProfileTxt: ' Իմ պրոֆիլը', @@ -8,6 +8,7 @@ const hy = { findSolutions: 'Գտեք ձեր խնդիրների լուծումները', learnAboutUXCore: 'Սովորել մարդու մտածողության օրինաչափությունները', podcast: 'Պոդկաստ', + done: 'Done', usefulLinks: [ { title: '', diff --git a/src/data/toolHeader/index.ts b/src/data/toolHeader/index.ts index a3942f7..4a6917f 100644 --- a/src/data/toolHeader/index.ts +++ b/src/data/toolHeader/index.ts @@ -17,7 +17,7 @@ interface TUsefulLinks { } interface TToolHeaderData { - usefulLinksLabel: string; + ourProjects: string; usernameIsTaken: string; settingsTxt: string; myProfileTxt: string; @@ -25,6 +25,7 @@ interface TToolHeaderData { awarenessTest: string; usefulLinks: TUsefulLinks[]; podcast: string; + done: string; findSolutions: string; learnAboutUXCore: string; } diff --git a/src/data/toolHeader/ru.ts b/src/data/toolHeader/ru.ts index 5060ee3..f455905 100644 --- a/src/data/toolHeader/ru.ts +++ b/src/data/toolHeader/ru.ts @@ -1,5 +1,5 @@ const ru = { - usefulLinksLabel: 'Ссылки', + ourProjects: 'Наши проекты', usernameIsTaken: 'Имя пользователя занято', settingsTxt: 'Настройки', myProfileTxt: 'Мой профиль', @@ -8,6 +8,7 @@ const ru = { findSolutions: 'Находим решения ваших проблем', learnAboutUXCore: 'зучаем паттерны мышления', podcast: 'Подкаст', + done: 'Готово', usefulLinks: [ { title: '', diff --git a/src/local-types/data.ts b/src/local-types/data.ts index 906524a..f71b674 100644 --- a/src/local-types/data.ts +++ b/src/local-types/data.ts @@ -1,34 +1,3 @@ -export type TLocales = 'en' | 'ru' | 'hy'; - -export type TStaticProps = { params: any; locale: TLocales }; - -export type TNavbarSubmenuItems = { - label?: string; - prefix?: string; - title?: string; - href?: string; - target?: '_blank' | '_self'; - icon?: string; - answers?: { - description: string; - items?: string[]; - }; -}; -export type TNavbarManagementTools = { - title: string; - href?: string; - submenuItems?: TNavbarSubmenuItems[]; -}; - -export type TNavbarDataItem = { - title: string; - href?: string; - target?: string; - icon?: string; - submenuItems?: TNavbarSubmenuItems[]; - tools?: TNavbarManagementTools[]; -}; - export interface TitlesType { en: string; ru: string; @@ -174,64 +143,3 @@ export type SuggestedQuestionType = QuestionType & { relevancyTitle: 'high' | 'medium' | 'low'; percentOfAppearing: number; }; - -export type TArticle = { - id: number; - headline?: string; - OGTags: { - ogDescription: string; - ogTitle: string; - ogType: string; - ogImageAlt?: string; - ogImage?: { - data: { - attributes: { - url: string; - }; - }; - }; - }; - attributes: { - content: string; - createdAt: string; - description: string; - locale: string; - publishedAt: string; - sequence_number: number; - title: string; - updatedAt: string; - url: string; - newUrl: string; - category: any; - seoDescription?: string; - seoTitle?: string; - keywords?: string; - pageTitle?: string; - }; - - seoDescription?: string; - seoTitle?: string; - keywords?: string; - pageTitle?: string; - profile_image: any; -}; - -export type THomePage = { - content?: string; - createdAt: string; - headline: string; - locale: string; - localizations: any; - profile_image?: any; - publishedAt: string; - updatedAt: string; - seoDescription?: string; - seoTitle?: string; - keywords?: string; - pageTitle?: string; -}; - -export type TPaths = { - params: { page: string }; - locale: string; -}; diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 5a4b77a..e157690 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -22,6 +22,7 @@ import { getStrapiQuestions } from '@api/questions'; import { getUserInfo } from '@api/uxcat/users-me'; import { authenticate } from '@api/auth'; import { getNewUpdate } from '@api/new-updates'; +import { getOurProjects } from '@api/our-projects'; import { mergeQuestionsLocalization } from '@lib/helpers'; @@ -66,7 +67,7 @@ function App({ Component, pageProps: { session, ...pageProps } }: TApp) { const [isCookieStateLoaded, setIsCookieStateLoaded] = useState(false); const [isNewUpdateModalVisible, setIsNewUpdateModalVisible] = useState(false); const [showLoader, setShowLoader] = useState(false); - + const [ourProjectsModalData, setOurProjectsModalData] = useState(null); const videoRef = useRef(null); const router = useRouter(); const loadingTimer = useRef(null); @@ -272,19 +273,38 @@ function App({ Component, pageProps: { session, ...pageProps } }: TApp) { }, []); useEffect(() => { + if (!router.isReady) return; + const getData = async () => { try { - const locale = router.locale === '' ? 'en' : 'ru'; + const locale = router.locale === 'ru' ? 'ru' : 'en'; const data = await getNewUpdate(locale); - if (data) { - setNewUpdateModalData(data); - } + + if (data) setNewUpdateModalData(data); } catch (error) { console.error('Error fetching new update data:', error); } }; + getData(); - }, []); + }, [router.isReady, router.locale]); + + useEffect(() => { + if (!router.isReady) return; + + const getData = async () => { + try { + const locale = router.locale === 'ru' ? 'ru' : 'en'; + const data = await getOurProjects(locale); + + if (data) setOurProjectsModalData(data); + } catch (error) { + console.error('Error fetching new update data:', error); + } + }; + + getData(); + }, [router.isReady, router.locale]); useEffect(() => { const hasSeen = document.cookie.includes('updateModalSeen=true'); @@ -380,6 +400,7 @@ function App({ Component, pageProps: { session, ...pageProps } }: TApp) { showLoader, setShowLoader, videoRef, + ourProjectsModalData, }} >