// Folder: category-view // File: index.tsx import React, { useState } from 'react'; import { Card, CardContent, CardHeader } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Grid } from '@/components/ui/grid'; import routes from '@/routes'; // Assuming your route.ts file is at this location const CategoryView = () => { const [selectedCategory, setSelectedCategory] = useState(null); const handleCategoryClick = (category) => { setSelectedCategory(category); }; const handleBackClick = () => { setSelectedCategory(null); }; const categories = routes.map((route) => ({ name: route.category, scripts: route.scripts.map((script) => ({ name: script.name, date: script.date || 'N/A', // Assuming scripts have a `date` field })), })); return (
{selectedCategory ? (

{selectedCategory.name}

{selectedCategory.scripts .sort((a, b) => a.name.localeCompare(b.name)) .map((script) => (

{script.name}

{script.date}

))}
) : (

Categories

{categories.map((category) => ( handleCategoryClick(category)} className="cursor-pointer hover:shadow-lg"> ))}
)}
); }; export default CategoryView;