feat: 更新管理员导航,添加结算和奖池模块,并优化活动匹配逻辑

This commit is contained in:
2026-05-11 15:35:41 +08:00
parent 0103d25426
commit f083b28fc6
19 changed files with 1226 additions and 5 deletions

View File

@@ -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 />