From 76bfc8d21a62188d5c0255caed45ac702502793d Mon Sep 17 00:00:00 2001 From: DIYgod Date: Fri, 21 Jul 2023 23:12:35 +0100 Subject: [PATCH] feat: dashboard sidebar classification --- .../[subdomain]/layout-component.tsx | 59 ++++++++++++++----- src/lib/i18n/locales/zh-TW/common.json | 2 +- src/lib/i18n/locales/zh/common.json | 2 +- src/lib/i18n/locales/zh/dashboard.json | 3 +- 4 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/app/dashboard/[subdomain]/layout-component.tsx b/src/app/dashboard/[subdomain]/layout-component.tsx index 64b77058..a8d818c2 100644 --- a/src/app/dashboard/[subdomain]/layout-component.tsx +++ b/src/app/dashboard/[subdomain]/layout-component.tsx @@ -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} > - + {isOpen && {t(link.text)}} ) diff --git a/src/lib/i18n/locales/zh-TW/common.json b/src/lib/i18n/locales/zh-TW/common.json index dcdd7988..fdaa1d58 100644 --- a/src/lib/i18n/locales/zh-TW/common.json +++ b/src/lib/i18n/locales/zh-TW/common.json @@ -23,7 +23,7 @@ "Transaction Hash": "交易雜湊值", "IPFS Address": "IPFS 位址", "BNB Greenfield Address": "BNB Greenfield 位址", - "Creation": "創建", + "Creation": "創作", "Last Update": "最後更新", "Create Character": "創建身份", "Submit": "提交", diff --git a/src/lib/i18n/locales/zh/common.json b/src/lib/i18n/locales/zh/common.json index 03fbcf99..3b77f6c8 100644 --- a/src/lib/i18n/locales/zh/common.json +++ b/src/lib/i18n/locales/zh/common.json @@ -23,7 +23,7 @@ "Transaction Hash": "交易哈希", "IPFS Address": "IPFS 地址", "BNB Greenfield Address": "BNB Greenfield 地址", - "Creation": "创建", + "Creation": "创作", "Last Update": "最后更新", "Create Character": "创建角色", "Submit": "提交", diff --git a/src/lib/i18n/locales/zh/dashboard.json b/src/lib/i18n/locales/zh/dashboard.json index 3552d51f..53cab38d 100644 --- a/src/lib/i18n/locales/zh/dashboard.json +++ b/src/lib/i18n/locales/zh/dashboard.json @@ -215,5 +215,6 @@ "Advanced Settings": "高级设置", "Disable AI-generated summary": "禁用 AI 生成的摘要", "Pin": "置顶", - "Unpin": "取消置顶" + "Unpin": "取消置顶", + "Interaction": "互动" }