mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 23:00:57 +00:00
129 lines
4.3 KiB
TypeScript
129 lines
4.3 KiB
TypeScript
"use client";
|
|
|
|
import { Menu, X, Moon, Sun, HelpCircle } from "lucide-react";
|
|
import Link from "next/link";
|
|
import Image from "next/image";
|
|
import { useEffect, useState } from "react";
|
|
import { LanguageSwitcher } from "./LanguageSwitcher";
|
|
|
|
export default function AppHeader() {
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
const [isDark, setIsDark] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const isDarkMode = document.documentElement.classList.contains("dark");
|
|
setIsDark(isDarkMode);
|
|
}, []);
|
|
|
|
const toggleTheme = () => {
|
|
const html = document.documentElement;
|
|
const isDarkMode = html.classList.contains("dark");
|
|
if (isDarkMode) {
|
|
html.classList.remove("dark");
|
|
setIsDark(false);
|
|
localStorage.setItem("theme", "light");
|
|
} else {
|
|
html.classList.add("dark");
|
|
setIsDark(true);
|
|
localStorage.setItem("theme", "dark");
|
|
}
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
<header className="sticky top-0 z-50 bg-[rgb(20_113_76)] dark:bg-gray-900 border-b border-[rgb(16_89_60)] dark:border-gray-800 shadow-sm">
|
|
<div className="container mx-auto px-4">
|
|
<div className="max-w-6xl mx-auto">
|
|
<div className="flex items-center justify-between h-16">
|
|
{/* Logo */}
|
|
<Link
|
|
href="/"
|
|
className="flex items-center hover:opacity-80 transition-opacity"
|
|
>
|
|
<Image
|
|
src="/edr-logo.png"
|
|
alt="Ethio-Djibouti Railway"
|
|
width={140}
|
|
height={48}
|
|
className="h-14 w-auto"
|
|
priority
|
|
/>
|
|
</Link>
|
|
|
|
{/* Desktop Menu */}
|
|
<div className="hidden md:flex items-center gap-8">
|
|
<Link
|
|
href="/booking/lookup"
|
|
className="text-sm font-medium text-gray-100 hover:text-white transition-colors"
|
|
>
|
|
My Booking
|
|
</Link>
|
|
</div>
|
|
|
|
{/* Right Actions */}
|
|
<div className="flex items-center gap-2">
|
|
{/* Help Link */}
|
|
<Link
|
|
href="/help"
|
|
className="hidden sm:flex items-center justify-center p-2 text-gray-100 hover:bg-white hover:bg-opacity-10 rounded-lg transition-colors"
|
|
title="Help & FAQ"
|
|
>
|
|
<HelpCircle className="w-5 h-5" />
|
|
</Link>
|
|
|
|
{/* Language Switcher */}
|
|
<LanguageSwitcher />
|
|
|
|
{/* Theme Toggler */}
|
|
<button
|
|
onClick={toggleTheme}
|
|
className="p-2 text-gray-100 hover:bg-white hover:bg-opacity-10 rounded-lg transition-colors"
|
|
title={isDark ? "Light mode" : "Dark mode"}
|
|
>
|
|
{isDark ? (
|
|
<Sun className="w-5 h-5" />
|
|
) : (
|
|
<Moon className="w-5 h-5" />
|
|
)}
|
|
</button>
|
|
|
|
{/* Mobile Menu Button */}
|
|
<button
|
|
onClick={() => setIsOpen(!isOpen)}
|
|
className="md:hidden p-2 text-gray-100 hover:bg-white hover:bg-opacity-10 rounded-lg"
|
|
>
|
|
{isOpen ? (
|
|
<X className="w-5 h-5" />
|
|
) : (
|
|
<Menu className="w-5 h-5" />
|
|
)}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Mobile Menu */}
|
|
{isOpen && (
|
|
<div className="md:hidden border-t border-white border-opacity-20 dark:border-gray-700 py-4 space-y-2 animate-in slide-in-from-top-2 duration-200">
|
|
<Link
|
|
href="/booking/lookup"
|
|
className="block px-4 py-2 text-gray-100 dark:text-gray-300 hover:bg-white hover:bg-opacity-10 dark:hover:bg-gray-800 rounded-lg transition-colors"
|
|
onClick={() => setIsOpen(false)}
|
|
>
|
|
My Booking
|
|
</Link>
|
|
<Link
|
|
href="/help"
|
|
className="block px-4 py-2 text-gray-100 dark:text-gray-300 hover:bg-white hover:bg-opacity-10 dark:hover:bg-gray-800 rounded-lg transition-colors"
|
|
onClick={() => setIsOpen(false)}
|
|
>
|
|
Help
|
|
</Link>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</header>
|
|
);
|
|
}
|