"use client" import type { ColumnDef } from "@tanstack/react-table" import { Badge } from "@/components/ui/badge" import { Checkbox } from "@/components/ui/checkbox" import { MoreHorizontal } from "lucide-react" import { Button } from "@/components/ui/button" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { formatDate } from "date-fns" export type User = { id: string email: string first_name: string | null last_name: string | null role: string created_at: string last_sign_in_at: string | null email_confirmed_at: string | null is_anonymous: boolean banned_until: string | null } export const columns: ColumnDef[] = [ { id: "select", header: ({ table }) => ( table.toggleAllPageRowsSelected(!!value)} aria-label="Select all" /> ), cell: ({ row }) => ( row.toggleSelected(!!value)} aria-label="Select row" onClick={(e) => e.stopPropagation()} /> ), enableSorting: false, enableHiding: false, }, { accessorKey: "email", header: "Email", cell: ({ row }) =>
{row.getValue("email")}
, }, { accessorKey: "first_name", header: "First Name", cell: ({ row }) =>
{row.getValue("first_name") || "-"}
, }, { accessorKey: "last_name", header: "Last Name", cell: ({ row }) =>
{row.getValue("last_name") || "-"}
, }, { accessorKey: "role", header: "Role", cell: ({ row }) => ( {row.getValue("role")} ), }, { accessorKey: "created_at", header: "Created At", cell: ({ row }) =>
{formatDate(new Date(row.getValue("created_at")), "yyyy-MM-dd")}
, }, { accessorKey: "email_confirmed_at", header: "Email Verified", cell: ({ row }) => { const verified = row.getValue("email_confirmed_at") !== null return {verified ? "Verified" : "Unverified"} }, }, { id: "actions", cell: ({ row }) => { const user = row.original return ( e.stopPropagation()}> Actions Edit user Reset password Send magic link Delete user ) }, }, ]