Centralize page category icons

This commit is contained in:
Nicola Spadari
2025-02-27 09:48:40 +01:00
parent 8f5efa0a17
commit d7e1017285
8 changed files with 12 additions and 12 deletions

View File

@@ -7,6 +7,11 @@ export default defineAppConfig({
nuxtSite: "https://nuxt.com", nuxtSite: "https://nuxt.com",
nuxtUiSite: "https://ui3.nuxt.dev" nuxtUiSite: "https://ui3.nuxt.dev"
}, },
icons: {
system: "lucide:square-terminal",
storage: "lucide:archive",
interface: "lucide:app-window-mac"
},
ui: { ui: {
colors: { colors: {
primary: "green", primary: "green",
@@ -37,11 +42,11 @@ export default defineAppConfig({
slots: { slots: {
trigger: "cursor-pointer", trigger: "cursor-pointer",
item: "md:py-2" item: "md:py-2"
}, }
}, },
navigationMenu: { navigationMenu: {
slots: { slots: {
link: "cursor-pointer", link: "cursor-pointer"
}, },
variants: { variants: {
disabled: { disabled: {

View File

@@ -1,5 +1,6 @@
export const usePages = () => { export const usePages = () => {
const router = useRouter(); const router = useRouter();
const { icons } = useAppConfig();
const routes = router.getRoutes().filter((route) => route.name !== "index" && route.name !== "all"); const routes = router.getRoutes().filter((route) => route.name !== "index" && route.name !== "all");
@@ -10,7 +11,7 @@ export const usePages = () => {
if (!acc[category]) { if (!acc[category]) {
acc[category] = { acc[category] = {
label: category.charAt(0).toUpperCase() + category.slice(1), label: category.charAt(0).toUpperCase() + category.slice(1),
icon: route.meta.categoryIcon || "i-lucide-folder", icon: icons[category as keyof typeof icons] || "i-lucide-folder",
to: route.path, to: route.path,
children: [] children: []
}; };
@@ -19,7 +20,7 @@ export const usePages = () => {
acc[category].children.push({ acc[category].children.push({
label: route.meta.name as string, label: route.meta.name as string,
description: route.meta.description as string, description: route.meta.description as string,
icon: `i-${route.meta.icon}`, icon: route.meta.icon,
to: route.path to: route.path
}); });

View File

@@ -28,8 +28,7 @@
name: "Shell commands", name: "Shell commands",
icon: "lucide:terminal", icon: "lucide:terminal",
description: "Execute shell commands", description: "Execute shell commands",
category: "system", category: "system"
categoryIcon: "lucide:square-terminal"
}); });
const schema = z.object({ const schema = z.object({

View File

@@ -24,7 +24,6 @@
name: "Files", name: "Files",
icon: "lucide:file-text", icon: "lucide:file-text",
category: "storage", category: "storage",
categoryIcon: "lucide:database",
description: "Create and manage files" description: "Create and manage files"
}); });

View File

@@ -24,7 +24,6 @@
name: "Notifications", name: "Notifications",
icon: "lucide:message-square-more", icon: "lucide:message-square-more",
category: "interface", category: "interface",
categoryIcon: "lucide:app-window-mac",
description: "Send native notifications" description: "Send native notifications"
}); });

View File

@@ -12,7 +12,6 @@
name: "OS Informations", name: "OS Informations",
icon: "lucide:info", icon: "lucide:info",
category: "system", category: "system",
categoryIcon: "lucide:square-terminal",
description: "Read operating system informations." description: "Read operating system informations."
}); });

View File

@@ -28,7 +28,6 @@
name: "Store", name: "Store",
icon: "lucide:database", icon: "lucide:database",
category: "storage", category: "storage",
categoryIcon: "lucide:database",
description: "Handle file creation in the file system" description: "Handle file creation in the file system"
}); });

View File

@@ -17,9 +17,8 @@
<script lang="ts" setup> <script lang="ts" setup>
definePageMeta({ definePageMeta({
name: "Webview", name: "Webview",
icon: "lucide:app-window-mac", icon: "lucide:app-window",
category: "interface", category: "interface",
categoryIcon: "lucide:app-window-mac",
description: "Create new webview in a detached window" description: "Create new webview in a detached window"
}); });