feat: Update Auth Control

This commit is contained in:
web@ppanel
2025-01-13 21:07:27 +07:00
parent dd23279e3e
commit c59742a4f3
143 changed files with 4195 additions and 1512 deletions
+58 -9
View File
@@ -1,3 +1,42 @@
export const AuthControl = [
{
title: 'General',
url: '/dashboard/auth-control/general',
},
{
title: 'Email',
url: '/dashboard/auth-control/email',
},
{
title: 'Phone Number',
url: '/dashboard/auth-control/phone',
},
{
title: 'Apple',
url: '/dashboard/auth-control/apple',
},
{
title: 'Telegram',
url: '/dashboard/auth-control/telegram',
},
{
title: 'Google',
url: '/dashboard/auth-control/google',
},
{
title: 'Facebook',
url: '/dashboard/auth-control/facebook',
},
{
title: 'Twitter',
url: '/dashboard/auth-control/twitter',
},
{
title: 'GitHub',
url: '/dashboard/auth-control/github',
},
];
export const navs = [
{
title: 'Dashboard',
@@ -12,6 +51,12 @@ export const navs = [
url: '/dashboard/system',
icon: 'flat-color-icons:services',
},
{
title: 'Auth Control',
url: '/dashboard/auth-control',
icon: 'flat-color-icons:lock-portrait',
items: AuthControl,
},
{
title: 'Payment Config',
url: '/dashboard/payment',
@@ -82,16 +127,20 @@ export const navs = [
];
export function findNavByUrl(url: string) {
for (const nav of navs) {
if (nav.url && nav.url === url) {
return [nav];
}
if (nav.items) {
const current = nav.items.find((item) => item.url === url);
if (current) {
return [nav, current];
function findNav(items: any[], url: string, path: any[] = []): any[] {
for (const item of items) {
if (item.url === url) {
return [...path, item];
}
if (item.items) {
const result = findNav(item.items, url, [...path, item]);
if (result.length) {
return result;
}
}
}
return [];
}
return [];
return findNav(navs, url);
}