'use client'; import { DataTableColumnCell } from '@/components/blocks/data-table/data-table-column-cell'; import { DataTableColumnHeader } from '@/components/blocks/data-table/data-table-column-header'; import { EvmAddress } from '@/components/blocks/evm-address/evm-address'; import { TransactionHash } from '@/components/blocks/transaction-hash/transaction-hash'; import { formatDate } from '@/lib/date'; import { createColumnHelper } from '@tanstack/react-table'; import { CheckCircle, Clock, XCircle } from 'lucide-react'; import type { Address } from 'viem'; import { TransactionDetailSheet } from './transaction-table-detail-sheet'; import type { TransactionListItem } from './transactions-table-data'; const columnHelper = createColumnHelper(); export const columns = [ columnHelper.accessor('status', { header: ({ column }) => Status, cell: ({ getValue }) => { const status = getValue(); const Icon = status === 'Success' ? icons.success : status === 'Failed' ? icons.failed : icons.pending; return (
{status}
); }, }), columnHelper.accessor('createdAt', { header: ({ column }) => Timestamp, cell: ({ getValue }) => {formatDate(getValue() ?? new Date())}, enableColumnFilter: false, }), columnHelper.accessor('functionName', { header: ({ column }) => Function, cell: ({ getValue }) => {getValue()}, }), columnHelper.accessor('from', { header: ({ column }) => From, cell: ({ getValue }) => ( ), }), columnHelper.accessor('address', { header: ({ column }) => Contract, cell: ({ getValue }) => ( ), }), columnHelper.accessor('transactionHash', { header: ({ column }) => Transaction, cell: ({ getValue }) => ( ), }), columnHelper.display({ id: 'actions', header: () => '', cell: ({ row }) => ( ), meta: { enableCsvExport: false, }, }), ]; export const icons = { success: CheckCircle, failed: XCircle, pending: Clock, };