feat: 更新管理员导航,添加结算和奖池模块,并优化活动匹配逻辑
This commit is contained in:
@@ -24,11 +24,13 @@ import {
|
||||
} from "@/modules/_config/admin-nav-icons";
|
||||
import { adminShellNavItems, ADMIN_BASE } from "@/modules/_config/admin-nav";
|
||||
|
||||
function isActive(pathname: string, href: string): boolean {
|
||||
if (href === ADMIN_BASE || href === `${ADMIN_BASE}/`) {
|
||||
function isActive(pathname: string, item: { href: string; activeMatchPrefix?: string }): boolean {
|
||||
const { href, activeMatchPrefix } = item;
|
||||
const prefix = activeMatchPrefix ?? href;
|
||||
if (prefix === ADMIN_BASE || prefix === `${ADMIN_BASE}/`) {
|
||||
return pathname === ADMIN_BASE || pathname === `${ADMIN_BASE}/`;
|
||||
}
|
||||
return pathname === href || pathname.startsWith(`${href}/`);
|
||||
return pathname === prefix || pathname.startsWith(`${prefix}/`);
|
||||
}
|
||||
|
||||
export function AdminAppSidebar() {
|
||||
@@ -67,7 +69,7 @@ export function AdminAppSidebar() {
|
||||
<SidebarMenuItem key={item.segment}>
|
||||
<SidebarMenuButton
|
||||
tooltip={item.label}
|
||||
isActive={isActive(pathname, item.href)}
|
||||
isActive={isActive(pathname, item)}
|
||||
render={<Link href={item.href} />}
|
||||
>
|
||||
<Icon data-icon="inline-start" aria-hidden />
|
||||
|
||||
Reference in New Issue
Block a user