feat: add text & numeric filters to insights routing responses (#18016)
* feat: improve text filters (WIP) * move function to bottom * apply some styles * fix selection of TextFilterOptions * rename value to operand * remove unused file * merge filters/filters into filters/utils * fix regression of not putting url params correctly * move makeWhereClause to filters/utils * fix negative, empty, and not empty operators * fix initial filtering from search state (url) * fix type errors * do not send an empty array to query * update yarn.lock * i18n for text filter operators * extract logic as useColumnFilters() * add missing import * fix type error * revert yarn.lock * use i18n * insensitive text match * move data-table to @calcom/features * fix type errors * fix type errors * fix type errors * feat: support DataTable filters for Insights Routing WIP * remove unused filters * remove additionalFilters and fix types * clean up filter components * support icons for ActiveFilters * support filters on json * fix filter ui * fix type error and clean up * revert changes * revert change * clean up * revert change * fix compatibility with insights booking page * remove unused params * fix type errors * update yarn.lock * fix field filter and adjust ui * chore: update yarn.lock * fix text filter * add Clear Filters button * add more test data * feat: support numeric filter WIP * feat: support numeric filter * feat: move People to an external filter * fixing query states * rename state to activeFilters * add useDataTable * fix ResponseCellValue bug and enable resizing for RoutingFormResponsesTable * fix response values * truncate attribute text * seed booking attendees * fix accessor (no actual change though) * add a gap * rename * use pathname as default identifier for DataTable * fix type error * support text filter for assignment reason * Apply suggestions from code review Co-authored-by: Alex van Andel <[email protected]> * rename fields to headers * use safeParse * fix type error * push yarn.lock with faker * fix MemberList --------- Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Alex van Andel <[email protected]> Co-authored-by: sean-brydon <[email protected]>
This commit is contained in:
36 files changed
+1162
-482
No files matched your search
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { keepPreviousData } from "@tanstack/react-query";
|
||||
import type { ColumnFiltersState } from "@tanstack/react-table";
|
||||
import {
|
||||
getCoreRowModel,
|
||||
getFilteredRowModel,
|
||||
@@ -19,10 +18,12 @@ import type { Dispatch, SetStateAction } from "react";
|
||||
|
||||
import {
|
||||
DataTable,
|
||||
DataTableProvider,
|
||||
DataTableToolbar,
|
||||
DataTableFilters,
|
||||
DataTableSelectionBar,
|
||||
useFetchMoreOnBottomReached,
|
||||
useColumnFilters,
|
||||
} from "@calcom/features/data-table";
|
||||
import { useOrgBranding } from "@calcom/features/ee/organizations/context/provider";
|
||||
import { DynamicLink } from "@calcom/features/users/components/UserTable/BulkActions/DynamicLink";
|
||||
@@ -150,6 +151,14 @@ interface Props {
|
||||
}
|
||||
|
||||
export default function MemberList(props: Props) {
|
||||
return (
|
||||
<DataTableProvider>
|
||||
<MemberListContent {...props} />
|
||||
</DataTableProvider>
|
||||
);
|
||||
}
|
||||
|
||||
function MemberListContent(props: Props) {
|
||||
const [dynamicLinkVisible, setDynamicLinkVisible] = useQueryState("dynamicLink", parseAsBoolean);
|
||||
const { t, i18n } = useLocale();
|
||||
const { data: session } = useSession();
|
||||
@@ -168,6 +177,8 @@ export default function MemberList(props: Props) {
|
||||
limit: 10,
|
||||
searchTerm: debouncedSearchTerm,
|
||||
teamId: props.team.id,
|
||||
// TODO: send `columnFilters` to server for server side filtering
|
||||
// filters: columnFilters,
|
||||
},
|
||||
{
|
||||
enabled: !!props.team.id,
|
||||
@@ -179,8 +190,7 @@ export default function MemberList(props: Props) {
|
||||
}
|
||||
);
|
||||
|
||||
// TODO (SEAN): Make Column filters a trpc query param so we can fetch serverside even if the data is not loaded
|
||||
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
|
||||
const columnFilters = useColumnFilters();
|
||||
const [rowSelection, setRowSelection] = useState({});
|
||||
|
||||
const removeMemberFromCache = ({
|
||||
@@ -625,7 +635,6 @@ export default function MemberList(props: Props) {
|
||||
columnFilters,
|
||||
rowSelection,
|
||||
},
|
||||
onColumnFiltersChange: setColumnFilters,
|
||||
onRowSelectionChange: setRowSelection,
|
||||
getCoreRowModel: getCoreRowModel(),
|
||||
getFilteredRowModel: getFilteredRowModel(),
|
||||
@@ -654,7 +663,7 @@ export default function MemberList(props: Props) {
|
||||
<DataTableToolbar.Root>
|
||||
<div className="flex w-full gap-2">
|
||||
<DataTableToolbar.SearchBar table={table} onSearch={(value) => setDebouncedSearchTerm(value)} />
|
||||
<DataTableFilters.FilterButton table={table} />
|
||||
<DataTableFilters.AddFilterButton table={table} />
|
||||
<DataTableFilters.ColumnVisibilityButton table={table} />
|
||||
{isAdminOrOwner && (
|
||||
<DataTableToolbar.CTA
|
||||
|
||||
Reference in new issue
Block a user