gitscope
← marzneshin / v0.5.3 / dashboard/src/features/services/components/tables/inbounds/columns.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/features/services/components/tables/inbounds/columns.tsx · TypeScript
Blame Raw
 1
 2import { ColumnDef } from "@tanstack/react-table"
 3import { InboundType } from "@marzneshin/features/inbounds"
 4import { DataTableColumnHeader } from "@marzneshin/components/data-table/column-header"
 5import i18n from "@marzneshin/features/i18n"
 6import { Badge, Checkbox } from "@marzneshin/components"
 7
 8export const columns: ColumnDef<InboundType>[] = [
 9    {
10        id: "select",
11        header: ({ table }) => (
12            <Checkbox
13                checked={
14                    table.getIsAllPageRowsSelected() ||
15                    (table.getIsSomePageRowsSelected() && "indeterminate")
16                }
17                onCheckedChange={(value) => {
18                    table.toggleAllPageRowsSelected(!!value)
19                }}
20                aria-label="Select all"
21            />
22        ),
23        cell: ({ row }) => (
24            <Checkbox
25                checked={row.getIsSelected()}
26                onCheckedChange={(value) => row.toggleSelected(!!value)}
27                aria-label="Select row"
28            />
29        ),
30        enableSorting: false,
31        enableHiding: false,
32    },
33    {
34        accessorKey: "tag",
35        header: ({ column }) => <DataTableColumnHeader title={i18n.t('tag')} column={column} />,
36    },
37    {
38        accessorKey: 'protocol',
39        header: ({ column }) => <DataTableColumnHeader title={i18n.t('protocol')} column={column} />,
40        cell: ({ row }) => (
41            <Badge className="py-1 px-2"> {row.original.protocol} </Badge>
42        )
43    },
44    {
45        accessorKey: 'node',
46        header: ({ column }) => <DataTableColumnHeader title={i18n.t('nodes')} column={column} />,
47        cell: ({ row }) => (
48            <Badge className="py-1 px-2"> {row.original.node.name} </Badge>
49        )
50    }
51];