From 55a49baed7c2adc136573f4a7d8150b1a281eedc Mon Sep 17 00:00:00 2001 From: "Apple\\Apple" Date: Tue, 20 May 2025 01:22:01 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8feat(ui):=20Add=20control=20for=20the?= =?UTF-8?q?=20HeaderBar=20menu=20in=20the=20console=20routing=20under=20th?= =?UTF-8?q?e=20Sidebar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/HeaderBar.js | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/web/src/components/HeaderBar.js b/web/src/components/HeaderBar.js index 5bc84813..f6388959 100644 --- a/web/src/components/HeaderBar.js +++ b/web/src/components/HeaderBar.js @@ -1,5 +1,5 @@ import React, { useContext, useEffect, useState } from 'react'; -import { Link, useNavigate } from 'react-router-dom'; +import { Link, useNavigate, useLocation } from 'react-router-dom'; import { UserContext } from '../context/User'; import { useSetTheme, useTheme } from '../context/Theme'; import { useTranslation } from 'react-i18next'; @@ -40,6 +40,7 @@ const HeaderBar = () => { let navigate = useNavigate(); const [currentLang, setCurrentLang] = useState(i18n.language); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); + const location = useLocation(); const systemName = getSystemName(); const logo = getLogo(); @@ -337,6 +338,9 @@ const HeaderBar = () => { } }; + // 检查当前路由是否以/console开头 + const isConsoleRoute = location.pathname.startsWith('/console'); + return (
@@ -344,9 +348,25 @@ const HeaderBar = () => {