import type { ColumnDef } from "@tanstack/react-table"; import { useReactTable, getCoreRowModel } from "@tanstack/react-table"; import { usePathname } from "next/navigation"; import { useRef, useState } from "react"; import { DataTableProvider } from "@calcom/features/data-table/DataTableProvider"; import { DataTable, DataTableToolbar } from "@calcom/features/data-table/components"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import CreateTeamDialog from "./CreateTeamDialog"; import GroupNameCell from "./GroupNameCell"; interface TeamGroupMapping { name: string; id: number; groupNames: string[]; directoryId: string; } const GroupTeamMappingTable = () => { const pathname = usePathname(); if (!pathname) return null; return ( ); }; const GroupTeamMappingTableContent = () => { const { t } = useLocale(); const [createTeamDialogOpen, setCreateTeamDialogOpen] = useState(false); const { data } = trpc.viewer.dsync.teamGroupMapping.get.useQuery(); const tableContainerRef = useRef(null); const columns: ColumnDef[] = [ { id: "name", header: t("team"), size: 200, enableHiding: false, enableSorting: false, cell: ({ row }) => { const { name } = row.original; return

{name}

; }, }, { id: "group", header: t("group_name"), size: 500, enableHiding: false, enableSorting: false, cell: ({ row }) => { const { id, groupNames, directoryId } = row.original; return ; }, }, ]; const table = useReactTable({ data: data?.teamGroupMapping ?? [], columns, getCoreRowModel: getCoreRowModel(), }); return ( <> setCreateTeamDialogOpen(true)}> Create team ); }; export default GroupTeamMappingTable;