revert: "feat: add membership creation date to Organization Member List table (CAL-5406) (#20595)" (#20978)
This reverts commit d21f7ccbc8.
This commit is contained in:
1 parent
eacd05bf3b
commit
5aaca2b7aa
13 files changed
+14
-152
No files matched your search
@@ -30,7 +30,6 @@ export function ActiveFilters<TData>({ table }: ActiveFiltersProps<TData>) {
|
||||
key={column.id}
|
||||
column={column}
|
||||
options={column.dateRangeOptions}
|
||||
showColumnName
|
||||
showClearButton
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -5,7 +5,6 @@ import { useState, useEffect, useCallback } from "react";
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { Badge } from "@calcom/ui/components/badge";
|
||||
import { Button, buttonClasses } from "@calcom/ui/components/button";
|
||||
import {
|
||||
Command,
|
||||
@@ -36,21 +35,14 @@ import { useFilterPopoverOpen } from "./useFilterPopoverOpen";
|
||||
type DateRangeFilterProps = {
|
||||
column: Extract<FilterableColumn, { type: ColumnFilterType.DATE_RANGE }>;
|
||||
options?: DateRangeFilterOptions;
|
||||
showColumnName?: boolean;
|
||||
showClearButton?: boolean;
|
||||
};
|
||||
|
||||
export const DateRangeFilter = ({
|
||||
column,
|
||||
options,
|
||||
showColumnName = false,
|
||||
showClearButton = false,
|
||||
}: DateRangeFilterProps) => {
|
||||
export const DateRangeFilter = ({ column, options, showClearButton = false }: DateRangeFilterProps) => {
|
||||
const { open, onOpenChange } = useFilterPopoverOpen(column.id);
|
||||
const filterValue = useFilterValue(column.id, ZDateRangeFilterValue);
|
||||
const { updateFilter, removeFilter } = useDataTable();
|
||||
const range = options?.range ?? "past";
|
||||
const endOfDay = options?.endOfDay ?? false;
|
||||
const forceCustom = range === "custom";
|
||||
const forcePast = range === "past";
|
||||
|
||||
@@ -81,13 +73,13 @@ export const DateRangeFilter = ({
|
||||
type: ColumnFilterType.DATE_RANGE,
|
||||
data: {
|
||||
startDate: startDate.toDate().toISOString(),
|
||||
endDate: (endOfDay ? endDate.endOf("day") : endDate).toDate().toISOString(),
|
||||
endDate: endDate.toDate().toISOString(),
|
||||
preset: preset.value,
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
[column.id, endOfDay]
|
||||
[column.id]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -145,10 +137,6 @@ export const DateRangeFilter = ({
|
||||
customButtonLabel = `${format(startDate.toDate(), "LLL dd, y")} - ?`;
|
||||
}
|
||||
|
||||
const selectedValue = isCustomPreset
|
||||
? customButtonLabel
|
||||
: t(selectedPreset.labelKey, selectedPreset.i18nOptions);
|
||||
|
||||
return (
|
||||
<Popover open={open} onOpenChange={onOpenChange}>
|
||||
<PopoverTrigger asChild>
|
||||
@@ -158,15 +146,8 @@ export const DateRangeFilter = ({
|
||||
StartIcon="calendar-range"
|
||||
EndIcon="chevron-down"
|
||||
data-testid={`filter-popover-trigger-${column.id}`}>
|
||||
{showColumnName && (
|
||||
<>
|
||||
<span>{column.title}</span>
|
||||
<Badge variant="gray" className="ml-2">
|
||||
{selectedValue}
|
||||
</Badge>
|
||||
</>
|
||||
)}
|
||||
{!showColumnName && <span>{selectedValue}</span>}
|
||||
{!isCustomPreset && <span>{t(selectedPreset.labelKey, selectedPreset.i18nOptions)}</span>}
|
||||
{isCustomPreset && <span>{customButtonLabel}</span>}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent className="flex w-fit p-0" align="end">
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
isMultiSelectFilterValue,
|
||||
isTextFilterValue,
|
||||
isNumberFilterValue,
|
||||
isDateRangeFilterValue,
|
||||
} from "./utils";
|
||||
|
||||
type MakeWhereClauseProps = {
|
||||
@@ -155,19 +154,6 @@ export function makeWhereClause(props: MakeWhereClauseProps) {
|
||||
default:
|
||||
throw new Error(`Invalid operator for number filter: ${operator}`);
|
||||
}
|
||||
} else if (isDateRangeFilterValue(filterValue)) {
|
||||
const { startDate, endDate } = filterValue.data;
|
||||
if (!startDate || !endDate) {
|
||||
throw new Error(`Invalid date range filter: ${JSON.stringify({ columnName, startDate, endDate })}`);
|
||||
}
|
||||
|
||||
return {
|
||||
[columnName]: {
|
||||
...jsonPathObj,
|
||||
gte: startDate,
|
||||
lte: endDate,
|
||||
},
|
||||
};
|
||||
}
|
||||
throw new Error(`Invalid filter type: ${JSON.stringify({ columnName, filterValue })}`);
|
||||
}
|
||||
@@ -113,8 +113,7 @@ export const ZFilterValue = z.union([
|
||||
]);
|
||||
|
||||
export type DateRangeFilterOptions = {
|
||||
range?: "past" | "custom";
|
||||
endOfDay?: boolean;
|
||||
range: "past" | "custom";
|
||||
};
|
||||
|
||||
export type TextFilterOptions = {
|
||||
|
||||
Reference in new issue
Block a user