import React, { useState, useEffect } from "react"; import { Activity, Database, Terminal, FileText, ShieldCheck, Settings, User as UserIcon, LogOut, Menu, X, Globe, Radio } from "lucide-react"; import { auth, signOut, onAuthStateChanged, User } from "../config/firebase.js"; import { useLanguage } from "../context/LanguageContext.js"; export type NavTab = "forecast" | "wire" | "connectors" | "sandbox" | "documents" | "audit"; interface HeaderProps { activeTab: NavTab; setActiveTab: (tab: NavTab) => void; onNewForecastClick: () => void; onOpenAuthModal: () => void; onOpenSettingsModal: () => void; } export const Header: React.FC = ({ activeTab, setActiveTab, onNewForecastClick, onOpenAuthModal, onOpenSettingsModal, }) => { const [currentUser, setCurrentUser] = useState(null); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const { language, toggleLanguage, t } = useLanguage(); const isArabic = language === "ar"; useEffect(() => { const unsubscribe = onAuthStateChanged(auth, (user) => { setCurrentUser(user); }); return () => unsubscribe(); }, []); const navItems: Array<{ id: NavTab; label: string; icon: any; color: string; live?: boolean }> = [ { id: "forecast", label: t.nav.forecast, icon: Activity, color: "text-cyan-400" }, { id: "wire", label: isArabic ? "رصد الأخبار الحية" : "Live News Wire", icon: Radio, color: "text-rose-400", live: true }, { id: "connectors", label: t.nav.connectors, icon: Database, color: "text-emerald-400" }, { id: "sandbox", label: t.nav.sandbox, icon: Terminal, color: "text-amber-400" }, { id: "documents", label: t.nav.documents, icon: FileText, color: "text-purple-400" }, { id: "audit", label: t.nav.audit, icon: ShieldCheck, color: "text-sky-400" }, ]; const handleTabClick = (tabId: NavTab) => { setActiveTab(tabId); setIsMobileMenuOpen(false); }; return (
{/* Zone 1: Wordmark */}
GS
{/* Zone 2: Desktop Navigation Bar */} {/* Zone 3: Actions & User Profile */}
{/* Language Switcher */} {currentUser ? (
{currentUser.displayName || currentUser.email?.split("@")[0] || "Strategist"}
) : ( )} {/* Mobile Menu Toggle Button */}
{/* Mobile Navigation Drawer */} {isMobileMenuOpen && (
{navItems.map((item) => { const Icon = item.icon; const isActive = activeTab === item.id; return ( ); })}
)}
); };