Files
soul/app/admin/layout.tsx

84 lines
3.0 KiB
TypeScript
Raw Normal View History

"use client"
import type React from "react"
import { useState, useEffect } from "react"
import Link from "next/link"
import { usePathname } from "next/navigation"
import { LayoutDashboard, FileText, Users, CreditCard, Settings, LogOut, Wallet, Globe, BookOpen } from "lucide-react"
export default function AdminLayout({ children }: { children: React.ReactNode }) {
const pathname = usePathname()
const [mounted, setMounted] = useState(false)
useEffect(() => {
setMounted(true)
}, [])
// 简化菜单:按功能归类,保留核心功能
const menuItems = [
{ icon: LayoutDashboard, label: "数据概览", href: "/admin" },
{ icon: BookOpen, label: "内容管理", href: "/admin/content" },
{ icon: Users, label: "用户管理", href: "/admin/users" },
{ icon: Wallet, label: "分账管理", href: "/admin/withdrawals" },
{ icon: CreditCard, label: "支付设置", href: "/admin/payment" },
{ icon: Settings, label: "系统设置", href: "/admin/settings" },
]
// 避免hydration错误等待客户端mount
if (!mounted) {
return (
<div className="flex min-h-screen bg-[#0a1628]">
<div className="w-64 bg-[#0f2137] border-r border-gray-700/50" />
<div className="flex-1 flex items-center justify-center">
<div className="text-[#38bdac]">...</div>
</div>
</div>
)
}
return (
<div className="flex min-h-screen bg-[#0a1628]">
{/* Sidebar - 深色侧边栏 */}
<div className="w-64 bg-[#0f2137] flex flex-col border-r border-gray-700/50 shadow-xl">
<div className="p-6 border-b border-gray-700/50">
<h1 className="text-xl font-bold text-[#38bdac]"></h1>
<p className="text-xs text-gray-400 mt-1">Soul创业派对</p>
</div>
<nav className="flex-1 p-4 space-y-1">
{menuItems.map((item) => {
const isActive = pathname === item.href
return (
<Link
key={item.href}
href={item.href}
className={`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${
isActive
? "bg-[#38bdac]/20 text-[#38bdac] font-medium"
: "text-gray-400 hover:bg-gray-700/50 hover:text-white"
}`}
>
<item.icon className="w-5 h-5" />
<span className="text-sm">{item.label}</span>
</Link>
)
})}
</nav>
<div className="p-4 border-t border-gray-700/50">
<Link
href="/"
className="flex items-center gap-3 px-4 py-3 text-gray-400 hover:text-white rounded-lg hover:bg-gray-700/50 transition-colors"
>
<LogOut className="w-5 h-5" />
<span className="text-sm"></span>
</Link>
</div>
</div>
{/* Main Content - 深色背景 */}
<div className="flex-1 overflow-auto bg-[#0a1628]">{children}</div>
</div>
)
}