fix: put booking details and calendar behind feature flag (#25175)

* Revert "fix: revert bookings redesign (#25172)"

This reverts commit 1f102bf3b4.

* add bookings-v3 feature flag

* put things behind a feature flag

* remove no longer needed test

* revert e2e tests

* put back description

* revert AvatarGroup

* apply feedback

* remove "view" booking action

* remove Alert (When the bookings query errors, this branch now renders only the alert and skips the data-table filter/segment controls. Those controls moved into BookingsList, so in error states users can no longer clear or tweak filters to recover from the failure, effectively trapping them behind the alert.)

* address feedback

* revert useMediaQuery
This commit is contained in:
Eunjae Lee authored and GitHub committed 2025-11-19 16:27:13 +01:00
1 parent 7e4d9e26c6
commit dd7f108f08
32 files changed
+1547 -689

No files matched your search

@@ -13,6 +13,7 @@ export interface CalendarEvent {
allDay?: boolean;
color?: string;
className?: string;
bookingId?: number;
"data-test-id"?: string;
};
}
@@ -38,7 +38,9 @@ export type DataTablePropsFromWrapper<TData> = {
className?: string;
containerClassName?: string;
headerClassName?: string;
rowClassName?: string;
rowClassName?: string | ((row: Row<TData>) => string);
rowTestId?: string | ((row: Row<TData>) => string | undefined);
rowDataAttributes?: (row: Row<TData>) => Record<string, string> | undefined;
paginationMode?: "infinite" | "standard";
hasWrapperContext?: boolean;
hideSeparatorsOnSort?: boolean;
@@ -68,6 +70,8 @@ export function DataTable<TData>({
containerClassName,
headerClassName,
rowClassName,
rowTestId,
rowDataAttributes,
paginationMode = "infinite",
hasWrapperContext = false,
hideSeparatorsOnSort = true,
@@ -203,6 +207,8 @@ export function DataTable<TData>({
onRowMouseclick={onRowMouseclick}
paginationMode={paginationMode}
rowClassName={rowClassName}
rowTestId={rowTestId}
rowDataAttributes={rowDataAttributes}
hideSeparatorsOnSort={hideSeparatorsOnSort}
hideSeparatorsOnFilter={hideSeparatorsOnFilter}
separatorClassName={separatorClassName}
@@ -219,6 +225,8 @@ export function DataTable<TData>({
onRowMouseclick={onRowMouseclick}
paginationMode={paginationMode}
rowClassName={rowClassName}
rowTestId={rowTestId}
rowDataAttributes={rowDataAttributes}
hideSeparatorsOnSort={hideSeparatorsOnSort}
hideSeparatorsOnFilter={hideSeparatorsOnFilter}
separatorClassName={separatorClassName}
@@ -244,6 +252,8 @@ const MemoizedTableBody = memo(
prev.onRowMouseclick === next.onRowMouseclick &&
prev.paginationMode === next.paginationMode &&
prev.rowClassName === next.rowClassName &&
prev.rowTestId === next.rowTestId &&
prev.rowDataAttributes === next.rowDataAttributes &&
prev.hideSeparatorsOnSort === next.hideSeparatorsOnSort &&
prev.hideSeparatorsOnFilter === next.hideSeparatorsOnFilter &&
prev.separatorClassName === next.separatorClassName &&
@@ -259,7 +269,9 @@ type DataTableBodyProps<TData> = {
isPending?: boolean;
onRowMouseclick?: (row: Row<TData>) => void;
paginationMode?: "infinite" | "standard";
rowClassName?: string;
rowClassName?: string | ((row: Row<TData>) => string);
rowTestId?: string | ((row: Row<TData>) => string | undefined);
rowDataAttributes?: (row: Row<TData>) => Record<string, string> | undefined;
hideSeparatorsOnSort?: boolean;
hideSeparatorsOnFilter?: boolean;
separatorClassName?: string;
@@ -294,6 +306,8 @@ function DataTableBody<TData>({
onRowMouseclick,
paginationMode,
rowClassName,
rowTestId,
rowDataAttributes,
hideSeparatorsOnSort = true,
hideSeparatorsOnFilter = false,
separatorClassName,
@@ -374,10 +388,16 @@ function DataTableBody<TData>({
);
}
const computedRowTestId = typeof rowTestId === "function" ? rowTestId(row) : rowTestId;
const computedRowClassName = typeof rowClassName === "function" ? rowClassName(row) : rowClassName;
const computedDataAttributes = rowDataAttributes?.(row);
return (
<TableRow
ref={virtualItem ? (node) => filteredRowVirtualizer.measureElement(node) : undefined}
key={row.id}
data-testid={computedRowTestId}
{...computedDataAttributes}
data-index={virtualItem?.index} // needed for dynamic row height measurement
data-state={row.getIsSelected() && "selected"}
onClick={(e) => {
@@ -396,7 +416,7 @@ function DataTableBody<TData>({
width: "100%",
}),
}}
className={classNames(onRowMouseclick && "hover:cursor-pointer", "group", rowClassName)}>
className={classNames(onRowMouseclick && "hover:cursor-pointer", "group", computedRowClassName)}>
{row.getVisibleCells().map((cell) => {
const column = cell.column;
return (
@@ -435,7 +455,7 @@ const TableHeadLabel = <TData,>({ header }: { header: Header<TData, unknown> })
if (!canSort && !canHide) {
if (typeof header.column.columnDef.header === "string") {
return (
<div className="truncate px-2 py-1" title={header.column.columnDef.header}>
<div className="truncate" title={header.column.columnDef.header}>
{header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())}
</div>
);
@@ -20,8 +20,12 @@ type BaseDataTableWrapperProps<TData> = Omit<
ToolbarRight?: React.ReactNode;
EmptyView?: React.ReactNode;
LoaderView?: React.ReactNode;
ErrorView?: React.ReactNode;
hasError?: boolean;
tableContainerRef?: React.RefObject<HTMLDivElement>;
onRowMouseclick?: (row: Row<TData>) => void;
rowTestId?: string | ((row: Row<TData>) => string | undefined);
rowDataAttributes?: (row: Row<TData>) => Record<string, string> | undefined;
};
type InfinitePaginationProps<TData> = BaseDataTableWrapperProps<TData> & {
@@ -54,10 +58,14 @@ export function DataTableWrapper<TData>({
ToolbarRight,
EmptyView,
LoaderView,
ErrorView,
hasError,
className,
containerClassName,
headerClassName,
rowClassName,
rowTestId,
rowDataAttributes,
children,
tableContainerRef: externalRef,
paginationMode,
@@ -97,8 +105,10 @@ export function DataTableWrapper<TData>({
}));
}, [table, sorting, columnFilters, columnVisibility, setSorting, setColumnVisibility]);
let view: "loader" | "empty" | "table" = "table";
if (isPending && LoaderView) {
let view: "loader" | "empty" | "error" | "table" = "table";
if (hasError && ErrorView) {
view = "error";
} else if (isPending && LoaderView) {
view = "loader";
} else if (table.getRowCount() === 0 && EmptyView) {
view = "empty";
@@ -118,6 +128,7 @@ export function DataTableWrapper<TData>({
{children}
</div>
)}
{view === "error" && ErrorView}
{view === "loader" && LoaderView}
{view === "empty" && EmptyView}
{view === "table" && (
@@ -133,6 +144,8 @@ export function DataTableWrapper<TData>({
containerClassName={containerClassName}
headerClassName={headerClassName}
rowClassName={rowClassName}
rowTestId={rowTestId}
rowDataAttributes={rowDataAttributes}
paginationMode={paginationMode}
onRowMouseclick={onRowMouseclick}
hasWrapperContext={true}
+1
View File
@@ -31,6 +31,7 @@ export type AppFlags = {
"onboarding-v3": boolean;
"booker-botid": boolean;
"booking-calendar-view": boolean;
"bookings-v3": boolean;
};
export type TeamFeatures = Record<keyof AppFlags, boolean>;
+1
View File
@@ -30,6 +30,7 @@ const initialData: AppFlags = {
"onboarding-v3": false,
"booker-botid": false,
"booking-calendar-view": false,
"bookings-v3": false,
};
if (process.env.NEXT_PUBLIC_IS_E2E) {
@@ -0,0 +1,9 @@
INSERT INTO
"Feature" (slug, enabled, description, "type")
VALUES
(
'bookings-v3',
false,
'Enable bookings redesign v3 for all users',
'EXPERIMENT'
) ON CONFLICT (slug) DO NOTHING;
+1 -1
View File
@@ -70,7 +70,7 @@ const SheetContent = React.forwardRef<
ref={forwardedRef}
className={classNames(
// base
"fixed inset-y-4 mx-auto flex w-[95vw] flex-1 flex-col overflow-y-auto rounded-xl border p-4 shadow-lg focus:outline-none sm:right-2 sm:max-w-lg sm:p-6",
"fixed inset-x-0 inset-y-4 mx-auto flex w-[95vw] flex-1 flex-col overflow-y-auto rounded-xl border p-4 shadow-lg focus:outline-none sm:inset-x-auto sm:right-2 sm:max-w-lg sm:p-6",
// "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm sm:p-6 p-4 shadow-lg rounded-xl border ",
// border color
"border-subtle",