fix: revert bookings redesign (#25172)

* Revert "refactor: extract logic as bookingDetailsSheetStore (#25129)"

This reverts commit 7a0b8a9eba.

* Revert "feat: bookings page redesign v3 with calendar view (#24664)"

This reverts commit 89230474a5.
This commit is contained in:
Eunjae Lee authored and GitHub committed 2025-11-14 17:24:31 +00:00
1 parent 7a0b8a9eba
commit 1f102bf3b4
35 files changed
+637 -1990

No files matched your search

@@ -499,7 +499,7 @@ function BookingListItem(booking: BookingItemProps) {
</div>
<div className="flex w-full flex-col flex-wrap items-end justify-end space-x-2 space-y-2 py-4 pl-4 text-right text-sm font-medium ltr:pr-4 rtl:pl-4 sm:flex-row sm:flex-nowrap sm:items-start sm:space-y-0 sm:pl-0">
{shouldShowPendingActions(actionContext) && <TableActions actions={pendingActions} />}
<BookingActionsDropdown booking={booking} />
<BookingActionsDropdown booking={booking} context="booking-list-item" />
{shouldShowRecurringCancelAction(actionContext) && <TableActions actions={[cancelEventAction]} />}
{shouldShowIndividualReportButton(actionContext) && (
<div className="flex items-center space-x-2">
+21 -68
View File
@@ -1,83 +1,36 @@
import React from "react";
import classNames from "@calcom/ui/classNames";
import { SkeletonAvatar, SkeletonText } from "@calcom/ui/components/skeleton";
import { SkeletonText } from "@calcom/ui/components/skeleton";
function SkeletonLoader() {
return (
<div className="animate-pulse">
{/* Table rows with separator at the beginning */}
<div className="divide-subtle divide-y">
{/* Month separator skeleton */}
<div className="bg-muted rounded-t py-2">
<SkeletonItem isHeader={true} />
</div>
<div className="bg-muted">
<SkeletonText className="ml-2 mt-3 h-4 w-28 rounded" />
</div>
<SkeletonItem />
<SkeletonItem />
<SkeletonItem />
<SkeletonItem />
<SkeletonItem />
</div>
</div>
<ul className="divide-subtle border-subtle bg-default animate-pulse divide-y rounded-md border sm:overflow-hidden">
<SkeletonItem />
<SkeletonItem />
<SkeletonItem />
</ul>
);
}
export default SkeletonLoader;
function SkeletonItem({ isHeader = false }: { isHeader?: boolean }) {
function SkeletonItem() {
return (
<div
className={classNames(
"grid grid-cols-[132px_130px_185px_150px_140px_280px] gap-6 px-2",
isHeader ? "py-2" : "py-2.5"
)}>
{/* Date column - 140px */}
<div className="flex items-center">
<SkeletonText className={classNames("h-4 rounded", isHeader ? "w-12" : "w-20")} />
<li className="group flex w-full items-center justify-between px-4 py-4 sm:px-6">
<div className="flex-grow truncate text-sm">
<div className="flex">
<div className="flex flex-col space-y-2">
<SkeletonText className="h-5 w-16" />
<SkeletonText className="h-4 w-32" />
</div>
</div>
</div>
{/* Time column - 140px */}
<div className="flex items-center">
<SkeletonText className={classNames("h-4 rounded", isHeader ? "w-12" : "w-28")} />
<div className="mt-4 hidden flex-shrink-0 sm:ml-5 sm:mt-0 lg:flex">
<div className="flex justify-between space-x-2 rtl:space-x-reverse">
<SkeletonText className="h-6 w-16" />
<SkeletonText className="h-6 w-32" />
</div>
</div>
{/* Event column - 200px */}
<div className="flex items-center">
<SkeletonText className={classNames("h-4 rounded", isHeader ? "w-16" : "w-full")} />
</div>
{/* Who column - 160px, Avatar group */}
<div className="flex items-center -space-x-1">
{isHeader && <SkeletonText className="h-4 w-20 rounded" />}
{!isHeader && (
<>
<SkeletonAvatar className="h-6 w-6 rounded-full" />
<SkeletonAvatar className="h-6 w-6 rounded-full" />
<SkeletonAvatar className="h-6 w-6 rounded-full" />
</>
)}
</div>
{/* Team column - 140px */}
<div className="flex items-center">
<SkeletonText className="h-4 w-20 rounded-md" />
</div>
{/* Actions column - 280px */}
<div className="mr-2 flex items-center justify-end gap-2">
{isHeader && <SkeletonText className="h-4 w-16 rounded-md" />}
{!isHeader && (
<>
<SkeletonText className="h-4 w-16 rounded-md" />
<SkeletonText className="h-4 w-20 rounded-md" />
<SkeletonText className="h-4 w-8 rounded-md" />
</>
)}
</div>
</div>
</li>
);
}
@@ -15,9 +15,9 @@ import {
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuPortal,
DropdownMenuSeparator,
DropdownMenuTrigger,
DropdownMenuPortal,
} from "@calcom/ui/components/dropdown";
import { TextAreaField } from "@calcom/ui/components/form";
import type { ActionType } from "@calcom/ui/components/table";
@@ -31,7 +31,6 @@ import { ReportBookingDialog } from "@components/dialog/ReportBookingDialog";
import { RerouteDialog } from "@components/dialog/RerouteDialog";
import { RescheduleDialog } from "@components/dialog/RescheduleDialog";
import { buildBookingLink } from "../../../modules/bookings/lib/buildBookingLink";
import type { BookingItemProps } from "../types";
import { useBookingActionsStoreContext } from "./BookingActionsStoreProvider";
import {
@@ -40,29 +39,16 @@ import {
getAfterEventActions,
getReportAction,
shouldShowEditActions,
shouldShowPendingActions,
getPendingActions,
type BookingActionContext,
} from "./bookingActions";
interface BookingActionsDropdownProps {
booking: BookingItemProps;
context: "booking-list-item" | "booking-details-sheet";
size?: "xs" | "sm" | "base" | "lg";
className?: string;
/**
* Whether to use a portal for the dropdown menu.
* Set to false when rendering inside a Sheet/Dialog to keep the dropdown within the modal's stacking context.
* @default true
*/
usePortal?: boolean;
}
export function BookingActionsDropdown({
booking,
size = "base",
className,
usePortal = true,
}: BookingActionsDropdownProps) {
export function BookingActionsDropdown({ booking, context, size = "base" }: BookingActionsDropdownProps) {
const { t } = useLocale();
const utils = trpc.useUtils();
@@ -178,13 +164,6 @@ export function BookingActionsDropdown({
const isBookingFromRoutingForm = !!booking.routedFromRoutingFormReponse && !!booking.eventType?.team;
// Build booking confirmation link
const bookingLink = buildBookingLink({
bookingUid: booking.uid,
allRemainingBookings: isRecurring,
email: booking.attendees?.[0]?.email,
});
const userEmail = booking.loggedInUser.userEmail;
const userSeat = booking.seatsReferences.find((seat) => !!userEmail && seat.attendee?.email === userEmail);
const isAttendee = !!userSeat;
@@ -232,10 +211,6 @@ export function BookingActionsDropdown({
}
};
// Calculate showPendingPayment based on payment logic
const hasPayment = booking.payment.length > 0;
const showPendingPayment = hasPayment;
const actionContext: BookingActionContext = {
booking,
isUpcoming,
@@ -253,7 +228,7 @@ export function BookingActionsDropdown({
isDisabledCancelling,
isDisabledRescheduling,
isCalVideoLocation,
showPendingPayment,
showPendingPayment: false, // This will be calculated below
isAttendee,
cardCharged,
attendeeList,
@@ -263,20 +238,6 @@ export function BookingActionsDropdown({
const cancelEventAction = getCancelEventAction(actionContext);
// Get pending actions (accept/reject)
const shouldShowPending = shouldShowPendingActions(actionContext);
const basePendingActions = shouldShowPending ? getPendingActions(actionContext) : [];
const pendingActions: ActionType[] = basePendingActions.map((action) => ({
...action,
disabled: mutation.isPending,
onClick:
action.id === "confirm"
? () => bookingConfirm(true)
: action.id === "reject"
? () => setRejectionDialogIsOpen(true)
: undefined,
})) as ActionType[];
const shouldShowEdit = shouldShowEditActions(actionContext);
const baseEditEventActions = getEditEventActions(actionContext);
const editEventActions: ActionType[] = baseEditEventActions.map((action) => ({
@@ -539,26 +500,22 @@ export function BookingActionsDropdown({
// Check if there are any available actions across all action groups
const hasAnyAvailableActions = () => {
// Check if any pending action is available
const hasAvailablePendingAction = pendingActions.some((action) => !action.disabled);
// Check if any edit action is available
const hasAvailableEditAction = editEventActions.some((action) => !action.disabled);
// Check if any after event action is available
const hasAvailableAfterAction = afterEventActions.some((action) => !action.disabled);
// Check report and cancel actions
// For booking-list-item context, only check edit and after event actions
if (context === "booking-list-item") {
return hasAvailableEditAction || hasAvailableAfterAction;
}
// For booking-details-sheet context, also check report and cancel actions
const isReportAvailable = !reportActionWithHandler.disabled;
const isCancelAvailable = !cancelEventAction.disabled;
return (
hasAvailablePendingAction ||
hasAvailableEditAction ||
hasAvailableAfterAction ||
isReportAvailable ||
isCancelAvailable
);
return hasAvailableEditAction || hasAvailableAfterAction || isReportAvailable || isCancelAvailable;
};
// Don't render dropdown if no actions are available
@@ -566,150 +523,94 @@ export function BookingActionsDropdown({
return dialogs;
}
// Conditional portal wrapper to avoid portal when inside Sheet/Dialog
const ConditionalPortal = usePortal
? DropdownMenuPortal
: ({ children }: { children: React.ReactNode }) => <>{children}</>;
const menuContent = (
<DropdownMenuContent>
<DropdownMenuLabel className="px-2 pb-1 pt-1.5">{t("edit_event")}</DropdownMenuLabel>
{editEventActions.map((action) => (
<DropdownMenuItem className="rounded-lg" key={action.id} disabled={action.disabled}>
<DropdownItem
type="button"
color={action.color}
StartIcon={action.icon}
href={action.href}
disabled={action.disabled}
onClick={action.onClick}
data-bookingid={action.bookingId}
data-testid={action.id}
className={action.disabled ? "text-muted" : undefined}>
{action.label}
</DropdownItem>
</DropdownMenuItem>
))}
<DropdownMenuSeparator />
<DropdownMenuLabel className="px-2 pb-1 pt-1.5">{t("after_event")}</DropdownMenuLabel>
{afterEventActions.map((action) => (
<DropdownMenuItem className="rounded-lg" key={action.id} disabled={action.disabled}>
<DropdownItem
type="button"
color={action.color}
StartIcon={action.icon}
href={action.href}
onClick={action.onClick}
disabled={action.disabled}
data-bookingid={action.bookingId}
data-testid={action.id}
className={action.disabled ? "text-muted" : undefined}>
{action.label}
</DropdownItem>
</DropdownMenuItem>
))}
<>
<DropdownMenuSeparator />
<DropdownMenuItem
className="rounded-lg"
key={reportActionWithHandler.id}
disabled={reportActionWithHandler.disabled}>
<DropdownItem
type="button"
color={reportActionWithHandler.color}
StartIcon={reportActionWithHandler.icon}
onClick={reportActionWithHandler.onClick}
disabled={reportActionWithHandler.disabled}
data-testid={reportActionWithHandler.id}
className={reportActionWithHandler.disabled ? "text-muted" : undefined}>
{reportActionWithHandler.label}
</DropdownItem>
</DropdownMenuItem>
</>
<DropdownMenuSeparator />
<DropdownMenuItem
className="rounded-lg"
key={cancelEventAction.id}
disabled={cancelEventAction.disabled}>
<DropdownItem
type="button"
color={cancelEventAction.color}
StartIcon={cancelEventAction.icon}
href={cancelEventAction.disabled ? undefined : cancelEventAction.href}
onClick={cancelEventAction.onClick}
disabled={cancelEventAction.disabled}
data-bookingid={cancelEventAction.bookingId}
data-testid={cancelEventAction.id}
className={cancelEventAction.disabled ? "text-muted" : undefined}>
{cancelEventAction.label}
</DropdownItem>
</DropdownMenuItem>
</DropdownMenuContent>
);
return (
<>
{dialogs}
<Dropdown modal={false}>
<Dropdown modal={context === "booking-details-sheet" ? false : undefined}>
<DropdownMenuTrigger asChild data-testid="booking-actions-dropdown">
<Button
type="button"
color="secondary"
size={size}
StartIcon="ellipsis"
className={className}
// Prevent click from bubbling to parent row/container click handlers
onClick={(e) => e.stopPropagation()}
/>
<Button type="button" color="secondary" variant="icon" size={size} StartIcon="ellipsis" />
</DropdownMenuTrigger>
<ConditionalPortal>
<DropdownMenuContent>
<DropdownMenuItem className="rounded-lg">
<DropdownItem
type="button"
StartIcon="external-link"
href={bookingLink}
target="_blank"
data-testid="view-booking"
onClick={(e) => e.stopPropagation()}>
{t("view")}
</DropdownItem>
</DropdownMenuItem>
<DropdownMenuSeparator />
{pendingActions.length > 0 && (
<>
<DropdownMenuLabel className="px-2 pb-1 pt-1.5">{t("booking_response")}</DropdownMenuLabel>
{pendingActions.map((action) => (
<DropdownMenuItem className="rounded-lg" key={action.id} disabled={action.disabled}>
<DropdownItem
type="button"
color={action.color}
StartIcon={action.icon}
href={action.href}
disabled={action.disabled}
onClick={(e) => {
e.stopPropagation();
action.onClick?.(e);
}}
data-bookingid={action.bookingId}
data-testid={action.id}
className={action.disabled ? "text-muted" : undefined}>
{action.label}
</DropdownItem>
</DropdownMenuItem>
))}
<DropdownMenuSeparator />
</>
)}
<DropdownMenuLabel className="px-2 pb-1 pt-1.5">{t("edit_event")}</DropdownMenuLabel>
{editEventActions.map((action) => (
<DropdownMenuItem className="rounded-lg" key={action.id} disabled={action.disabled}>
<DropdownItem
type="button"
color={action.color}
StartIcon={action.icon}
href={action.href}
disabled={action.disabled}
onClick={(e) => {
e.stopPropagation();
action.onClick?.(e);
}}
data-bookingid={action.bookingId}
data-testid={action.id}
className={action.disabled ? "text-muted" : undefined}>
{action.label}
</DropdownItem>
</DropdownMenuItem>
))}
<DropdownMenuSeparator />
<DropdownMenuLabel className="px-2 pb-1 pt-1.5">{t("after_event")}</DropdownMenuLabel>
{afterEventActions.map((action) => (
<DropdownMenuItem className="rounded-lg" key={action.id} disabled={action.disabled}>
<DropdownItem
type="button"
color={action.color}
StartIcon={action.icon}
href={action.href}
onClick={(e) => {
e.stopPropagation();
action.onClick?.(e);
}}
disabled={action.disabled}
data-bookingid={action.bookingId}
data-testid={action.id}
className={action.disabled ? "text-muted" : undefined}>
{action.label}
</DropdownItem>
</DropdownMenuItem>
))}
<>
<DropdownMenuSeparator />
<DropdownMenuItem
className="rounded-lg"
key={reportActionWithHandler.id}
disabled={reportActionWithHandler.disabled}>
<DropdownItem
type="button"
color={reportActionWithHandler.color}
StartIcon={reportActionWithHandler.icon}
onClick={(e) => {
e.stopPropagation();
reportActionWithHandler.onClick?.();
}}
disabled={reportActionWithHandler.disabled}
data-testid={reportActionWithHandler.id}
className={reportActionWithHandler.disabled ? "text-muted" : undefined}>
{reportActionWithHandler.label}
</DropdownItem>
</DropdownMenuItem>
</>
<DropdownMenuSeparator />
<DropdownMenuItem
className="rounded-lg"
key={cancelEventAction.id}
disabled={cancelEventAction.disabled}>
<DropdownItem
type="button"
color={cancelEventAction.color}
StartIcon={cancelEventAction.icon}
href={cancelEventAction.disabled ? undefined : cancelEventAction.href}
onClick={(e) => {
e.stopPropagation();
cancelEventAction.onClick?.(e);
}}
disabled={cancelEventAction.disabled}
data-bookingid={cancelEventAction.bookingId}
data-testid={cancelEventAction.id}
className={cancelEventAction.disabled ? "text-muted" : undefined}>
{cancelEventAction.label}
</DropdownItem>
</DropdownMenuItem>
</DropdownMenuContent>
</ConditionalPortal>
{context === "booking-details-sheet" ? (
menuContent
) : (
<DropdownMenuPortal>{menuContent}</DropdownMenuPortal>
)}
</Dropdown>
</>
);
@@ -137,18 +137,18 @@ describe("Booking Actions", () => {
expect(actions).toHaveLength(2);
expect(actions[0]).toEqual({
id: "reject",
label: "reject",
icon: "ban",
disabled: false,
});
expect(actions[1]).toEqual({
id: "confirm",
bookingId: 1,
label: "confirm",
icon: "check",
disabled: false,
});
expect(actions[1]).toEqual({
id: "reject",
label: "reject",
icon: "ban",
disabled: false,
});
});
it("should return reject action only for non-pending booking", () => {
@@ -167,8 +167,8 @@ describe("Booking Actions", () => {
});
const actions = getPendingActions(context);
expect(actions[0].label).toBe("confirm_all");
expect(actions[1].label).toBe("reject_all");
expect(actions[0].label).toBe("reject_all");
expect(actions[1].label).toBe("confirm_all");
});
});
@@ -38,7 +38,14 @@ export function getPendingActions(context: BookingActionContext): ActionType[] {
const { booking, isPending, isTabRecurring, isTabUnconfirmed, isRecurring, showPendingPayment, t } =
context;
const actions: ActionType[] = [];
const actions: ActionType[] = [
{
id: "reject",
label: (isTabRecurring || isTabUnconfirmed) && isRecurring ? t("reject_all") : t("reject"),
icon: "ban",
disabled: false, // This would be controlled by mutation state in the component
},
];
// For bookings with payment, only confirm if the booking is paid for
// Original logic: (isPending && !paymentAppData.enabled) || (paymentAppData.enabled && !!paymentAppData.price && booking.paid)
@@ -52,13 +59,6 @@ export function getPendingActions(context: BookingActionContext): ActionType[] {
});
}
actions.push({
id: "reject",
label: (isTabRecurring || isTabUnconfirmed) && isRecurring ? t("reject_all") : t("reject"),
icon: "ban",
disabled: false, // This would be controlled by mutation state in the component
});
return actions;
}
@@ -36,7 +36,7 @@ export const RescheduleDialog = (props: IRescheduleDialog) => {
return (
<Dialog open={isOpenDialog} onOpenChange={setIsOpenDialog}>
<DialogContent enableOverflow data-testid="reschedule-dialog">
<DialogContent enableOverflow>
<div className="flex flex-row space-x-3">
<div className="bg-subtle flex h-10 w-10 flex-shrink-0 justify-center rounded-full ">
<Icon name="clock" className="m-auto h-6 w-6" />