fix: unified nav - TopHud back btn + window controls + login close

This commit is contained in:
Chen Gu
2026-05-09 14:32:04 +08:00
parent dc3db7549c
commit 27de14f752
4 changed files with 57 additions and 14 deletions

View File

@@ -4,12 +4,26 @@ interface TopHudProps {
title?: string;
subtitle?: string;
sections?: { label: string; value: string }[];
onBack?: () => void;
}
export default function TopHud({ title = '码枪堂 2.0', subtitle, sections = [] }: TopHudProps) {
function callElectron(method: string) {
try { (window as any).electronAPI?.[method](); } catch {}
}
export default function TopHud({ title = '码枪堂 2.0', subtitle, sections = [], onBack }: TopHudProps) {
return (
<div className="flex items-center justify-between border-b border-[#333] bg-[#1a1a1a] px-3 py-1">
<div className="flex items-center justify-between border-b border-[#333] bg-[#1a1a1a] px-3 py-1 select-none">
<div className="flex items-center gap-2">
{/* Back button */}
{onBack && (
<button
onClick={onBack}
className="text-[#555] hover:text-[#e0e0e0] text-[10px] px-1 py-0.5 border border-[#333] hover:border-[#555] transition-colors duration-75"
>
</button>
)}
<span className="text-[#ff4500] text-[8px]"></span>
<h1 className="text-[9px] font-bold tracking-[0.15em] uppercase text-[#e0e0e0]">{title}</h1>
{subtitle && (
@@ -19,7 +33,7 @@ export default function TopHud({ title = '码枪堂 2.0', subtitle, sections = [
</>
)}
</div>
<div className="flex items-center gap-3">
<div className="flex items-center gap-2">
{sections.map((s, i) => (
<span key={i} className="flex items-center gap-1">
<span className="text-[7px] tracking-[0.15em] uppercase text-[#555]">{s.label}</span>
@@ -27,7 +41,27 @@ export default function TopHud({ title = '码枪堂 2.0', subtitle, sections = [
</span>
))}
<span className="w-[1px] h-3 bg-[#333]" />
<span className="text-[8px] font-mono text-[#444]">V0.2.1</span>
{/* Window controls */}
<button
onClick={() => callElectron('minimizeWindow')}
className="text-[#555] hover:text-[#e0e0e0] text-[14px] leading-none px-1 transition-colors duration-75"
>
</button>
<button
onClick={() => callElectron('maximizeWindow')}
className="text-[#555] hover:text-[#e0e0e0] text-[10px] leading-none px-1 transition-colors duration-75"
>
</button>
<button
onClick={() => callElectron('closeWindow')}
className="text-[#555] hover:text-[#cc3300] text-[12px] leading-none px-1 transition-colors duration-75"
>
</button>
<span className="text-[8px] font-mono text-[#444] ml-1">V0.2.1</span>
</div>
</div>
);