import DeleteModal from '@/components/inertia/delete-modal'; import { Button } from '@/components/ui/button'; import { Link, router } from '@inertiajs/react'; import { ColumnDef } from '@tanstack/react-table'; import { ArrowUpDown, Eye, Pencil, Trash2 } from 'lucide-react'; const TableColumn = (translate: LanguageTranslations): ColumnDef[] => { const { table } = translate; return [ { accessorKey: 'creator', header: ({ column }) => { return (
); }, cell: ({ row }) => (

{row.original.user.name}

{row.original.user.email}

), sortingFn: (a, b) => a.original.user.name.localeCompare(b.original.user.name), }, { accessorKey: 'title', header: table.title, cell: ({ row }) => (
{row.getValue('title')}
), }, { accessorKey: 'category', header: () => (

{table.category}

), cell: ({ row }) => (

{row.original.category?.name ?? '--'}

), sortingFn: (a, b) => (a.original.category?.name || '').localeCompare(b.original.category?.name || ''), }, { accessorKey: 'status', header: ({ column }) => (
), cell: ({ row }) =>
{row.getValue('status')}
, }, { id: 'actions', header: () =>
{table.action}
, cell: ({ row }) => { const blog = row.original; return (
} />
); }, }, ]; }; export default TableColumn;