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