feat: dashboard sidebar classification

This commit is contained in:
DIYgod
2023-07-21 23:12:35 +01:00
parent 22e07bf5b7
commit 76bfc8d21a
4 changed files with 47 additions and 19 deletions
@@ -94,6 +94,7 @@ export default function DashboardLayout({
isActive: (ctx: { href: string; pathname: string | null }) => boolean
icon: React.ReactNode
text: string
lever?: number
}[] = [
{
href: `/dashboard/${subdomain}`,
@@ -101,31 +102,24 @@ export default function DashboardLayout({
icon: "icon-[mingcute--grid-line]",
text: "Dashboard",
},
{
isActive: ({ href, pathname }) => href === pathname,
icon: "icon-[mingcute--add-circle-line]",
text: "Creation",
},
{
href: `/dashboard/${subdomain}/posts`,
isActive: ({ href, pathname }) => href === pathname,
icon: "icon-[mingcute--news-line]",
text: "Posts",
lever: 2,
},
{
href: `/dashboard/${subdomain}/pages`,
isActive: ({ href, pathname }) => href === pathname,
icon: "icon-[mingcute--file-line]",
text: "Pages",
},
{
href: `/dashboard/${subdomain}/comments`,
isActive: ({ href, pathname }) => href === pathname,
icon: "icon-[mingcute--comment-line]",
text: "Comments",
},
{
onClick: showNotificationModal,
isActive: ({ href, pathname }) => href === pathname,
icon: isAllRead
? "icon-[mingcute--notification-line]"
: "icon-[mingcute--notification-fill]",
text: isAllRead ? "Notifications" : "Unread notifications",
lever: 2,
},
{
href: `/dashboard/${subdomain}/import`,
@@ -133,6 +127,7 @@ export default function DashboardLayout({
!!pathname?.startsWith(`/dashboard/${subdomain}/import`),
icon: "icon-[mingcute--file-import-line]",
text: "Import",
lever: 2,
},
{
href: `/dashboard/${subdomain}/events`,
@@ -141,12 +136,35 @@ export default function DashboardLayout({
? "icon-[mingcute--flag-4-line]"
: "icon-[mingcute--flag-4-fill]",
text: isEventsAllRead ? "Events" : "New Events",
lever: 2,
},
{
isActive: ({ href, pathname }) => href === pathname,
icon: "icon-[mingcute--heartbeat-line]",
text: "Interaction",
},
{
onClick: showNotificationModal,
isActive: ({ href, pathname }) => href === pathname,
icon: isAllRead
? "icon-[mingcute--notification-line]"
: "icon-[mingcute--notification-fill]",
text: isAllRead ? "Notifications" : "Unread notifications",
lever: 2,
},
{
href: `/dashboard/${subdomain}/comments`,
isActive: ({ href, pathname }) => href === pathname,
icon: "icon-[mingcute--comment-line]",
text: "Comments",
lever: 2,
},
{
href: `/dashboard/${subdomain}/achievements`,
isActive: ({ href, pathname }) => href === pathname,
icon: "icon-[mingcute--trophy-line]",
text: "Achievements",
lever: 2,
},
{
href: `/dashboard/${subdomain}/tokens`,
@@ -325,12 +343,21 @@ export default function DashboardLayout({
`flex px-4 h-12 items-center rounded-md space-x-2 w-full transition-colors`,
active
? `bg-slate-200 font-medium text-accent`
: `hover:bg-slate-200 hover:bg-opacity-50`,
: link.href || link.onClick
? "hover:bg-slate-200 hover:bg-opacity-50"
: "opacity-80",
!isOpen && "justify-center",
)}
onClick={link.onClick}
>
<span className={cn(link.icon, "text-xl")}></span>
<span
className={cn(link.icon, "text-xl")}
style={{
marginLeft: link.lever
? (link.lever - 1) * 20
: 0,
}}
></span>
{isOpen && <span>{t(link.text)}</span>}
</UniLink>
)
+1 -1
View File
@@ -23,7 +23,7 @@
"Transaction Hash": "交易雜湊值",
"IPFS Address": "IPFS 位址",
"BNB Greenfield Address": "BNB Greenfield 位址",
"Creation": "創建",
"Creation": "創作",
"Last Update": "最後更新",
"Create Character": "創建身份",
"Submit": "提交",
+1 -1
View File
@@ -23,7 +23,7 @@
"Transaction Hash": "交易哈希",
"IPFS Address": "IPFS 地址",
"BNB Greenfield Address": "BNB Greenfield 地址",
"Creation": "创建",
"Creation": "创作",
"Last Update": "最后更新",
"Create Character": "创建角色",
"Submit": "提交",
+2 -1
View File
@@ -215,5 +215,6 @@
"Advanced Settings": "高级设置",
"Disable AI-generated summary": "禁用 AI 生成的摘要",
"Pin": "置顶",
"Unpin": "取消置顶"
"Unpin": "取消置顶",
"Interaction": "互动"
}