"use client" import { category } from "@/app/admin/categories/page" import { Button } from "@/components/ui/button" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" import { ColumnDef } from "@tanstack/react-table" import { Edit, MoreHorizontal, MoreVertical, Trash } from "lucide-react" import * as LucideIcons from 'lucide-react' // This type is used to define the shape of our data. // You can use a Zod schema here if you want. type Category = { id: string name: string icon: string _count: any } export const createColumns = ( handleEdit: (data: category) => void, handleDelete: (data: category) => void ): ColumnDef[] => [ { accessorKey: "name", header: "Name", }, { accessorKey: "icon", header: "Icon", cell: ({ row }) => { const IconComponent = (LucideIcons as any)[row.original.icon]; return IconComponent ? :

Invalid Icon

} }, { accessorKey: "_count", header: "Total Courses", cell: ({ row }) => (

{row.original._count.courses}

) }, { header: "Actions", id: "actions", cell: ({ row }) => ( handleEdit(row.original)}> Edit handleDelete(row.original)} className="text-red-600"> Delete ), } ]