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:
1 parent
7e4d9e26c6
commit
dd7f108f08
32 files changed
+1547
-689
No files matched your search
@@ -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}
|
||||
|
||||
Reference in new issue
Block a user