/* Copyright (C) 2025 QuantumNous This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . For commercial licensing, please contact support@quantumnous.com */ import React from 'react'; import { useLocation } from 'react-router-dom'; import { isAuthPagePath } from '../../../helpers'; import { useHeaderBar } from '../../../hooks/common/useHeaderBar'; import { useNotifications } from '../../../hooks/common/useNotifications'; import { useNavigation } from '../../../hooks/common/useNavigation'; import NoticeModal from '../NoticeModal'; import MobileMenuButton from './MobileMenuButton'; import HeaderLogo from './HeaderLogo'; import Navigation from './Navigation'; import MobileNavMenu from './MobileNavMenu'; import ActionButtons from './ActionButtons'; const HeaderBar = ({ onMobileMenuToggle, drawerOpen }) => { const location = useLocation(); // 认证页(登录/注册/企业登录等)顶栏按行业惯例最小化: // 隐藏主导航与需登录态的操作按钮,只保留 logo + 主题切换等基础工具 const isAuthPage = isAuthPagePath(location.pathname); const { userState, statusState, isMobile, collapsed, logoLoaded, currentLang, isLoading, systemName, logo, isNewYear, isSelfUseMode, docsLink, isDemoSiteMode, isConsoleRoute, theme, headerNavModules, sidebarModulesAdmin, showOrgEntry, orgEntryPath, isOrgUser, logout, handleLanguageChange, handleThemeToggle, handleMobileMenuToggle, navigate, t, } = useHeaderBar({ onMobileMenuToggle, drawerOpen }); const { noticeVisible, unreadCount, handleNoticeOpen, handleNoticeClose, getUnreadKeys, } = useNotifications(statusState); const userRole = userState?.user?.role || 0; const userGroup = userState?.user?.group || 'default'; const { mainNavLinks: configuredNavLinks } = useNavigation( t, docsLink, headerNavModules, userRole, userGroup, { showOrgEntry, orgEntryPath }, ); const mainNavLinks = configuredNavLinks.filter( (link) => link.itemKey !== 'keyManagement', ); return (
{/* ===== BACKGROUND LAYERS ===== */} {/* Main gradient background with glassmorphism */}
{/* Animated gradient accent - top edge */}
{/* Subtle animated gradient orbs */}
{/* Bottom border with gradient */}
{/* Subtle shimmer effect */}
{/* ===== CONTENT ===== */} 0 ? 'system' : 'inApp'} unreadKeys={getUnreadKeys()} />
{/* 高度断点必须用 md(768) 而非 sm(640):PageLayout 的 headerBarHeight 按 MOBILE_BREAKPOINT=768 算 56/64,用 sm 会让 640~767px 区间实际 64px、 而侧栏 top、抽屉遮罩 top 全按 56px 定位,差 8px。 */}
{/* 移动端:主导航收进下拉菜单,避免与右侧操作区互相挤压 */} {!isAuthPage && isMobile && (!isLoading || mainNavLinks.length > 0) && ( )}
{!isAuthPage && !isMobile && ( )}
{/* CSS for shimmer animation */}
); }; export default HeaderBar;