调整列表字段和枚举值转换
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
"use client"
|
||||
import {
|
||||
BadgeQuestionMarkIcon,
|
||||
BellIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronRightIcon,
|
||||
InboxIcon,
|
||||
LogOutIcon,
|
||||
SearchIcon,
|
||||
SettingsIcon,
|
||||
UserIcon,
|
||||
} from "lucide-react"
|
||||
import Image from "next/image"
|
||||
import Link from "next/link"
|
||||
import { usePathname } from "next/navigation"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Input } from "@/components/ui/input"
|
||||
|
||||
export default function Appbar() {
|
||||
const [currentUser] = useState({
|
||||
@@ -84,10 +97,18 @@ export default function Appbar() {
|
||||
content: "内容管理",
|
||||
articles: "文章管理",
|
||||
media: "媒体库",
|
||||
users: "用户管理",
|
||||
user: "用户管理",
|
||||
roles: "角色权限",
|
||||
settings: "系统设置",
|
||||
logs: "系统日志",
|
||||
proxy: "",
|
||||
nodes: "节点列表",
|
||||
trade: "交易明细",
|
||||
billing: "账单详情",
|
||||
resources: "套餐管理",
|
||||
batch: "使用记录",
|
||||
channel: "IP管理",
|
||||
pools: "IP池管理",
|
||||
}
|
||||
|
||||
return labels[path] || path
|
||||
@@ -103,19 +124,7 @@ export default function Appbar() {
|
||||
{breadcrumbs.map((crumb, index) => (
|
||||
<div key={crumb.path} className="flex items-center">
|
||||
{index > 0 && (
|
||||
<svg
|
||||
className="mx-2 h-4 w-4 text-gray-400"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M9 5l7 7-7 7"
|
||||
/>
|
||||
</svg>
|
||||
<ChevronRightIcon size={18} className="text-gray-400" />
|
||||
)}
|
||||
<Link
|
||||
href={crumb.path}
|
||||
@@ -135,61 +144,39 @@ export default function Appbar() {
|
||||
<div className="flex items-center space-x-4">
|
||||
{/* 搜索框 */}
|
||||
<div className="hidden md:block relative">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="搜索..."
|
||||
className="pl-10 pr-4 py-2 bg-gray-100 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent w-56"
|
||||
/>
|
||||
<svg
|
||||
className="h-4 w-4 text-gray-400 absolute left-3 top-2.5"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
|
||||
<div className="relative">
|
||||
<SearchIcon className="absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400" />
|
||||
<Input
|
||||
type="text"
|
||||
placeholder="搜索..."
|
||||
className="pl-10 pr-4 py-2 bg-gray-100 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent w-56"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 通知图标 */}
|
||||
<div className="relative" ref={notificationRef}>
|
||||
<button
|
||||
<Button
|
||||
onClick={() => setShowNotifications(!showNotifications)}
|
||||
className="relative p-2 rounded-full text-gray-600 hover:bg-gray-100 hover:text-gray-800 transition-colors"
|
||||
className="relative p-2 rounded-full text-gray-600 bg-gray-100 hover:bg-gray-100 hover:text-gray-800 transition-colors"
|
||||
aria-label="通知"
|
||||
>
|
||||
<svg
|
||||
className="h-6 w-6"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
|
||||
/>
|
||||
</svg>
|
||||
<BellIcon />
|
||||
{unreadCount > 0 && (
|
||||
<span className="absolute top-1 right-1 h-4 w-4 text-xs flex items-center justify-center rounded-full bg-red-500 text-white">
|
||||
{unreadCount}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
</Button>
|
||||
|
||||
{/* 通知下拉面板 */}
|
||||
{showNotifications && (
|
||||
<div className="absolute right-0 mt-2 w-80 bg-white rounded-md shadow-lg py-1 z-20 border border-gray-200">
|
||||
<div className="px-4 py-2 border-b border-gray-100 flex justify-between items-center">
|
||||
<h3 className="font-medium text-gray-800">通知</h3>
|
||||
<button className="text-xs text-blue-600 hover:text-blue-800">
|
||||
<Button className="text-xs text-blue-600 hover:text-blue-800">
|
||||
全部标为已读
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div className="max-h-72 overflow-y-auto">
|
||||
@@ -216,19 +203,7 @@ export default function Appbar() {
|
||||
))
|
||||
) : (
|
||||
<div className="py-8 px-4 text-center">
|
||||
<svg
|
||||
className="w-12 h-12 text-gray-300 mx-auto"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={1}
|
||||
d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"
|
||||
/>
|
||||
</svg>
|
||||
<InboxIcon size={18} />
|
||||
<p className="mt-2 text-sm text-gray-500">暂无通知</p>
|
||||
</div>
|
||||
)}
|
||||
@@ -251,9 +226,9 @@ export default function Appbar() {
|
||||
|
||||
{/* 用户下拉菜单 */}
|
||||
<div className="relative" ref={dropdownRef}>
|
||||
<button
|
||||
<Button
|
||||
onClick={() => setShowDropdown(!showDropdown)}
|
||||
className="flex items-center space-x-2 rounded-lg hover:bg-gray-100 p-2 transition-colors"
|
||||
className="flex items-center space-x-2 rounded-lg text-gray-800 bg-gray-100 hover:bg-gray-100 p-2 transition-colors"
|
||||
aria-label="用户菜单"
|
||||
>
|
||||
<div className="h-8 w-8 rounded-full bg-blue-100 text-blue-800 flex items-center justify-center overflow-hidden border-2 border-white shadow-sm">
|
||||
@@ -275,20 +250,8 @@ export default function Appbar() {
|
||||
</p>
|
||||
<p className="text-xs text-gray-500">{currentUser.role}</p>
|
||||
</div>
|
||||
<svg
|
||||
className="h-4 w-4 text-gray-400 hidden md:block"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M19 9l-7 7-7-7"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<ChevronDownIcon />
|
||||
</Button>
|
||||
|
||||
{/* 用户下拉内容 */}
|
||||
{showDropdown && (
|
||||
@@ -303,64 +266,22 @@ export default function Appbar() {
|
||||
href="/profile"
|
||||
className="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
|
||||
>
|
||||
<svg
|
||||
className="mr-3 h-5 w-5 text-gray-500"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
|
||||
/>
|
||||
</svg>
|
||||
个人资料
|
||||
<UserIcon size={18} />
|
||||
<span className="pl-3">个人资料</span>
|
||||
</Link>
|
||||
<Link
|
||||
href="/settings/account"
|
||||
className="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
|
||||
>
|
||||
<svg
|
||||
className="mr-3 h-5 w-5 text-gray-500"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"
|
||||
/>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"
|
||||
/>
|
||||
</svg>
|
||||
账号设置
|
||||
<SettingsIcon size={18} />
|
||||
<span className="pl-3">账号设置</span>
|
||||
</Link>
|
||||
<Link
|
||||
href="/system/help"
|
||||
className="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100"
|
||||
>
|
||||
<svg
|
||||
className="mr-3 h-5 w-5 text-gray-500"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg>
|
||||
帮助中心
|
||||
<BadgeQuestionMarkIcon size={18} />
|
||||
<span className="pl-3">帮助中心</span>
|
||||
</Link>
|
||||
</div>
|
||||
|
||||
@@ -369,20 +290,8 @@ export default function Appbar() {
|
||||
href="/login"
|
||||
className="flex items-center px-4 py-2 text-sm text-red-600 hover:bg-gray-100"
|
||||
>
|
||||
<svg
|
||||
className="mr-3 h-5 w-5 text-red-500"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"
|
||||
/>
|
||||
</svg>
|
||||
退出登录
|
||||
<LogOutIcon size={18} />
|
||||
<span className="pl-3">退出登录</span>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user