- Vite 6 + React 19 + TypeScript + Tailwind 4 + Zustand 5 - Login page with JWT auth - Chat interface: MessageList, ChatInput, ChatContainer - WebSocket hook with auto-reconnect and exponential backoff - Sidebar with new chat button + session navigation - Admin dashboard placeholder - 57 modules, 242KB JS, TypeScript zero errors
15 lines
663 B
TypeScript
15 lines
663 B
TypeScript
import { Link, useLocation } from 'react-router-dom'
|
|
|
|
export default function Header({ username, onLogout }: { username: string; onLogout: () => void }) {
|
|
return (
|
|
<header className="h-12 bg-gray-900 border-b border-gray-800 flex items-center px-4 justify-between shrink-0">
|
|
<Link to="/chat" className="font-bold text-purple-400 text-lg">Cyrene</Link>
|
|
<div className="flex items-center gap-3 text-sm text-gray-400">
|
|
<Link to="/admin/dashboard" className="hover:text-gray-200">管理</Link>
|
|
<span>{username}</span>
|
|
<button onClick={onLogout} className="hover:text-red-400">退出</button>
|
|
</div>
|
|
</header>
|
|
)
|
|
}
|