From 1f844b946e18a1ea870965322ca06cfc03bc0a7d Mon Sep 17 00:00:00 2001 From: root Date: Fri, 27 Feb 2026 09:56:40 +0000 Subject: [PATCH] feat: login/register to top-right, remove kline/signals from sidebar nav --- frontend/app/layout.tsx | 20 +++++++++++-- frontend/components/Sidebar.tsx | 52 ++++++++++++++++----------------- 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/frontend/app/layout.tsx b/frontend/app/layout.tsx index 64fdfc6..e5ece9b 100644 --- a/frontend/app/layout.tsx +++ b/frontend/app/layout.tsx @@ -2,6 +2,7 @@ import type { Metadata } from "next"; import { Geist, Geist_Mono } from "next/font/google"; import "./globals.css"; import Sidebar from "@/components/Sidebar"; +import Link from "next/link"; const geistSans = Geist({ variable: "--font-geist-sans", subsets: ["latin"] }); const geistMono = Geist_Mono({ variable: "--font-geist-mono", subsets: ["latin"] }); @@ -17,9 +18,22 @@ export default function RootLayout({ children }: Readonly<{ children: React.Reac
-
- {children} -
+
+ {/* 桌面端顶栏:右上角登录注册 */} +
+ + 登录 + + + 注册 + +
+
+ {children} +
+
diff --git a/frontend/components/Sidebar.tsx b/frontend/components/Sidebar.tsx index 3f96838..9cb64c5 100644 --- a/frontend/components/Sidebar.tsx +++ b/frontend/components/Sidebar.tsx @@ -4,22 +4,16 @@ import { useState } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { - LayoutDashboard, TrendingUp, Bell, Info, LogIn, UserPlus, - ChevronLeft, ChevronRight, Menu, X, Zap + LayoutDashboard, Info, + Menu, X, Zap, LogIn, UserPlus, + ChevronLeft, ChevronRight } from "lucide-react"; const navItems = [ { href: "/", label: "仪表盘", icon: LayoutDashboard }, - { href: "/kline", label: "K线大图", icon: TrendingUp }, - { href: "/signals", label: "信号历史", icon: Bell }, { href: "/about", label: "说明", icon: Info }, ]; -const authItems = [ - { href: "/login", label: "登录", icon: LogIn }, - { href: "/register", label: "注册", icon: UserPlus }, -]; - export default function Sidebar() { const pathname = usePathname(); const [collapsed, setCollapsed] = useState(false); @@ -28,7 +22,7 @@ export default function Sidebar() { const SidebarContent = ({ mobile = false }: { mobile?: boolean }) => (
{/* Logo */} -
+
{(!collapsed || mobile) && ( Arbitrage
Engine
@@ -44,27 +38,27 @@ export default function Sidebar() { onClick={() => setMobileOpen(false)} className={`flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm transition-colors ${active ? "bg-blue-50 text-blue-700 font-medium" : "text-slate-600 hover:bg-slate-100 hover:text-slate-900"} - ${collapsed && !mobile ? "justify-center px-0" : ""}`}> + ${collapsed && !mobile ? "justify-center" : ""}`}> {(!collapsed || mobile) && {label}} ); })} + {/* 手机端:登录注册放在菜单里 */} + {mobile && ( +
+ setMobileOpen(false)} + className="flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm text-slate-600 hover:bg-slate-100 transition-colors"> + 登录 + + setMobileOpen(false)} + className="flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm text-white bg-blue-600 hover:bg-blue-700 transition-colors"> + 注册 + +
+ )} - {/* Auth */} -
- {authItems.map(({ href, label, icon: Icon }) => ( - setMobileOpen(false)} - className={`flex items-center gap-3 px-3 py-2 rounded-lg text-sm text-slate-500 hover:bg-slate-100 hover:text-slate-800 transition-colors - ${collapsed && !mobile ? "justify-center px-0" : ""}`}> - - {(!collapsed || mobile) && {label}} - - ))} -
- {/* Collapse toggle (desktop only) */} {!mobile && (
- +
+ 登录 + 注册 + +
{/* Mobile drawer */}