| 18 | }; |
| 19 | |
| 20 | export const Header: React.FC = () => { |
| 21 | const { |
| 22 | user, |
| 23 | theme, |
| 24 | currentView, |
| 25 | headerMenuConfig, |
| 26 | setTheme, |
| 27 | setCurrentView, |
| 28 | logout, |
| 29 | language, |
| 30 | } = useAppStore(); |
| 31 | |
| 32 | const { confirm } = useDialog(); |
| 33 | |
| 34 | const [mobileMenuOpen, setMobileMenuOpen] = useState(false); |
| 35 | |
| 36 | const visibleMenus = useMemo(() => |
| 37 | [...headerMenuConfig] |
| 38 | .filter(item => item.visible) |
| 39 | .sort((a, b) => a.order - b.order), |
| 40 | [headerMenuConfig] |
| 41 | ); |
| 42 | |
| 43 | const t = (zh: string, en: string) => language === 'zh' ? zh : en; |
| 44 | |
| 45 | return ( |
| 46 | <header className="bg-light-bg dark:bg-panel-dark border-b border-black/[0.06] dark:border-white/[0.04] sticky top-0 z-50 hd-drag lg:hd-drag relative"> |
| 47 | <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8"> |
| 48 | <div className="flex items-center justify-between h-14 sm:h-16"> |
| 49 | {/* Logo and Title */} |
| 50 | <div className="flex min-w-0 items-center space-x-3"> |
| 51 | <div className="flex items-center justify-center w-10 h-10 rounded-lg overflow-hidden flex-shrink-0"> |
| 52 | <img |
| 53 | src="./icon.png" |
| 54 | alt="GitHub Stars Manager" |
| 55 | className="w-10 h-10 object-cover" |
| 56 | /> |
| 57 | </div> |
| 58 | <div className="min-w-0 hidden sm:block"> |
| 59 | <h1 className="truncate text-xl font-medium text-gray-900 dark:text-text-primary tracking-tight"> |
| 60 | GitHub Stars Manager |
| 61 | </h1> |
| 62 | <p className="truncate text-sm text-gray-500 dark:text-text-tertiary"> |
| 63 | AI-powered repository management |
| 64 | </p> |
| 65 | </div> |
| 66 | <div className="min-w-0 sm:hidden"> |
| 67 | <h1 className="truncate text-base font-bold text-gray-900 dark:text-text-primary tracking-tight"> |
| 68 | GitHub Stars |
| 69 | </h1> |
| 70 | </div> |
| 71 | </div> |
| 72 | |
| 73 | {/* Navigation - Desktop & Tablet (≥768px) */} |
| 74 | <nav className="hidden md:flex flex-nowrap items-center space-x-1 hd-btns lg:hd-btns"> |
| 75 | {visibleMenus.map(menuItem => { |
| 76 | const meta = MENU_META[menuItem.id]; |
| 77 | const Icon = meta.icon; |