"use client"; import type { Table as ReactTableType } from "@tanstack/react-table"; import { useRef } from "react"; import { DataTable, DataTableToolbar, DataTablePagination, useFetchMoreOnBottomReached, } from "@calcom/features/data-table"; export type DataTableWrapperProps = { testId?: string; table: ReactTableType; isPending: boolean; hasNextPage: boolean; fetchNextPage: () => void; isFetching: boolean; totalDBRowCount?: number; ToolbarLeft?: React.ReactNode; ToolbarRight?: React.ReactNode; children: React.ReactNode; }; export function DataTableWrapper({ testId, table, isPending, hasNextPage, fetchNextPage, isFetching, totalDBRowCount, ToolbarLeft, ToolbarRight, children, }: DataTableWrapperProps) { const tableContainerRef = useRef(null); const fetchMoreOnBottomReached = useFetchMoreOnBottomReached({ tableContainerRef, hasNextPage, fetchNextPage, isFetching, }); return ( fetchMoreOnBottomReached(e.target as HTMLDivElement)}>
{ToolbarLeft}
{ToolbarRight}
{children} {totalDBRowCount && (
)} ); }