From adfbff63bc56fb35942af314c7e9c3be5197900f Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 27 Jan 2025 14:15:42 +0100 Subject: [PATCH] Update page.tsx --- frontend/src/app/category-view/page.tsx | 46 +++++++++++++------------ 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/frontend/src/app/category-view/page.tsx b/frontend/src/app/category-view/page.tsx index 4797f74a..0b5ffa15 100644 --- a/frontend/src/app/category-view/page.tsx +++ b/frontend/src/app/category-view/page.tsx @@ -67,12 +67,12 @@ const CategoryView = () => { const cpu = script.install_methods[0]?.resources.cpu; const ram = script.install_methods[0]?.resources.ram; const hdd = script.install_methods[0]?.resources.hdd; - + const resourceParts = []; if (cpu) resourceParts.push(CPU: {cpu}vCPU); if (ram) resourceParts.push(RAM: {ram}MB); if (hdd) resourceParts.push(HDD: {hdd}GB); - + return resourceParts.length > 0 ? (
{resourceParts.map((part, index) => ( @@ -85,6 +85,14 @@ const CategoryView = () => { ) : null; }; + const renderType = (type: string) => { + return ( + + {type.toUpperCase()} + + ); + }; + return (
{categories.length === 0 && ( @@ -122,25 +130,19 @@ const CategoryView = () => { onClick={() => handleScriptClick(script.slug)} > -
- {script.name} -
-

{script.name}

-

- Created at: {script.date_created || "No date available"} -

-

- {truncateDescription(script.description || "No description available.")} -

-
+
+

{script.name}

+ {renderType(script.type || "MISC")}
+

+ Created at: {script.date_created || "No date available"} +

+

+ {truncateDescription(script.description || "No description available.")} +

{renderResources(script)} @@ -162,9 +164,9 @@ const CategoryView = () => {
{/* Categories Grid */}
-

Categories

+

Categories

- {categories.reduce((acc, cat) => acc + (cat.scripts?.length || 0), 0)} Total scripts + {new Set(categories.flatMap((cat) => cat.scripts.map((s) => s.slug))).size} Total scripts