75 lines
2.4 KiB
TypeScript
75 lines
2.4 KiB
TypeScript
import { UserAuth } from './UserAuth';
|
|
|
|
interface HeaderProps {
|
|
selectedBodyName?: string;
|
|
bodyCount: number;
|
|
cutoffDate?: Date | null;
|
|
user?: any;
|
|
onOpenAuth?: () => void;
|
|
onLogout?: () => void;
|
|
onNavigateToAdmin?: () => void;
|
|
}
|
|
|
|
export function Header({
|
|
selectedBodyName,
|
|
bodyCount,
|
|
cutoffDate,
|
|
user,
|
|
onOpenAuth,
|
|
onLogout,
|
|
onNavigateToAdmin
|
|
}: HeaderProps) {
|
|
// Format cutoff date as YYYY/MM/DD
|
|
const formattedCutoffDate = cutoffDate
|
|
? `${cutoffDate.getFullYear()}/${String(cutoffDate.getMonth() + 1).padStart(2, '0')}/${String(cutoffDate.getDate()).padStart(2, '0')}`
|
|
: '';
|
|
|
|
return (
|
|
<header className="absolute top-0 left-0 right-0 z-50 pointer-events-none">
|
|
<div className="px-6 py-4 bg-gradient-to-b from-black/90 via-black/60 to-transparent flex items-start justify-between">
|
|
{/* Left: Branding */}
|
|
<div className="flex items-center gap-4 pointer-events-auto inline-flex">
|
|
<div className="flex items-center gap-3">
|
|
<span className="text-4xl">🌌</span>
|
|
<div>
|
|
<div className="flex items-baseline gap-2">
|
|
<h1 className="text-2xl font-bold text-white tracking-tight drop-shadow-md">Cosmo</h1>
|
|
{formattedCutoffDate && (
|
|
<span className="text-xs text-gray-400 font-mono">
|
|
({formattedCutoffDate})
|
|
</span>
|
|
)}
|
|
</div>
|
|
<p className="text-xs text-gray-400 font-medium tracking-wide">DEEP SPACE EXPLORER</p>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Status Info */}
|
|
<div className="ml-4 px-3 py-1 bg-white/10 backdrop-blur-md rounded-full border border-white/10">
|
|
<p className="text-xs text-gray-300">
|
|
{selectedBodyName ? (
|
|
<>
|
|
<span className="text-cyan-400 animate-pulse">●</span> 聚焦: <span className="text-white font-bold ml-1">{selectedBodyName}</span>
|
|
</>
|
|
) : (
|
|
<>
|
|
<span className="text-green-400">●</span> {bodyCount} 个天体在线
|
|
</>
|
|
)}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Right: User Auth */}
|
|
{onOpenAuth && (
|
|
<UserAuth
|
|
user={user}
|
|
onOpenAuth={onOpenAuth}
|
|
onLogout={onLogout!}
|
|
onNavigateToAdmin={onNavigateToAdmin!}
|
|
/>
|
|
)}
|
|
</div>
|
|
</header>
|
|
);
|
|
} |