refactor: Cal.diy (#28903)
* feat: Cal.diy — community-driven MIT-licensed fork of Cal.com This squashed commit contains all Cal.diy changes applied on top of calcom/cal.com main: - Rebrand Cal.com to Cal.diy across the entire codebase - Remove Enterprise Edition (EE) features, license checks, and AGPL restrictions - Switch license from AGPL-3.0 to MIT - Remove docs/ directory (migrated to Nextra at cal.diy) - Remove dead code: org tests, EE tips, platform nav, premium username, SAML/SSO, etc. - Clean up .env.example for self-hosted Cal.diy - Update Docker image references to calcom/cal.diy - Update README, CONTRIBUTING.md, and issue templates for Cal.diy community fork - Add PR welcome bot for Cal.diy contributors - Fix API v2 breaking changes oasdiff ignore entries - Replace Blacksmith CI runners with default GitHub Actions 3893 files changed, 20789 insertions(+), 411020 deletions(-) Co-Authored-By: [email protected] <[email protected]> * refactor: remove org-specific /organizations/:orgId endpoints from API v2 atoms controllers (#1701) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: revert Cal.diy Inc to Cal.com, Inc. in license files, copyright notices, and package metadata (#1702) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * rip out org related comments in api v2 --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
a17f28e9ab
commit
ab21c7f805
4080 files changed
+14403
-404922
No files matched your search
@@ -1,26 +1,25 @@
|
||||
"use client";
|
||||
|
||||
import type { SortingState, OnChangeFn, VisibilityState, ColumnSizingState } from "@tanstack/react-table";
|
||||
import { createContext, useMemo } from "react";
|
||||
|
||||
import {
|
||||
DataTableStateProvider,
|
||||
DataTableSegmentProvider,
|
||||
DataTableFiltersProvider,
|
||||
useDataTableState,
|
||||
useDataTableSegment,
|
||||
useDataTableFilters,
|
||||
} from "./contexts";
|
||||
import type { ActiveFiltersValidatorState } from "./contexts";
|
||||
import type {
|
||||
FilterValue,
|
||||
FilterSegmentOutput,
|
||||
SystemFilterSegment,
|
||||
CombinedFilterSegment,
|
||||
SegmentIdentifier,
|
||||
ActiveFilters,
|
||||
CombinedFilterSegment,
|
||||
FilterSegmentOutput,
|
||||
FilterValue,
|
||||
SegmentIdentifier,
|
||||
SystemFilterSegment,
|
||||
UseSegments,
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import type { ColumnSizingState, OnChangeFn, SortingState, VisibilityState } from "@tanstack/react-table";
|
||||
import { createContext, useMemo } from "react";
|
||||
import type { ActiveFiltersValidatorState } from "./contexts";
|
||||
import {
|
||||
DataTableFiltersProvider,
|
||||
DataTableSegmentProvider,
|
||||
DataTableStateProvider,
|
||||
useDataTableFilters,
|
||||
useDataTableSegment,
|
||||
useDataTableState,
|
||||
} from "./contexts";
|
||||
|
||||
export type { ActiveFiltersValidatorState };
|
||||
export type { ActiveFiltersValidator } from "./contexts";
|
||||
|
||||
@@ -1,30 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import type { Row } from "@tanstack/react-table";
|
||||
import { flexRender } from "@tanstack/react-table";
|
||||
import type { Table as ReactTableType, Header, HeaderGroup } from "@tanstack/react-table";
|
||||
import { useVirtualizer, type Virtualizer, type VirtualItem } from "@tanstack/react-virtual";
|
||||
import kebabCase from "lodash/kebabCase";
|
||||
import { useEffect, useState, memo, useMemo } from "react";
|
||||
|
||||
import type { SeparatorRow } from "@calcom/features/data-table/lib/separator";
|
||||
import { isSeparatorRow } from "@calcom/features/data-table/lib/separator";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { Command, CommandList, CommandItem } from "@calcom/ui/components/command";
|
||||
import { ArrowDownIcon, ArrowUpIcon, CheckIcon, ChevronsUpDownIcon, EyeOffIcon } from "@coss/ui/icons";
|
||||
import { Popover, PopoverTrigger, PopoverContent } from "@calcom/ui/components/popover";
|
||||
import { Command, CommandItem, CommandList } from "@calcom/ui/components/command";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@calcom/ui/components/popover";
|
||||
import {
|
||||
TableNew,
|
||||
TableBody,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableNew,
|
||||
TableRow,
|
||||
} from "@calcom/ui/components/table";
|
||||
|
||||
import { useColumnSizingVars } from "~/data-table/hooks/useColumnSizingVars";
|
||||
import { ArrowDownIcon, ArrowUpIcon, CheckIcon, ChevronsUpDownIcon, EyeOffIcon } from "@coss/ui/icons";
|
||||
import type { Header, HeaderGroup, Table as ReactTableType, Row } from "@tanstack/react-table";
|
||||
import { flexRender } from "@tanstack/react-table";
|
||||
import { useVirtualizer, type VirtualItem, type Virtualizer } from "@tanstack/react-virtual";
|
||||
import kebabCase from "lodash/kebabCase";
|
||||
import { memo, useEffect, useMemo, useState } from "react";
|
||||
import { useColumnResizing } from "~/data-table/hooks/useColumnResizing";
|
||||
import type { SeparatorRow } from "@calcom/features/data-table/lib/separator";
|
||||
import { isSeparatorRow } from "@calcom/features/data-table/lib/separator";
|
||||
import { useColumnSizingVars } from "~/data-table/hooks/useColumnSizingVars";
|
||||
|
||||
export type DataTablePropsFromWrapper<TData> = {
|
||||
table: ReactTableType<TData>;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { type Table } from "@tanstack/react-table";
|
||||
|
||||
import { Pagination } from "@calcom/ui/components/pagination";
|
||||
|
||||
import type { Table } from "@tanstack/react-table";
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
|
||||
interface DataTablePaginationProps<TData> {
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
"use client";
|
||||
|
||||
import type { Table } from "@tanstack/react-table";
|
||||
import { forwardRef, useEffect } from "react";
|
||||
import type { ComponentPropsWithoutRef } from "react";
|
||||
import { useState, type Ref, type ChangeEvent } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { Button, type ButtonProps } from "@calcom/ui/components/button";
|
||||
import { FilterSearchField } from "@calcom/ui/components/form";
|
||||
|
||||
import type { Table } from "@tanstack/react-table";
|
||||
import type { ComponentPropsWithoutRef } from "react";
|
||||
import { type ChangeEvent, forwardRef, type Ref, useEffect, useState } from "react";
|
||||
import { useColumnFilters, useDataTable } from "~/data-table/hooks";
|
||||
|
||||
interface DataTableToolbarProps extends ComponentPropsWithoutRef<"div"> {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import { type Table } from "@tanstack/react-table";
|
||||
|
||||
import { useDataTable, useFilterableColumns } from "~/data-table/hooks";
|
||||
import { ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import type { Table } from "@tanstack/react-table";
|
||||
import { useDataTable, useFilterableColumns } from "~/data-table/hooks";
|
||||
import { DateRangeFilter } from "./DateRangeFilter";
|
||||
import { FilterPopover } from "./FilterPopover";
|
||||
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { type Table } from "@tanstack/react-table";
|
||||
import startCase from "lodash/startCase";
|
||||
import { forwardRef, useState } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Command, CommandInput, CommandList, CommandEmpty, CommandItem } from "@calcom/ui/components/command";
|
||||
import { EyeOffIcon, PlusIcon } from "@coss/ui/icons";
|
||||
import { Popover, PopoverTrigger, PopoverContent } from "@calcom/ui/components/popover";
|
||||
import { Command, CommandEmpty, CommandInput, CommandItem, CommandList } from "@calcom/ui/components/command";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@calcom/ui/components/popover";
|
||||
import { Tooltip } from "@calcom/ui/components/tooltip";
|
||||
|
||||
import { EyeOffIcon, PlusIcon } from "@coss/ui/icons";
|
||||
import type { Table } from "@tanstack/react-table";
|
||||
import startCase from "lodash/startCase";
|
||||
import { forwardRef, useState } from "react";
|
||||
import { useDataTable, useFilterableColumns } from "~/data-table/hooks";
|
||||
|
||||
export interface AddFilterButtonProps<TData> {
|
||||
|
||||
@@ -1,28 +1,26 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo } from "react";
|
||||
|
||||
import type {
|
||||
FilterableColumn as _FilterableColumn,
|
||||
FacetedValue,
|
||||
FilterValueSchema,
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { buttonClasses } from "@calcom/ui/components/button";
|
||||
import {
|
||||
Command,
|
||||
CommandInput,
|
||||
CommandList,
|
||||
CommandEmpty,
|
||||
CommandItem,
|
||||
CommandSeparator,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
CommandSeparator,
|
||||
} from "@calcom/ui/components/command";
|
||||
import { CheckIcon } from "@coss/ui/icons";
|
||||
|
||||
import { useMemo } from "react";
|
||||
import { useDataTable, useFilterValue } from "~/data-table/hooks";
|
||||
import type {
|
||||
FacetedValue,
|
||||
FilterableColumn as _FilterableColumn,
|
||||
FilterValueSchema,
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
|
||||
type FilterableColumn = Extract<_FilterableColumn, { type: Extract<FilterType, "ms" | "ss"> }>;
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { type Column, getCoreRowModel, type Table, useReactTable } from "@tanstack/react-table";
|
||||
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { useEffect, useMemo } from "react";
|
||||
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
|
||||
import { vi } from "vitest";
|
||||
import { useReactTable, getCoreRowModel, type Table, type Column } from "@tanstack/react-table";
|
||||
|
||||
import { ColumnVisibilityButton } from "./ColumnVisibilityButton";
|
||||
|
||||
let tableRef: Table<{ a: number; b: number; c: number }> | null = null;
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
"use client";
|
||||
|
||||
import { type Table } from "@tanstack/react-table";
|
||||
|
||||
import { forwardRef, useState } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { type ButtonProps, Button, buttonClasses } from "@calcom/ui/components/button";
|
||||
import { Button, type ButtonProps, buttonClasses } from "@calcom/ui/components/button";
|
||||
import {
|
||||
Command,
|
||||
CommandInput,
|
||||
CommandList,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
CommandSeparator,
|
||||
} from "@calcom/ui/components/command";
|
||||
import { Popover, PopoverTrigger, PopoverContent } from "@calcom/ui/components/popover";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@calcom/ui/components/popover";
|
||||
import { CheckIcon } from "@coss/ui/icons";
|
||||
import type { Table } from "@tanstack/react-table";
|
||||
import { forwardRef, useState } from "react";
|
||||
|
||||
export interface ColumnVisiblityProps<TData> {
|
||||
table: Table<TData>;
|
||||
|
||||
@@ -1,39 +1,37 @@
|
||||
import { format } from "date-fns";
|
||||
import type { Dayjs } from "dayjs";
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import {
|
||||
CUSTOM_PRESET,
|
||||
CUSTOM_PRESET_VALUE,
|
||||
DEFAULT_PRESET,
|
||||
getCompatiblePresets,
|
||||
getDateRangeFromPreset,
|
||||
getDefaultEndDate,
|
||||
getDefaultStartDate,
|
||||
type PresetOption,
|
||||
} from "@calcom/features/data-table/lib/dateRange";
|
||||
import { preserveLocalTime } from "@calcom/features/data-table/lib/preserveLocalTime";
|
||||
import type { DateRangeFilterOptions, FilterableColumn } from "@calcom/features/data-table/lib/types";
|
||||
import { ColumnFilterType, ZDateRangeFilterValue } from "@calcom/features/data-table/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { CURRENT_TIMEZONE } from "@calcom/lib/timezoneConstants";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import classNames from "@calcom/ui/classNames";
|
||||
import { Badge } from "@calcom/ui/components/badge";
|
||||
import { Button, buttonClasses } from "@calcom/ui/components/button";
|
||||
import {
|
||||
Command,
|
||||
CommandList,
|
||||
CommandItem,
|
||||
CommandGroup,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
CommandSeparator,
|
||||
} from "@calcom/ui/components/command";
|
||||
import { DateRangePicker } from "@calcom/ui/components/form";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@calcom/ui/components/popover";
|
||||
import { CheckIcon } from "@coss/ui/icons";
|
||||
|
||||
import { format } from "date-fns";
|
||||
import type { Dayjs } from "dayjs";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useDataTable, useFilterValue } from "~/data-table/hooks";
|
||||
import {
|
||||
CUSTOM_PRESET,
|
||||
CUSTOM_PRESET_VALUE,
|
||||
DEFAULT_PRESET,
|
||||
getDefaultStartDate,
|
||||
getDefaultEndDate,
|
||||
getDateRangeFromPreset,
|
||||
getCompatiblePresets,
|
||||
type PresetOption,
|
||||
} from "@calcom/features/data-table/lib/dateRange";
|
||||
import { preserveLocalTime } from "@calcom/features/data-table/lib/preserveLocalTime";
|
||||
import type { FilterableColumn, DateRangeFilterOptions } from "@calcom/features/data-table/lib/types";
|
||||
import { ZDateRangeFilterValue, ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import { useFilterPopoverOpen } from "./useFilterPopoverOpen";
|
||||
|
||||
type DateRangeFilterProps = {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { type Table } from "@tanstack/react-table";
|
||||
|
||||
import type { Table } from "@tanstack/react-table";
|
||||
import { useDisplayedFilterCount } from "~/data-table/hooks";
|
||||
import { ActiveFilters } from "./ActiveFilters";
|
||||
import { AddFilterButton } from "./AddFilterButton";
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
import startCase from "lodash/startCase";
|
||||
|
||||
import {
|
||||
ColumnFilterType,
|
||||
type FilterableColumn,
|
||||
type FilterValue,
|
||||
ZFilterValue,
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import {
|
||||
isMultiSelectFilterValue,
|
||||
isNumberFilterValue,
|
||||
isSingleSelectFilterValue,
|
||||
isTextFilterValue,
|
||||
} from "@calcom/features/data-table/lib/utils";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import { Badge } from "@calcom/ui/components/badge";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import type { IconName } from "@calcom/ui/components/icon";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@calcom/ui/components/popover";
|
||||
|
||||
import startCase from "lodash/startCase";
|
||||
import { useFilterValue } from "~/data-table/hooks";
|
||||
import {
|
||||
type FilterableColumn,
|
||||
type FilterValue,
|
||||
ZFilterValue,
|
||||
ColumnFilterType,
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import {
|
||||
isSingleSelectFilterValue,
|
||||
isMultiSelectFilterValue,
|
||||
isTextFilterValue,
|
||||
isNumberFilterValue,
|
||||
} from "@calcom/features/data-table/lib/utils";
|
||||
import { FilterOptions } from "./FilterOptions";
|
||||
import { useFilterPopoverOpen } from "./useFilterPopoverOpen";
|
||||
import { numberFilterOperatorOptions, useTextFilterOperatorOptions } from "./utils";
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
import type { FilterableColumn } from "@calcom/features/data-table/lib/types";
|
||||
import { ZMultiSelectFilterValue, ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import { ColumnFilterType, ZMultiSelectFilterValue } from "@calcom/features/data-table/lib/types";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
import { BaseSelectFilterOptions } from "./BaseSelectFilterOptions";
|
||||
|
||||
export type MultiSelectFilterOptionsProps = {
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { useForm, Controller } from "react-hook-form";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Form, Select, NumberInput } from "@calcom/ui/components/form";
|
||||
|
||||
import { useFilterValue, useDataTable } from "~/data-table/hooks";
|
||||
import type { FilterableColumn } from "@calcom/features/data-table/lib/types";
|
||||
import { ZNumberFilterValue, ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import { ColumnFilterType, ZNumberFilterValue } from "@calcom/features/data-table/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Form, NumberInput, Select } from "@calcom/ui/components/form";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { useDataTable, useFilterValue } from "~/data-table/hooks";
|
||||
import { numberFilterOperatorOptions } from "./utils";
|
||||
|
||||
export type NumberFilterOptionsProps = {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
"use client";
|
||||
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
import type { FilterableColumn } from "@calcom/features/data-table/lib/types";
|
||||
import { ZSingleSelectFilterValue, ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import { ColumnFilterType, ZSingleSelectFilterValue } from "@calcom/features/data-table/lib/types";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
import { BaseSelectFilterOptions } from "./BaseSelectFilterOptions";
|
||||
|
||||
export type SingleSelectFilterOptionsProps = {
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import { useForm, Controller } from "react-hook-form";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Form, Select, Input } from "@calcom/ui/components/form";
|
||||
|
||||
import { useFilterValue, useDataTable } from "~/data-table/hooks";
|
||||
import type { FilterableColumn } from "@calcom/features/data-table/lib/types";
|
||||
import { ZTextFilterValue, ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import { ColumnFilterType, ZTextFilterValue } from "@calcom/features/data-table/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { FilterType } from "@calcom/types/data-table";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Form, Input, Select } from "@calcom/ui/components/form";
|
||||
import { Controller, useForm } from "react-hook-form";
|
||||
import { useDataTable, useFilterValue } from "~/data-table/hooks";
|
||||
import { useTextFilterOperatorOptions } from "./utils";
|
||||
|
||||
export type TextFilterOptionsProps = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useState, useEffect, useCallback } from "react";
|
||||
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
|
||||
export function useFilterPopoverOpen(columnId: string) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
|
||||
import { type TextFilterOperator, textFilterOperators } from "@calcom/features/data-table/lib/types";
|
||||
import type { TextFilterOperatorOption, NumberFilterOperatorOption } from "./types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import type { NumberFilterOperatorOption, TextFilterOperatorOption } from "./types";
|
||||
|
||||
export const numberFilterOperatorOptions: NumberFilterOperatorOption[] = [
|
||||
{ value: "eq", label: "=" },
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export { DataTableToolbar } from "./DataTableToolbar";
|
||||
export { DataTableSelectionBar } from "./DataTableSelectionBar";
|
||||
export { DataTablePagination } from "./DataTablePagination";
|
||||
export * from "./filters";
|
||||
export { DataTable } from "./DataTable";
|
||||
export { DataTableSkeleton } from "./DataTableSkeleton";
|
||||
export { DataTableWrapper } from "./DataTableWrapper";
|
||||
export type { DataTableProps } from "./DataTable";
|
||||
export { DataTable } from "./DataTable";
|
||||
export { DataTablePagination } from "./DataTablePagination";
|
||||
export { DataTableSelectionBar } from "./DataTableSelectionBar";
|
||||
export { DataTableSkeleton } from "./DataTableSkeleton";
|
||||
export { DataTableToolbar } from "./DataTableToolbar";
|
||||
export { DataTableWrapper } from "./DataTableWrapper";
|
||||
export * from "./filters";
|
||||
export { DataTableSegment } from "./segment";
|
||||
@@ -1,10 +1,9 @@
|
||||
import type { FilterSegmentOutput } from "@calcom/features/data-table/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Dialog, ConfirmationDialogContent } from "@calcom/ui/components/dialog";
|
||||
import { ConfirmationDialogContent, Dialog } from "@calcom/ui/components/dialog";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
import type { FilterSegmentOutput } from "@calcom/features/data-table/lib/types";
|
||||
|
||||
export function DeleteSegmentDialog({
|
||||
segment,
|
||||
@@ -17,23 +16,12 @@ export function DeleteSegmentDialog({
|
||||
const utils = trpc.useUtils();
|
||||
const { segmentId, setSegmentId } = useDataTable();
|
||||
|
||||
const { mutate: deleteSegment, isPending } = trpc.viewer.filterSegments.delete.useMutation({
|
||||
onSuccess: ({ id }) => {
|
||||
utils.viewer.filterSegments.list.invalidate();
|
||||
showToast(t("filter_segment_deleted"), "success");
|
||||
if (segmentId && segmentId.type === "user" && segmentId.id === id) {
|
||||
setSegmentId(null);
|
||||
}
|
||||
onClose();
|
||||
},
|
||||
onError: () => {
|
||||
showToast(t("error_deleting_filter_segment"), "error");
|
||||
},
|
||||
});
|
||||
const deleteSegment = { mutate: (_args: Record<string, unknown>) => {}, isPending: false };
|
||||
const isPending = deleteSegment.isPending;
|
||||
|
||||
const handleDelete = () => {
|
||||
if (!segment) return;
|
||||
deleteSegment({ id: segment.id });
|
||||
deleteSegment.mutate({ id: segment.id });
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
|
||||
import type { CombinedFilterSegment } from "@calcom/features/data-table/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/components/dialog";
|
||||
import { Form, TextField } from "@calcom/ui/components/form";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
import type { CombinedFilterSegment } from "@calcom/features/data-table/lib/types";
|
||||
|
||||
type FormValues = {
|
||||
name: string;
|
||||
@@ -34,17 +32,8 @@ export function DuplicateSegmentDialog({
|
||||
const session = useSession();
|
||||
const isAdminOrOwner = checkAdminOrOwner(session.data?.user?.org?.role);
|
||||
|
||||
const { mutate: createSegment, isPending } = trpc.viewer.filterSegments.create.useMutation({
|
||||
onSuccess: ({ id }) => {
|
||||
utils.viewer.filterSegments.list.invalidate();
|
||||
showToast(t("filter_segment_duplicated"), "success");
|
||||
setSegmentId({ id, type: "user" });
|
||||
onClose();
|
||||
},
|
||||
onError: () => {
|
||||
showToast(t("error_duplicating_filter_segment"), "error");
|
||||
},
|
||||
});
|
||||
const createSegment = { mutate: (_args: Record<string, unknown>) => {}, isPending: false };
|
||||
const isPending = createSegment.isPending;
|
||||
|
||||
const handleSubmit = (data: FormValues) => {
|
||||
if (!segment) {
|
||||
@@ -53,14 +42,14 @@ export function DuplicateSegmentDialog({
|
||||
if (segment.type === "user") {
|
||||
const { type: _type, id: _id, name: _name, team: _team, teamId, ...rest } = segment;
|
||||
if (segment.scope === "TEAM" && isAdminOrOwner) {
|
||||
createSegment({
|
||||
createSegment.mutate({
|
||||
...rest,
|
||||
teamId: teamId ?? 0,
|
||||
scope: "TEAM",
|
||||
name: data.name,
|
||||
});
|
||||
} else {
|
||||
createSegment({
|
||||
createSegment.mutate({
|
||||
...rest,
|
||||
scope: "USER",
|
||||
name: data.name,
|
||||
@@ -68,7 +57,7 @@ export function DuplicateSegmentDialog({
|
||||
}
|
||||
} else if (segment.type === "system") {
|
||||
const { type: _type, ...rest } = segment;
|
||||
createSegment({
|
||||
createSegment.mutate({
|
||||
...rest,
|
||||
scope: "USER",
|
||||
name: data.name,
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
import type { FilterSegmentOutput } from "@calcom/features/data-table/lib/types";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import { Dialog, DialogContent, DialogFooter, DialogHeader } from "@calcom/ui/components/dialog";
|
||||
import { Form, TextField } from "@calcom/ui/components/form";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
import type { FilterSegmentOutput } from "@calcom/features/data-table/lib/types";
|
||||
import { useForm } from "react-hook-form";
|
||||
|
||||
type FormValues = {
|
||||
name: string;
|
||||
@@ -28,23 +26,15 @@ export function RenameSegmentDialog({
|
||||
});
|
||||
const utils = trpc.useUtils();
|
||||
|
||||
const { mutate: updateSegment, isPending } = trpc.viewer.filterSegments.update.useMutation({
|
||||
onSuccess: () => {
|
||||
utils.viewer.filterSegments.list.invalidate();
|
||||
showToast(t("filter_segment_updated"), "success");
|
||||
onClose();
|
||||
},
|
||||
onError: () => {
|
||||
showToast(t("error_updating_filter_segment"), "error");
|
||||
},
|
||||
});
|
||||
const updateSegment = { mutate: (_args: Record<string, unknown>) => {}, isPending: false };
|
||||
const isPending = updateSegment.isPending;
|
||||
|
||||
const handleSubmit = (data: FormValues) => {
|
||||
if (!segment) {
|
||||
return;
|
||||
}
|
||||
if (segment.scope === "TEAM") {
|
||||
updateSegment({
|
||||
updateSegment.mutate({
|
||||
...segment,
|
||||
scope: "TEAM",
|
||||
teamId: segment.teamId ?? 0,
|
||||
@@ -52,7 +42,7 @@ export function RenameSegmentDialog({
|
||||
});
|
||||
return;
|
||||
}
|
||||
updateSegment({
|
||||
updateSegment.mutate({
|
||||
...segment,
|
||||
scope: "USER",
|
||||
name: data.name,
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import posthog from "posthog-js";
|
||||
|
||||
import { checkAdminOrOwner } from "@calcom/features/auth/lib/checkAdminOrOwner";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { type FilterSegmentScope } from "@calcom/prisma/enums";
|
||||
import type { FilterSegmentScope } from "@calcom/prisma/enums";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import { Button } from "@calcom/ui/components/button";
|
||||
import {
|
||||
@@ -16,9 +11,12 @@ import {
|
||||
DialogTrigger,
|
||||
} from "@calcom/ui/components/dialog";
|
||||
import { Form, Input, Label, Select, Switch } from "@calcom/ui/components/form";
|
||||
import { RadioGroup, RadioField } from "@calcom/ui/components/radio";
|
||||
import { RadioField, RadioGroup } from "@calcom/ui/components/radio";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
import { useSession } from "next-auth/react";
|
||||
import posthog from "posthog-js";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useForm } from "react-hook-form";
|
||||
import { useDataTable } from "~/data-table/hooks";
|
||||
|
||||
interface FormValues {
|
||||
@@ -28,6 +26,16 @@ interface FormValues {
|
||||
}
|
||||
|
||||
export function SaveFilterSegmentButton() {
|
||||
const createSegmentMutation = {
|
||||
mutate: (_args: Record<string, unknown>) => {},
|
||||
mutateAsync: async (_args: Record<string, unknown>) => ({ id: "" }),
|
||||
};
|
||||
const updateSegmentMutation = {
|
||||
mutate: (_args: Record<string, unknown>) => {},
|
||||
mutateAsync: async (_args: Record<string, unknown>) => ({}),
|
||||
};
|
||||
const createSegment = (args: Record<string, unknown>) => createSegmentMutation.mutate(args);
|
||||
const updateSegment = (args: Record<string, unknown>) => updateSegmentMutation.mutate(args);
|
||||
const { t } = useLocale();
|
||||
const utils = trpc.useUtils();
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
@@ -70,30 +78,7 @@ export function SaveFilterSegmentButton() {
|
||||
setSaveMode(selectedSegment && selectedSegment.type === "user" ? "update" : "create");
|
||||
}, [selectedSegment, isOpen]);
|
||||
|
||||
const { data: teams } = trpc.viewer.teams.list.useQuery();
|
||||
|
||||
const { mutate: createSegment } = trpc.viewer.filterSegments.create.useMutation({
|
||||
onSuccess: (segment) => {
|
||||
utils.viewer.filterSegments.list.invalidate();
|
||||
showToast(t("filter_segment_saved"), "success");
|
||||
setSegmentId({ id: segment.id, type: "user" }, { type: "user", ...segment });
|
||||
setIsOpen(false);
|
||||
},
|
||||
onError: () => {
|
||||
showToast(t("error_saving_filter_segment"), "error");
|
||||
},
|
||||
});
|
||||
|
||||
const { mutate: updateSegment } = trpc.viewer.filterSegments.update.useMutation({
|
||||
onSuccess: () => {
|
||||
utils.viewer.filterSegments.list.invalidate();
|
||||
showToast(t("filter_segment_updated"), "success");
|
||||
setIsOpen(false);
|
||||
},
|
||||
onError: () => {
|
||||
showToast(t("error_updating_filter_segment"), "error");
|
||||
},
|
||||
});
|
||||
const teams = null as { id: number; name: string; slug: string | null }[] | null;
|
||||
|
||||
const onSubmit = (values: FormValues) => {
|
||||
if (isTeamSegment && !selectedTeamId) {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"use client";
|
||||
|
||||
import type { ActiveFilters, FilterValue } from "@calcom/features/data-table/lib/types";
|
||||
import debounce from "lodash/debounce";
|
||||
import { createContext, useContext, useCallback, useMemo, useEffect } from "react";
|
||||
|
||||
import type { FilterValue, ActiveFilters } from "@calcom/features/data-table/lib/types";
|
||||
import { createContext, useCallback, useContext, useEffect, useMemo } from "react";
|
||||
import { useDataTableSegment } from "./DataTableSegmentContext";
|
||||
import { useDataTableState } from "./DataTableStateContext";
|
||||
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useContext, useState, useCallback, useEffect, useRef, useMemo } from "react";
|
||||
|
||||
import { useSegmentsNoop } from "../hooks/useSegmentsNoop";
|
||||
import type {
|
||||
FilterSegmentOutput,
|
||||
SystemFilterSegment,
|
||||
CombinedFilterSegment,
|
||||
FilterSegmentOutput,
|
||||
SegmentIdentifier,
|
||||
SystemFilterSegment,
|
||||
UseSegments,
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import { SYSTEM_SEGMENT_PREFIX } from "@calcom/features/data-table/lib/types";
|
||||
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useSegmentsNoop } from "../hooks/useSegmentsNoop";
|
||||
import { useDataTableState } from "./DataTableStateContext";
|
||||
|
||||
export type DataTableSegmentContextType = {
|
||||
|
||||
@@ -1,24 +1,22 @@
|
||||
"use client";
|
||||
|
||||
import type { SortingState, OnChangeFn, VisibilityState, ColumnSizingState } from "@tanstack/react-table";
|
||||
import { useQueryState } from "nuqs";
|
||||
import { createContext, useContext, useRef, useMemo } from "react";
|
||||
|
||||
import { useElementByClassName } from "@calcom/lib/hooks/useElementByClassName";
|
||||
|
||||
import {
|
||||
activeFiltersParser,
|
||||
sortingParser,
|
||||
columnVisibilityParser,
|
||||
columnSizingParser,
|
||||
segmentIdParser,
|
||||
columnVisibilityParser,
|
||||
DEFAULT_PAGE_SIZE,
|
||||
pageIndexParser,
|
||||
pageSizeParser,
|
||||
searchTermParser,
|
||||
DEFAULT_PAGE_SIZE,
|
||||
segmentIdParser,
|
||||
sortingParser,
|
||||
} from "@calcom/features/data-table/lib/parsers";
|
||||
import type { ActiveFilters, SegmentIdentifier } from "@calcom/features/data-table/lib/types";
|
||||
import { CTA_CONTAINER_CLASS_NAME } from "@calcom/features/data-table/lib/utils";
|
||||
import { useElementByClassName } from "@calcom/lib/hooks/useElementByClassName";
|
||||
import type { ColumnSizingState, OnChangeFn, SortingState, VisibilityState } from "@tanstack/react-table";
|
||||
import { useQueryState } from "nuqs";
|
||||
import { createContext, useContext, useMemo, useRef } from "react";
|
||||
|
||||
export type ActiveFiltersValidator = (filters: ActiveFilters) => ActiveFilters;
|
||||
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
export {
|
||||
DataTableStateContext,
|
||||
DataTableStateProvider,
|
||||
useDataTableState,
|
||||
type DataTableStateContextType,
|
||||
type ActiveFiltersValidator,
|
||||
type ActiveFiltersValidatorState,
|
||||
} from "./DataTableStateContext";
|
||||
|
||||
export {
|
||||
DataTableSegmentContext,
|
||||
DataTableSegmentProvider,
|
||||
useDataTableSegment,
|
||||
type DataTableSegmentContextType,
|
||||
} from "./DataTableSegmentContext";
|
||||
|
||||
export {
|
||||
DataTableFiltersContext,
|
||||
type DataTableFiltersContextType,
|
||||
DataTableFiltersProvider,
|
||||
useDataTableFilters,
|
||||
type DataTableFiltersContextType,
|
||||
} from "./DataTableFiltersContext";
|
||||
export {
|
||||
DataTableSegmentContext,
|
||||
type DataTableSegmentContextType,
|
||||
DataTableSegmentProvider,
|
||||
useDataTableSegment,
|
||||
} from "./DataTableSegmentContext";
|
||||
export {
|
||||
type ActiveFiltersValidator,
|
||||
type ActiveFiltersValidatorState,
|
||||
DataTableStateContext,
|
||||
type DataTableStateContextType,
|
||||
DataTableStateProvider,
|
||||
useDataTableState,
|
||||
} from "./DataTableStateContext";
|
||||
@@ -1,8 +1,8 @@
|
||||
export * from "./useDebouncedWidth";
|
||||
export * from "./useFetchMoreOnBottomReached";
|
||||
export * from "./useColumnSizingVars";
|
||||
export * from "./useFilterValue";
|
||||
export * from "./useColumnFilters";
|
||||
export * from "./useColumnSizingVars";
|
||||
export * from "./useDataTable";
|
||||
export * from "./useFilterableColumns";
|
||||
export * from "./useDebouncedWidth";
|
||||
export * from "./useDisplayedFilterCount";
|
||||
export * from "./useFetchMoreOnBottomReached";
|
||||
export * from "./useFilterableColumns";
|
||||
export * from "./useFilterValue";
|
||||
@@ -1,11 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import type { Header, Table, ColumnSizingState } from "@tanstack/react-table";
|
||||
import type { ColumnSizingState, Header, Table } from "@tanstack/react-table";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import debounce from "lodash/debounce";
|
||||
import { useCallback, useEffect, useRef, useMemo } from "react";
|
||||
|
||||
import { useDebouncedWidth, useDataTable } from ".";
|
||||
import { useCallback, useEffect, useMemo, useRef } from "react";
|
||||
import { useDataTable, useDebouncedWidth } from ".";
|
||||
|
||||
type UseColumnResizingProps<TData> = {
|
||||
enabled: boolean;
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
"use client";
|
||||
|
||||
import { type Table } from "@tanstack/react-table";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useMemo } from "react";
|
||||
|
||||
import type { FilterableColumn, FacetedValue } from "@calcom/features/data-table/lib/types";
|
||||
import type { FacetedValue, FilterableColumn } from "@calcom/features/data-table/lib/types";
|
||||
import { ColumnFilterType } from "@calcom/features/data-table/lib/types";
|
||||
import { convertMapToFacetedValues } from "@calcom/features/data-table/lib/utils";
|
||||
import type { Table } from "@tanstack/react-table";
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { useMemo } from "react";
|
||||
|
||||
export function useFilterableColumns<TData>(table: Table<TData>) {
|
||||
const columns = useMemo(
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
import { recalculateDateRange } from "@calcom/features/data-table/lib/dateRange";
|
||||
import {
|
||||
type SegmentIdentifier,
|
||||
SYSTEM_SEGMENT_PREFIX,
|
||||
type UseSegments,
|
||||
} from "@calcom/features/data-table/lib/types";
|
||||
import { isDateRangeFilterValue } from "@calcom/features/data-table/lib/utils";
|
||||
import { useMemo } from "react";
|
||||
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
|
||||
import { recalculateDateRange } from "@calcom/features/data-table/lib/dateRange";
|
||||
import { type UseSegments, SYSTEM_SEGMENT_PREFIX } from "@calcom/features/data-table/lib/types";
|
||||
import { isDateRangeFilterValue } from "@calcom/features/data-table/lib/utils";
|
||||
|
||||
export const useSegments: UseSegments = ({ tableIdentifier, providedSegments, systemSegments }) => {
|
||||
const { data: rawSegments, isSuccess } = trpc.viewer.filterSegments.list.useQuery(
|
||||
{
|
||||
tableIdentifier,
|
||||
},
|
||||
{
|
||||
enabled: !providedSegments, // Only fetch if segments are not provided
|
||||
}
|
||||
);
|
||||
const { mutate: setPreference } = trpc.viewer.filterSegments.setPreference.useMutation();
|
||||
const rawSegments = providedSegments
|
||||
? { segments: providedSegments, preferredSegmentId: null as SegmentIdentifier | null }
|
||||
: undefined;
|
||||
const isSuccess = Boolean(providedSegments);
|
||||
const setPreference = (_args: { tableIdentifier: string; segmentId: SegmentIdentifier | null }) => {};
|
||||
|
||||
const preferredSegmentId = useMemo(() => rawSegments?.preferredSegmentId || null, [rawSegments]);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { noop } from "lodash";
|
||||
|
||||
import { type UseSegments } from "@calcom/features/data-table/lib/types";
|
||||
import type { UseSegments } from "@calcom/features/data-table/lib/types";
|
||||
import { noop } from "lodash";
|
||||
|
||||
export const useSegmentsNoop: UseSegments = ({}) => {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user