"use client" import { useMemo } from "react" import { type ColumnDef, getCoreRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from "@tanstack/react-table" import type { Domain } from "@/lib/data" import { DataGridShell } from "@/components/data-grids/shared/data-grid-shell" import { DATA_GRID_CELL_PAD, DATA_GRID_CELL_PAD_FIRST, DATA_GRID_CELL_PAD_LAST, } from "@/components/data-grids/shared/data-grid-layout" import { DataGridSortHeader } from "@/components/data-grids/shared/data-grid-sort-header" import { EmptyState } from "@/components/empty-state" import { FilterIcon, GlobeIcon } from "lucide-react" interface DomainsDataGridProps { domains: Domain[] isLoading?: boolean pagination?: boolean } function DomainsDataGrid({ domains, isLoading, pagination = false }: DomainsDataGridProps) { const columns = useMemo[]>( () => [ { id: "domain", accessorKey: "domain", header: ({ column }) => , cell: ({ row }) => {row.original.domain}, meta: { headerTitle: "Домен", headerClassName: DATA_GRID_CELL_PAD_FIRST, cellClassName: DATA_GRID_CELL_PAD_FIRST, }, }, { id: "resolvedIp", accessorKey: "resolvedIp", header: ({ column }) => , cell: ({ row }) => ( {row.original.resolvedIp} ), meta: { headerTitle: "Resolved IP", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD, }, }, { id: "asn", accessorKey: "asn", header: ({ column }) => , cell: ({ row }) => {row.original.asn}, meta: { headerTitle: "ASN", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD, }, }, { id: "purpose", accessorKey: "purpose", header: ({ column }) => , cell: ({ row }) => ( {row.original.purpose} ), meta: { headerTitle: "Назначение", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD, }, }, { id: "filter", accessorKey: "filter", header: ({ column }) => , cell: ({ row }) => ( {row.original.filter} ), meta: { headerTitle: "Фильтр", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD, }, }, { id: "updated", accessorKey: "updated", header: ({ column }) => , cell: ({ row }) => {row.original.updated}, meta: { headerTitle: "Обновлён", headerClassName: DATA_GRID_CELL_PAD, cellClassName: DATA_GRID_CELL_PAD, }, }, { id: "enabled", accessorKey: "enabled", header: ({ column }) => , cell: ({ row }) => ( {row.original.enabled ? "Активен" : "Отключён"} ), meta: { headerTitle: "Статус", headerClassName: DATA_GRID_CELL_PAD_LAST, cellClassName: DATA_GRID_CELL_PAD_LAST, }, }, ], [], ) const table = useReactTable({ data: domains, columns, getCoreRowModel: getCoreRowModel(), getSortedRowModel: getSortedRowModel(), ...(pagination ? { getPaginationRowModel: getPaginationRowModel() } : {}), getRowId: (row) => row.id, }) return ( } title="Нет доменов" description="Добавьте домены или импортируйте каталог" className="border-0 py-12" /> } /> ) } export { DomainsDataGrid, type DomainsDataGridProps }