From b7977b136707359298e03e51970cd9105be10a82 Mon Sep 17 00:00:00 2001 From: haitaoo Date: Wed, 29 Mar 2023 17:47:49 +0800 Subject: [PATCH] fix(admin): The page under the root path can get the correct width --- ui/src/pages/Admin/index.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/src/pages/Admin/index.tsx b/ui/src/pages/Admin/index.tsx index 8e59bbda..73cf1e6a 100644 --- a/ui/src/pages/Admin/index.tsx +++ b/ui/src/pages/Admin/index.tsx @@ -1,7 +1,7 @@ import { FC, useEffect } from 'react'; import { Container, Row, Col } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; -import { Outlet, useLocation } from 'react-router-dom'; +import { Outlet, useMatch } from 'react-router-dom'; import { cloneDeep } from 'lodash'; @@ -23,7 +23,9 @@ const g10Paths = [ ]; const Index: FC = () => { const { t } = useTranslation('translation', { keyPrefix: 'page_title' }); - const { pathname } = useLocation(); + const pathMatch = useMatch('/admin/:path'); + const curPath = pathMatch?.params.path || 'dashboard'; + const interfaceLang = interfaceStore((_) => _.interface.language); const { data: configurablePlugins, mutate: updateConfigurablePlugins } = useQueryPlugins({ @@ -78,7 +80,7 @@ const Index: FC = () => { - pathname.includes(v)) ? 10 : 6}> + curPath.includes(v)) ? 10 : 6}>