interstellar_ai/app/components/Header.tsx

55 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-09-24 14:54:39 +02:00
import React, { useState } from 'react';
2024-09-20 10:00:54 +02:00
import Login from './Login';
2024-09-18 10:03:36 +02:00
interface HeaderProps {
onViewChange: (view: 'AI' | 'FAQ' | 'Documentation' | 'Credits') => void; // Include 'Credits'
2024-09-19 12:18:04 +02:00
showDivs: boolean;
toggleDivs: () => void;
2024-09-19 09:54:00 +02:00
showHistoryModelsToggle: boolean;
showToggle: boolean;
2024-09-18 10:03:36 +02:00
}
2024-09-19 12:18:04 +02:00
const Header: React.FC<HeaderProps> = ({ onViewChange, showDivs, toggleDivs, showHistoryModelsToggle, showToggle }) => {
const [menuOpen, setMenuOpen] = useState(false);
2024-09-24 14:54:39 +02:00
const toggleMenu = () => {
setMenuOpen(!menuOpen);
};
2024-09-24 14:54:39 +02:00
const buttonClicked = (page: "AI" | "Documentation" | "FAQ" | "Credits") => { // Add 'Credits' to the options here
onViewChange(page);
toggleMenu();
};
2024-09-25 11:22:59 +02:00
2024-09-18 10:03:36 +02:00
return (
2024-09-20 10:00:54 +02:00
<>
<header>
2024-09-24 14:54:39 +02:00
<div className={`hamburger ${menuOpen ? "open" : ""}`} onClick={toggleMenu}>
<span></span>
<span></span>
<span></span>
</div>
<nav className={`nav-links ${menuOpen ? "active" : ""}`}>
<button onClick={() => buttonClicked("AI")} className="nav-btn">Chat</button>
<button onClick={() => buttonClicked("FAQ")} className="nav-btn">FAQ</button>
<button onClick={() => buttonClicked("Documentation")} className="nav-btn">Documentation</button>
<button onClick={() => buttonClicked("Credits")} className="nav-btn">Credits</button> {/* Add Credits tab */}
{showToggle && showHistoryModelsToggle && (
<button onClick={toggleDivs} className="nav-btn">
{showDivs ? 'Hide History/Models' : 'Show History/Models'}
</button>
)}
</nav>
2024-09-27 16:48:17 +02:00
<div className="header-button header-logo">
{/* AI logo or text */}
2024-09-27 16:48:17 +02:00
</div>
2024-09-30 08:41:06 +02:00
<div className="login-button-container">
2024-09-25 11:22:59 +02:00
<Login />
</div>
2024-09-20 10:00:54 +02:00
</header>
</>
2024-09-18 10:03:36 +02:00
);
};
export default Header;