diff --git a/resources/scripts/routers/AdminRouter.tsx b/resources/scripts/routers/AdminRouter.tsx index 4f918a06e4..edc620a029 100644 --- a/resources/scripts/routers/AdminRouter.tsx +++ b/resources/scripts/routers/AdminRouter.tsx @@ -12,7 +12,7 @@ import { ViewGridIcon, } from '@heroicons/react/outline'; import { useStoreState } from 'easy-peasy'; -import { useState } from 'react'; +import { ComponentType, useState } from 'react'; import { NavLink, Route, Routes } from 'react-router-dom'; import tw from 'twin.macro'; @@ -47,6 +47,87 @@ import Sidebar from '@/components/admin/Sidebar'; // import useUserPersistedState from '@/plugins/useUserPersistedState'; import UsersContainer from '@/components/admin/users/UsersContainer'; +type SidebarItem = { + name: string; + icon: ComponentType; + path: string; +}; + +type SidebarList = { + title: string; + items: SidebarItem[]; +}; + +type SidebarListObject = Record; + +const list: SidebarListObject = { + administration: { + title: 'Administration', + items: [ + { + name: 'Overview', + icon: OfficeBuildingIcon, + path: '/admin', + }, + { + name: 'Settings', + icon: CogIcon, + path: '/admin/settings', + }, + ], + }, + management: { + title: 'Management', + items: [ + { + name: 'Databases', + icon: DatabaseIcon, + path: '/admin/databases', + }, + { + name: 'Locations', + icon: GlobeIcon, + path: '/admin/locations', + }, + { + name: 'Nodes', + icon: ServerIcon, + path: '/admin/nodes', + }, + { + name: 'Servers', + icon: TerminalIcon, + path: '/admin/servers', + }, + { + name: 'Users', + icon: UsersIcon, + path: '/admin/users', + }, + { + name: 'Roles', + icon: UserGroupIcon, + path: '/admin/roles', + }, + ], + }, + services: { + title: 'Service Management', + items: [ + { + name: 'Nests', + icon: ViewGridIcon, + path: '/admin/nests', + }, + { + name: 'Mounts', + icon: FolderIcon, + path: '/admin/mounts', + }, + ], + }, +}; + function AdminRouter() { const email = useStoreState((state: ApplicationStore) => state.user.data!.email); const roleName = useStoreState((state: ApplicationStore) => state.user.data!.roleName); @@ -66,53 +147,21 @@ function AdminRouter() { {!collapsed ? (

{applicationName}

) : ( - {'Pterodactyl + {'Pterodactyl )} - Administration - - - Overview - - - - Settings - - Management - - - Databases - - - - Locations - - - - Nodes - - - - Servers - - - - Users - - - - Roles - - Service Management - - - Nests - - - - Mounts - + {Object.keys(list).map(key => ( + <> + {list[key]?.title} + {list[key]?.items.map(item => ( + + + {item.name} + + ))} + + ))}