"use client" import { ColumnDef } from "@tanstack/react-table" import { ArrowUpDown, MoreHorizontal } from "lucide-react" import { Button } from "@/components/ui/button" import { Checkbox } from "@/components/ui/checkbox" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" export type Payment = { id: string amount: number status: "pending" | "processing" | "success" | "failed" email: string } 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: "status", header: "Status", cell: ({ row }) => (
{row.getValue("status")}
), }, { accessorKey: "email", header: ({ column }) => { return ( ) }, cell: ({ row }) =>
{row.getValue("email")}
, }, { accessorKey: "amount", header: () =>
Amount
, cell: ({ row }) => { const amount = parseFloat(row.getValue("amount")) // Format the amount as a dollar amount const formatted = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", }).format(amount) return
{formatted}
}, }, { id: "actions", enableHiding: false, cell: ({ row }) => { const payment = row.original return ( Actions navigator.clipboard.writeText(payment.id)} > Copy payment ID View customer View payment details ) }, }, ]