feat: server side sorting for insights routing (#18113)
* feat: server side sorting for insights routing ^ Conflicts: ^ packages/prisma/playground.ts * fix download csv * fix hooks locations
This commit is contained in:
1 parent
821a16648f
commit
a67b57b216
27 files changed
+797
-344
No files matched your search
@@ -75,7 +75,7 @@ export function DataTable<TData, TValue>({
|
||||
const columnSizingVars = useColumnSizingVars({ table });
|
||||
|
||||
usePersistentColumnResizing({
|
||||
enabled: Boolean(enableColumnResizing),
|
||||
enabled: Boolean(enableColumnResizing && identifier),
|
||||
table,
|
||||
tableContainerRef,
|
||||
identifier,
|
||||
@@ -118,8 +118,10 @@ export function DataTable<TData, TValue>({
|
||||
width: `var(--header-${kebabCase(header?.id)}-size)`,
|
||||
}}
|
||||
className={classNames(
|
||||
"bg-subtle hover:bg-muted relative flex shrink-0 items-center",
|
||||
header.column.getCanSort() ? "cursor-pointer select-none" : "",
|
||||
"relative flex shrink-0 items-center",
|
||||
header.column.getCanSort()
|
||||
? "bg-subtle hover:bg-muted cursor-pointer select-none"
|
||||
: "",
|
||||
meta?.sticky && "top-0 z-20 sm:sticky"
|
||||
)}>
|
||||
<div
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { ButtonProps } from "@calcom/ui";
|
||||
import { Button, Input } from "@calcom/ui";
|
||||
|
||||
import { useColumnFilters } from "../lib/utils";
|
||||
import { useColumnFilters } from "../hooks";
|
||||
|
||||
interface DataTableToolbarProps extends ComponentPropsWithoutRef<"div"> {
|
||||
children: React.ReactNode;
|
||||
|
||||
@@ -14,9 +14,9 @@ import {
|
||||
Icon,
|
||||
} from "@calcom/ui";
|
||||
|
||||
import { useDataTable, useFilterValue } from "../../hooks";
|
||||
import type { FilterableColumn } from "../../lib/types";
|
||||
import { ZMultiSelectFilterValue } from "../../lib/types";
|
||||
import { useDataTable, useFilterValue } from "../../lib/utils";
|
||||
|
||||
export type MultiSelectFilterOptionsProps = {
|
||||
column: Extract<FilterableColumn, { type: "multi_select" }>;
|
||||
|
||||
@@ -5,9 +5,9 @@ import { useForm, Controller } from "react-hook-form";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Form, Input, Select, Button } from "@calcom/ui";
|
||||
|
||||
import { useFilterValue, useDataTable } from "../../hooks";
|
||||
import type { FilterableColumn, NumberFilterOperator } from "../../lib/types";
|
||||
import { ZNumberFilterValue } from "../../lib/types";
|
||||
import { useFilterValue, useDataTable } from "../../lib/utils";
|
||||
|
||||
export type NumberFilterOperatorOption = {
|
||||
label: string;
|
||||
|
||||
@@ -14,9 +14,9 @@ import {
|
||||
Icon,
|
||||
} from "@calcom/ui";
|
||||
|
||||
import { useDataTable, useFilterValue } from "../../hooks";
|
||||
import type { FilterableColumn } from "../../lib/types";
|
||||
import { ZSingleSelectFilterValue } from "../../lib/types";
|
||||
import { useDataTable, useFilterValue } from "../../lib/utils";
|
||||
|
||||
export type SingleSelectFilterOptionsProps = {
|
||||
column: Extract<FilterableColumn, { type: "single_select" }>;
|
||||
|
||||
@@ -5,9 +5,9 @@ import { useForm, Controller } from "react-hook-form";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Form, Input, Select, Button } from "@calcom/ui";
|
||||
|
||||
import { useFilterValue, useDataTable } from "../../hooks";
|
||||
import type { FilterableColumn, TextFilterOperator } from "../../lib/types";
|
||||
import { ZTextFilterValue } from "../../lib/types";
|
||||
import { useFilterValue, useDataTable } from "../../lib/utils";
|
||||
|
||||
export type TextFilterOperatorOption = {
|
||||
label: string;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { type Table } from "@tanstack/react-table";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import startCase from "lodash/startCase";
|
||||
import { forwardRef, useState, useMemo, useCallback, Fragment } from "react";
|
||||
|
||||
import { classNames } from "@calcom/lib";
|
||||
@@ -22,8 +24,8 @@ import {
|
||||
Icon,
|
||||
} from "@calcom/ui";
|
||||
|
||||
import { useDataTable } from "../../hooks";
|
||||
import type { FilterableColumn, ExternalFilter } from "../../lib/types";
|
||||
import { convertToTitleCase, useDataTable } from "../../lib/utils";
|
||||
import { FilterOptions } from "./FilterOptions";
|
||||
|
||||
interface ColumnVisiblityProps<TData> {
|
||||
@@ -164,7 +166,7 @@ function AddFilterButtonComponent<TData>(
|
||||
key={column.id}
|
||||
onSelect={() => handleAddFilter(column.id)}
|
||||
className="px-4 py-2">
|
||||
{convertToTitleCase(column.title)}
|
||||
{startCase(column.title)}
|
||||
</CommandItem>
|
||||
);
|
||||
})}
|
||||
@@ -257,7 +259,7 @@ function ActiveFilters<TData>({ table, externalFilters }: ActiveFiltersProps<TDa
|
||||
<PopoverTrigger asChild>
|
||||
<Button color="secondary">
|
||||
<Icon name={icon} className="mr-2 h-4 w-4" />
|
||||
{convertToTitleCase(column.title)}
|
||||
{startCase(column.title)}
|
||||
<Icon name="chevron-down" className="ml-2 h-4 w-4" />
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
|
||||
Reference in new issue
Block a user