diff --git a/frontend/src/app/category-view/page.tsx b/frontend/src/app/category-view/page.tsx index 7aaa8248..6050f4ae 100644 --- a/frontend/src/app/category-view/page.tsx +++ b/frontend/src/app/category-view/page.tsx @@ -1,6 +1,7 @@ "use client"; import React, { useEffect, useState } from "react"; +import { useRouter } from "next/navigation"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; import { Category } from "@/lib/types"; @@ -12,6 +13,7 @@ const MAX_DESCRIPTION_LENGTH = 100; // Set max length for description const CategoryView = () => { const [categories, setCategories] = useState([]); const [selectedCategory, setSelectedCategory] = useState(null); + const router = useRouter(); useEffect(() => { const fetchCategories = async () => { @@ -40,6 +42,10 @@ const CategoryView = () => { setSelectedCategory(null); }; + const handleScriptClick = (scriptSlug: string) => { + router.push(`/scripts?id=${scriptSlug}`); + }; + const truncateDescription = (text: string) => { return text.length > MAX_DESCRIPTION_LENGTH ? `${text.slice(0, MAX_DESCRIPTION_LENGTH)}...` @@ -61,7 +67,7 @@ const CategoryView = () => { {selectedCategory.scripts .sort((a, b) => a.name.localeCompare(b.name)) .map((script) => ( - + handleScriptClick(script.slug)}>
{
- Settings: CPU: {script.install_methods[0]?.resources.cpu || "N/A"}vCPU | RAM: {script.install_methods[0]?.resources.ram || "N/A"}MB | HDD: {script.install_methods[0]?.resources.hdd || "N/A"}GB + CPU: {script.install_methods[0]?.resources.cpu || "N/A"}vCPU | RAM: {script.install_methods[0]?.resources.ram || "N/A"}MB | HDD: {script.install_methods[0]?.resources.hdd || "N/A"}GB