"use client" import { Course } from "@/app/admin/courses/page" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" import { ColumnDef } from "@tanstack/react-table" import { Edit, IndianRupee, List, MoreHorizontal, MoreVertical, Trash } from "lucide-react" import Link from "next/link" // This type is used to define the shape of our data. // You can use a Zod schema here if you want. export const createColumns = ( handleEdit: (data: Course) => void, handleDelete: (data: Course) => void ): ColumnDef[] => [ { accessorKey: "name", header: "Name", }, { accessorKey: "description", header: "Description", cell: ({ row }) => { return
{ row.original.description }
} }, { accessorKey: 'level', header: "Level", cell: ({ row }) => { return {row.original.level} } }, { accessorKey: 'categoryId', header: "Category", cell: ({ row }) => { return {row.original.category.name} } }, { accessorKey: 'price', header: "Price", cell: ({ row }) => { return
{row.original.price}
} }, { accessorKey: "duration", header: "Duration", cell: ({ row }) => { return
{row.original.duration} Hours
} }, { header: "Actions", id: "actions", cell: ({ row }) => ( View / Add Sections handleEdit(row.original)}> Edit Course handleDelete(row.original)} className="text-red-600"> Delete Course ), } ]