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