mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-09 09:06:36 +08:00
feat: 增强更新功能,支持开发版本的自我升级检查;优化仪表板和应用日志页面的用户界面
This commit is contained in:
@@ -1,12 +1,22 @@
|
||||
import { dashboardNavigation } from '@/lib/constants/navigation';
|
||||
import type { NavigationItem } from '@/types/navigation';
|
||||
|
||||
const navigationPathAliases: Record<string, string> = {
|
||||
'/apply-log': '/node',
|
||||
};
|
||||
|
||||
function normalizeNavigationPath(pathname: string) {
|
||||
return navigationPathAliases[pathname] ?? pathname;
|
||||
}
|
||||
|
||||
export function isPathActive(pathname: string, href: string) {
|
||||
if (href === '/') {
|
||||
return pathname === '/';
|
||||
}
|
||||
|
||||
return pathname === href || pathname.startsWith(`${href}/`);
|
||||
const normalizedPathname = normalizeNavigationPath(pathname);
|
||||
|
||||
if (href === '/') {
|
||||
return normalizedPathname === '/';
|
||||
}
|
||||
|
||||
return normalizedPathname === href || normalizedPathname.startsWith(`${href}/`);
|
||||
}
|
||||
|
||||
export function isNavigationItemActive(pathname: string, item: NavigationItem): boolean {
|
||||
|
||||
Reference in New Issue
Block a user