"use client"; import { ColumnDef } from "@tanstack/react-table"; import { Eye, MoreVertical, SquarePen, Trash2 } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Checkbox } from "@/components/ui/checkbox"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Badge } from "@/components/ui/badge"; import { cn } from "@/lib/utils"; export type DataProps = { id: string | number; order: string; customer: { name: string; }; date: string; quantity: number; amount: string; status: "paid" | "due" | "canceled"; action: React.ReactNode; }; export const columns: ColumnDef[] = [ // { // id: "select", // header: ({ table }) => ( // table.toggleAllPageRowsSelected(!!value)} // aria-label="Select all" // /> // ), // cell: ({ row }) => ( //
// row.toggleSelected(!!value)} // aria-label="Select row" // /> //
// ), // enableSorting: false, // enableHiding: false, // }, { accessorKey: "id", header: "No", cell: ({ row }) => {row.getValue("id")}, }, { accessorKey: "order", header: "Judul", cell: ({ row }) => (
{row.getValue("order")},
), }, { accessorKey: "customer", header: "Kategory", cell: ({ row }) => { const user = row.original.customer; return (
{user?.name ?? "Unknown User"}
); }, }, { accessorKey: "date", header: "Tanggal unggah", cell: ({ row }) => { return {row.getValue("date")}; }, }, { accessorKey: "quantity", header: "Kreator", cell: ({ row }) => { return {row.getValue("quantity")}; }, }, { accessorKey: "amount", header: "Sumber", cell: ({ row }) => { return {row.getValue("amount")}; }, }, { accessorKey: "amount", header: "Penempatan File", cell: ({ row }) => { return {row.getValue("amount")}; }, }, { accessorKey: "status", header: "Status", cell: ({ row }) => { const statusColors: Record = { paid: "bg-success/20 text-success", due: "bg-warning/20 text-warning", canceled: "bg-destructive/20 text-destructive", }; const status = row.getValue("status"); const statusStyles = statusColors[status] || "default"; return ( {status}{" "} ); }, }, { accessorKey: "amount", header: "Kurasi Konten", cell: ({ row }) => { return {row.getValue("amount")}; }, }, { accessorKey: "amount", header: "Saran", cell: ({ row }) => { return {row.getValue("amount")}; }, }, { id: "actions", accessorKey: "action", header: "Actions", enableHiding: false, cell: ({ row }) => { return ( View Edit Delete ); }, }, ];