diff --git a/app/components/Site/Navbar.vue b/app/components/Site/Navbar.vue index c02cbee..6bc3b11 100644 --- a/app/components/Site/Navbar.vue +++ b/app/components/Site/Navbar.vue @@ -13,6 +13,7 @@ variant="link" :ui="{ root: 'hidden md:flex', + viewportWrapper: 'max-w-2xl absolute-center-h', list: 'md:gap-x-2' }" /> diff --git a/app/composables/pages.ts b/app/composables/pages.ts index 1f96d51..62a853a 100644 --- a/app/composables/pages.ts +++ b/app/composables/pages.ts @@ -1,13 +1,32 @@ export const usePages = () => { const router = useRouter(); - const pages = router.getRoutes().filter((route) => route.name !== "index" && route.name !== "all").map((route) => { - return { - label: route.meta.name, - to: route.path, - icon: route.meta.icon - }; - }); + const routes = router.getRoutes().filter((route) => route.name !== "index" && route.name !== "all"); + + const categorizedRoutes = routes.reduce((acc, route) => { + const category = route.meta.category as string; + if (!category) return acc; + + if (!acc[category]) { + acc[category] = { + label: category.charAt(0).toUpperCase() + category.slice(1), + icon: route.meta.categoryIcon || "i-lucide-folder", + to: route.path, + children: [] + }; + } + + acc[category].children.push({ + label: route.meta.name as string, + description: route.meta.description as string, + icon: `i-${route.meta.icon}`, + to: route.path + }); + + return acc; + }, {} as Record); + + const pages = Object.values(categorizedRoutes); return { pages diff --git a/app/pages/commands.vue b/app/pages/commands.vue index fca35ca..4d16482 100644 --- a/app/pages/commands.vue +++ b/app/pages/commands.vue @@ -25,8 +25,11 @@