feat(dashboard): ability to locate new admin route under existing route (#10587)
This PR add ability to locate new admin route under existing route in sidebar. For example, new route Brands   https://github.com/user-attachments/assets/b46b1813-e92e-4b67-84a1-84660023ac7c
This commit is contained in:
@@ -284,6 +284,19 @@ const Searchbar = () => {
|
||||
const CoreRouteSection = () => {
|
||||
const coreRoutes = useCoreRoutes()
|
||||
|
||||
const { getMenu } = useDashboardExtension()
|
||||
|
||||
const menuItems = getMenu("coreExtensions")
|
||||
|
||||
menuItems.forEach((item) => {
|
||||
if (item.nested) {
|
||||
const route = coreRoutes.find((route) => route.to === item.nested)
|
||||
if (route) {
|
||||
route.items?.push(item)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<nav className="flex flex-col gap-y-1 py-3">
|
||||
<Searchbar />
|
||||
@@ -298,7 +311,7 @@ const ExtensionRouteSection = () => {
|
||||
const { t } = useTranslation()
|
||||
const { getMenu } = useDashboardExtension()
|
||||
|
||||
const menuItems = getMenu("coreExtensions")
|
||||
const menuItems = getMenu("coreExtensions").filter((item) => !item.nested)
|
||||
|
||||
if (!menuItems.length) {
|
||||
return null
|
||||
|
||||
@@ -26,6 +26,7 @@ export type INavItem = {
|
||||
items?: NestedItemProps[]
|
||||
type?: ItemType
|
||||
from?: string
|
||||
nested?: string
|
||||
}
|
||||
|
||||
const BASE_NAV_LINK_CLASSES =
|
||||
|
||||
Reference in New Issue
Block a user