From b842b816390291d3ec0a0043954e43c615fa3573 Mon Sep 17 00:00:00 2001 From: MaryWylde Date: Tue, 23 Dec 2025 19:09:12 +0400 Subject: [PATCH] chore: change the default state of activePage --- src/components/PageSwitcher/PageSwitcher.tsx | 2 +- src/components/ToolHeader/ToolHeader.tsx | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/PageSwitcher/PageSwitcher.tsx b/src/components/PageSwitcher/PageSwitcher.tsx index 5ff9003..0f460f3 100644 --- a/src/components/PageSwitcher/PageSwitcher.tsx +++ b/src/components/PageSwitcher/PageSwitcher.tsx @@ -14,7 +14,7 @@ import UXCoreIcon from '@icons/UXCoreIcon'; import styles from './PageSwitcher.module.scss'; type TPageSwitcher = { - page?: 'uxcore' | 'uxcg' | 'uxcp' | 'uxeducation' | 'uxcat'; + page?: string; }; const PageSwitcher: FC = ({ page }) => { diff --git a/src/components/ToolHeader/ToolHeader.tsx b/src/components/ToolHeader/ToolHeader.tsx index 62186d2..92e5d35 100644 --- a/src/components/ToolHeader/ToolHeader.tsx +++ b/src/components/ToolHeader/ToolHeader.tsx @@ -46,8 +46,6 @@ const SettingsModal = dynamic(() => import('@components/SettingsModal'), { ssr: false, }); -type ActivePage = 'uxcore' | 'uxcg' | 'uxcp' | 'uxcat' | null; - type TToolHeader = { homepageLinkTarget?: '_blank' | '_self'; openPodcast?: boolean; @@ -100,7 +98,7 @@ const ToolHeader: FC = ({ const [token, setToken] = useState(null); const [usernameIsTakenError, setUsernameIsTakenError] = useState(''); const [changedTitle, setChangedTitle] = useState(false); - const [activePage, setActivePage] = useState(null); + const [activePage, setActivePage] = useState(router.asPath); const { ourProjects, @@ -145,7 +143,7 @@ const ToolHeader: FC = ({ const title = changedTitle ? userInfo?.title : userInfo?.user?.title; const normalizePath = (p: string) => p.replace(/\/+$/, '') || '/'; - const getActiveFromPath = (pathname: string): ActivePage => { + const getActiveFromPath = (pathname: string) => { const path = normalizePath(pathname); const pathWithBypass = /^\/uxcp$/i.test(path) ? '/uxcp/' : path;