diff --git a/apps/web/modules/bookings/views/bookings-listing-view.tsx b/apps/web/modules/bookings/views/bookings-listing-view.tsx index 6a86e8d0f2..6fe13a20dc 100644 --- a/apps/web/modules/bookings/views/bookings-listing-view.tsx +++ b/apps/web/modules/bookings/views/bookings-listing-view.tsx @@ -364,7 +364,7 @@ function BookingsContent({ status }: BookingsProps) { table={table} testId={`${status}-bookings`} bodyTestId="bookings" - hideHeader={true} + headerClassName="hidden" isPending={query.isPending} totalRowCount={query.data?.totalCount} variant="compact" diff --git a/packages/features/data-table/components/DataTable.tsx b/packages/features/data-table/components/DataTable.tsx index 89b1bedfe3..5bc623431d 100644 --- a/packages/features/data-table/components/DataTable.tsx +++ b/packages/features/data-table/components/DataTable.tsx @@ -30,25 +30,29 @@ import classNames from "@calcom/ui/classNames"; import { useColumnSizingVars } from "../hooks"; import { usePersistentColumnResizing } from "../lib/resizing"; -export type DataTableProps = { +export type DataTablePropsFromWrapper = { table: ReactTableType; tableContainerRef: React.RefObject; isPending?: boolean; - onRowMouseclick?: (row: Row) => void; - onScroll?: (e: Pick, "target">) => void; - tableOverlay?: React.ReactNode; variant?: "default" | "compact"; testId?: string; bodyTestId?: string; - hideHeader?: boolean; children?: React.ReactNode; - identifier?: string; - enableColumnResizing?: boolean; className?: string; containerClassName?: string; + headerClassName?: string; + rowClassName?: string; paginationMode?: "infinite" | "standard"; }; +export type DataTableProps = DataTablePropsFromWrapper & { + onRowMouseclick?: (row: Row) => void; + onScroll?: (e: Pick, "target">) => void; + tableOverlay?: React.ReactNode; + identifier?: string; + enableColumnResizing?: boolean; +}; + export function DataTable({ table, tableContainerRef, @@ -57,13 +61,14 @@ export function DataTable({ onRowMouseclick, onScroll, children, - hideHeader, identifier: _identifier, enableColumnResizing, testId, bodyTestId, className, containerClassName, + headerClassName, + rowClassName, paginationMode = "infinite", ...rest }: DataTableProps & React.ComponentPropsWithoutRef<"div">) { @@ -145,44 +150,42 @@ export function DataTable({ ...columnSizingVars, ...(Boolean(enableColumnResizing) && { width: table.getTotalSize() }), }}> - {!hideHeader && ( - - {table.getHeaderGroups().map((headerGroup: HeaderGroup) => ( - - {headerGroup.headers.map((header: Header) => { - const { column } = header; - return ( - - - {Boolean(enableColumnResizing) && header.column.getCanResize() && ( -
-
-
- )} - - ); - })} - - ))} - - )} + + {table.getHeaderGroups().map((headerGroup: HeaderGroup) => ( + + {headerGroup.headers.map((header: Header) => { + const { column } = header; + return ( + + + {Boolean(enableColumnResizing) && header.column.getCanResize() && ( +
+
+
+ )} + + ); + })} + + ))} + {/* When resizing any column we will render this special memoized version of our table body */} {table.getState().columnSizingInfo.isResizingColumn ? ( ({ isPending={isPending} onRowMouseclick={onRowMouseclick} paginationMode={paginationMode} + rowClassName={rowClassName} /> ) : ( ({ isPending={isPending} onRowMouseclick={onRowMouseclick} paginationMode={paginationMode} + rowClassName={rowClassName} /> )} @@ -224,7 +229,8 @@ const MemoizedTableBody = memo( prev.variant === next.variant && prev.isPending === next.isPending && prev.onRowMouseclick === next.onRowMouseclick && - prev.paginationMode === next.paginationMode + prev.paginationMode === next.paginationMode && + prev.rowClassName === next.rowClassName ) as typeof DataTableBody; type DataTableBodyProps = { @@ -236,6 +242,7 @@ type DataTableBodyProps = { isPending?: boolean; onRowMouseclick?: (row: Row) => void; paginationMode?: "infinite" | "standard"; + rowClassName?: string; }; type RowToRender = { @@ -252,6 +259,7 @@ function DataTableBody({ isPending, onRowMouseclick, paginationMode, + rowClassName, }: DataTableBodyProps & { paginationMode?: "infinite" | "standard" }) { const { t } = useLocale(); const virtualItems = rowVirtualizer.getVirtualItems(); @@ -297,7 +305,7 @@ function DataTableBody({ width: "100%", }), }} - className={classNames(onRowMouseclick && "hover:cursor-pointer", "group")}> + className={classNames(onRowMouseclick && "hover:cursor-pointer", "group", rowClassName)}> {row.getVisibleCells().map((cell) => { const column = cell.column; return ( diff --git a/packages/features/data-table/components/DataTableWrapper.tsx b/packages/features/data-table/components/DataTableWrapper.tsx index b3662c07c4..be3b4777e1 100644 --- a/packages/features/data-table/components/DataTableWrapper.tsx +++ b/packages/features/data-table/components/DataTableWrapper.tsx @@ -1,33 +1,26 @@ "use client"; -import type { Table as ReactTableType, VisibilityState } from "@tanstack/react-table"; +import type { VisibilityState } from "@tanstack/react-table"; // eslint-disable-next-line no-restricted-imports import { noop } from "lodash"; import { useEffect, useRef } from "react"; -import { - DataTable, - DataTablePagination, - useFetchMoreOnBottomReached, - useDataTable, - useColumnFilters, -} from "@calcom/features/data-table"; +import { useColumnFilters } from "../hooks/useColumnFilters"; +import { useDataTable } from "../hooks/useDataTable"; +import { useFetchMoreOnBottomReached } from "../hooks/useFetchMoreOnBottomReached"; +import type { DataTablePropsFromWrapper } from "./DataTable"; +import { DataTable } from "./DataTable"; +import { DataTablePagination } from "./DataTablePagination"; -type BaseDataTableWrapperProps = { - testId?: string; - bodyTestId?: string; - table: ReactTableType; - isPending: boolean; - hideHeader?: boolean; - variant?: "default" | "compact"; +type BaseDataTableWrapperProps = Omit< + DataTablePropsFromWrapper, + "paginationMode" | "tableContainerRef" +> & { totalRowCount?: number; ToolbarLeft?: React.ReactNode; ToolbarRight?: React.ReactNode; EmptyView?: React.ReactNode; LoaderView?: React.ReactNode; - className?: string; - containerClassName?: string; - children?: React.ReactNode; tableContainerRef?: React.RefObject; }; @@ -57,13 +50,14 @@ export function DataTableWrapper({ isFetching, totalRowCount, variant, - hideHeader, ToolbarLeft, ToolbarRight, EmptyView, LoaderView, className, containerClassName, + headerClassName, + rowClassName, children, tableContainerRef: externalRef, paginationMode, @@ -130,10 +124,11 @@ export function DataTableWrapper({ tableContainerRef={tableContainerRef} isPending={isPending} enableColumnResizing={true} - hideHeader={hideHeader} variant={variant} className={className} containerClassName={containerClassName} + headerClassName={headerClassName} + rowClassName={rowClassName} paginationMode={paginationMode} onScroll={ paginationMode === "infinite" diff --git a/packages/features/data-table/components/filters/ClearFiltersButton.tsx b/packages/features/data-table/components/filters/ClearFiltersButton.tsx index d9cf60afff..6f4f3f042b 100644 --- a/packages/features/data-table/components/filters/ClearFiltersButton.tsx +++ b/packages/features/data-table/components/filters/ClearFiltersButton.tsx @@ -1,7 +1,8 @@ -import { useDataTable } from "@calcom/features/data-table"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Button, Tooltip } from "@calcom/ui"; +import { useDataTable } from "../../hooks/useDataTable"; + export const ClearFiltersButton = ({ exclude }: { exclude?: string[] }) => { const { t } = useLocale(); const { activeFilters, clearAll } = useDataTable(); diff --git a/packages/features/ee/billing/api/webhook/_invoice.paid.ts b/packages/features/ee/billing/api/webhook/_invoice.paid.ts index ff3782609b..123fecf777 100644 --- a/packages/features/ee/billing/api/webhook/_invoice.paid.ts +++ b/packages/features/ee/billing/api/webhook/_invoice.paid.ts @@ -1,6 +1,7 @@ +import logger from "@calcom/lib/logger"; + import { HttpCode } from "./__handler"; import type { LazyModule, SWHMap } from "./__handler"; -import logger from "@calcom/lib/logger"; type Data = SWHMap["invoice.paid"]["data"]; diff --git a/packages/features/ee/billing/organizations/index.ts b/packages/features/ee/billing/organizations/index.ts index a5c8489acc..a52d023fbd 100644 --- a/packages/features/ee/billing/organizations/index.ts +++ b/packages/features/ee/billing/organizations/index.ts @@ -1,5 +1,4 @@ import { IS_PRODUCTION } from "@calcom/lib/constants"; -import { prisma } from "@calcom/prisma"; import { InternalOrganizationBilling } from "./internal-organization-billing"; import { OrganizationBillingRepository } from "./organization-billing.repository"; @@ -7,4 +6,4 @@ import { StubOrganizationBilling } from "./stub-organization-billing"; export { OrganizationBillingRepository }; -export const OrganizationBilling = IS_PRODUCTION ? InternalOrganizationBilling : StubOrganizationBilling; \ No newline at end of file +export const OrganizationBilling = IS_PRODUCTION ? InternalOrganizationBilling : StubOrganizationBilling; diff --git a/packages/features/ee/billing/teams/internal-team-billing.ts b/packages/features/ee/billing/teams/internal-team-billing.ts index 2fd46f0dac..dea5c54d61 100644 --- a/packages/features/ee/billing/teams/internal-team-billing.ts +++ b/packages/features/ee/billing/teams/internal-team-billing.ts @@ -1,18 +1,19 @@ import type { Prisma } from "@prisma/client"; import type { z } from "zod"; -import { safeStringify } from "@calcom/lib/safeStringify"; + import { getRequestedSlugError } from "@calcom/app-store/stripepayment/lib/team-billing"; import { purchaseTeamOrOrgSubscription } from "@calcom/features/ee/teams/lib/payments"; import { MINIMUM_NUMBER_OF_ORG_SEATS, WEBAPP_URL } from "@calcom/lib/constants"; import { getMetadataHelpers } from "@calcom/lib/getMetadataHelpers"; import logger from "@calcom/lib/logger"; import { Redirect } from "@calcom/lib/redirect"; +import { safeStringify } from "@calcom/lib/safeStringify"; +import { OrganizationOnboardingRepository } from "@calcom/lib/server/repository/organizationOnboarding"; import prisma from "@calcom/prisma"; import { teamMetadataSchema } from "@calcom/prisma/zod-utils"; import billing from ".."; import { TeamBillingPublishResponseStatus, type TeamBilling, type TeamBillingInput } from "./team-billing"; -import { OrganizationOnboardingRepository } from "@calcom/lib/server/repository/organizationOnboarding"; const log = logger.getSubLogger({ prefix: ["TeamBilling"] }); @@ -124,13 +125,15 @@ export class InternalTeamBilling implements TeamBilling { const { id: teamId, metadata, isOrganization } = this.team; const { url } = await this.checkIfTeamPaymentRequired(); - const organizationOnboarding = await OrganizationOnboardingRepository.findByOrganizationId(this.team.id); + const organizationOnboarding = await OrganizationOnboardingRepository.findByOrganizationId( + this.team.id + ); log.debug("updateQuantity", safeStringify({ url, team: this.team })); /** * If there's no pending checkout URL it means that this team has not been paid. * We cannot update the subscription yet, this will be handled on publish/checkout. - * + * * An organization can only be created if it is paid for and updateQuantity is called only when we have an organization. * For some old organizations, it is possible that they aren't paid for yet, but then they wouldn't have been published as well(i.e. slug would be null and are unusable) * So, we can safely assume go forward for organizations. diff --git a/packages/features/insights/components/RoutingFormResponsesTable.tsx b/packages/features/insights/components/RoutingFormResponsesTable.tsx index 0df8a7741e..9fc21cd64d 100644 --- a/packages/features/insights/components/RoutingFormResponsesTable.tsx +++ b/packages/features/insights/components/RoutingFormResponsesTable.tsx @@ -109,9 +109,10 @@ export function RoutingFormResponsesTable() { return ( <>
- table={table} isPending={isPending} + rowClassName="min-h-14" paginationMode="standard" totalRowCount={data?.total} LoaderView={} diff --git a/packages/features/settings/outOfOffice/OutOfOfficeEntriesList.tsx b/packages/features/settings/outOfOffice/OutOfOfficeEntriesList.tsx index 075f316ce2..4f575bd42a 100644 --- a/packages/features/settings/outOfOffice/OutOfOfficeEntriesList.tsx +++ b/packages/features/settings/outOfOffice/OutOfOfficeEntriesList.tsx @@ -329,7 +329,7 @@ function OutOfOfficeEntriesListContent() { <> - testId="managed-user-list-data-table" table={table} isPending={isPending} diff --git a/packages/features/users/components/UserTable/UserListTable.tsx b/packages/features/users/components/UserTable/UserListTable.tsx index b89c85cf9d..f65fead557 100644 --- a/packages/features/users/components/UserTable/UserListTable.tsx +++ b/packages/features/users/components/UserTable/UserListTable.tsx @@ -512,7 +512,7 @@ function UserListTableContent() { return ( <> - testId="user-list-data-table" table={table} isPending={isPending}