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