diff --git a/frontend/src/components/CommandMenu.tsx b/frontend/src/components/CommandMenu.tsx index e5157e03..f7171b28 100644 --- a/frontend/src/components/CommandMenu.tsx +++ b/frontend/src/components/CommandMenu.tsx @@ -14,24 +14,6 @@ import React, { useEffect } from "react"; import { Button } from "./ui/button"; import { DialogTitle } from "./ui/dialog"; -const sortCategories = (categories: Category[]): Category[] => { - return categories.sort((a: Category, b: Category) => { - if ( - a.catagoryName === "Proxmox VE Tools" && - b.catagoryName !== "Proxmox VE Tools" - ) { - return -1; - } else if ( - a.catagoryName !== "Proxmox VE Tools" && - b.catagoryName === "Proxmox VE Tools" - ) { - return 1; - } else { - return a.catagoryName.localeCompare(b.catagoryName); - } - }); -}; - export default function CommandMenu() { const [open, setOpen] = React.useState(false); const [links, setLinks] = React.useState([]); @@ -57,8 +39,7 @@ export default function CommandMenu() { ) .then((response) => response.json()) .then((categories) => { - const sortedCategories = sortCategories(categories); - setLinks(sortedCategories); + setLinks(categories); setIsLoading(false); }) .catch((error) => { @@ -91,21 +72,21 @@ export default function CommandMenu() { {isLoading ? "Loading..." : "No scripts found."} {links.map((category) => ( - {category.expand.items.map((script) => ( + {category.scripts.map((script) => ( { setOpen(false); - router.push(`/scripts?id=${script.title}`); + router.push(`/scripts?id=${script.name}`); }} >
setOpen(false)}> @@ -116,9 +97,9 @@ export default function CommandMenu() { alt="" className="h-5 w-5" /> - {script.title} + {script.name} - {script.item_type} + {script.type}