Revert "fix: replace filter implementations on bookings (#19445)" (#19506)

This reverts commit 641193bd61.
This commit is contained in:
Eunjae Lee authored and GitHub committed 2025-02-24 17:14:06 +00:00
1 parent 5f5cfaf7c7
commit f6af6e34bd
16 files changed
+147 -478

No files matched your search

@@ -5,12 +5,12 @@ import { useEffect, useRef } from "react";
import {
DataTable,
DataTableToolbar,
DataTablePagination,
useFetchMoreOnBottomReached,
useDataTable,
useColumnFilters,
} from "@calcom/features/data-table";
import { classNames } from "@calcom/lib";
export type DataTableWrapperProps<TData, TValue> = {
testId?: string;
@@ -25,7 +25,6 @@ export type DataTableWrapperProps<TData, TValue> = {
totalDBRowCount?: number;
ToolbarLeft?: React.ReactNode;
ToolbarRight?: React.ReactNode;
EmptyView?: React.ReactNode;
className?: string;
containerClassName?: string;
children?: React.ReactNode;
@@ -45,7 +44,6 @@ export function DataTableWrapper<TData, TValue>({
hideHeader,
ToolbarLeft,
ToolbarRight,
EmptyView,
className,
containerClassName,
children,
@@ -81,12 +79,21 @@ export function DataTableWrapper<TData, TValue>({
}));
}, [table, sorting, columnFilters, columnVisibility]);
const showEmptyView = table.getRowCount() === 0 && EmptyView;
return (
<>
<DataTable
testId={testId}
bodyTestId={bodyTestId}
table={table}
tableContainerRef={tableContainerRef}
isPending={isPending}
enableColumnResizing={true}
hideHeader={hideHeader}
variant={variant}
className={className}
containerClassName={containerClassName}
onScroll={(e) => fetchMoreOnBottomReached(e.target as HTMLDivElement)}>
{(ToolbarLeft || ToolbarRight || children) && (
<div className={classNames("grid w-full items-center gap-2 py-4", className)}>
<DataTableToolbar.Root>
<div className="flex w-full flex-col gap-2">
<div className="flex w-full flex-wrap justify-between gap-2">
<div className="flex flex-wrap items-center gap-2">{ToolbarLeft}</div>
@@ -95,29 +102,14 @@ export function DataTableWrapper<TData, TValue>({
</div>
{children}
</DataTableToolbar.Root>
)}
{totalDBRowCount && (
<div style={{ gridArea: "footer", marginTop: "1rem" }}>
<DataTablePagination table={table} totalDbDataCount={totalDBRowCount} />
</div>
)}
{showEmptyView && EmptyView}
{!showEmptyView && (
<DataTable
testId={testId}
bodyTestId={bodyTestId}
table={table}
tableContainerRef={tableContainerRef}
isPending={isPending}
enableColumnResizing={true}
hideHeader={hideHeader}
variant={variant}
className={className}
containerClassName={containerClassName}
onScroll={(e) => fetchMoreOnBottomReached(e.target as HTMLDivElement)}>
{totalDBRowCount && (
<div style={{ gridArea: "footer", marginTop: "1rem" }}>
<DataTablePagination table={table} totalDbDataCount={totalDBRowCount} />
</div>
)}
</DataTable>
)}
</>
</DataTable>
);
}