diff --git a/apps/web/components/booking/BookingListItem.tsx b/apps/web/components/booking/BookingListItem.tsx index 4cba1243c5..86cbb4daa8 100644 --- a/apps/web/components/booking/BookingListItem.tsx +++ b/apps/web/components/booking/BookingListItem.tsx @@ -1,4 +1,4 @@ -import { useRouter } from "next/navigation"; +import Link from "next/link"; import { useState } from "react"; import type { EventLocationType } from "@calcom/app-store/locations"; @@ -26,11 +26,11 @@ import { DialogFooter, MeetingTimeInTimezones, showToast, - Tooltip, TableActions, TextAreaField, + Tooltip, } from "@calcom/ui"; -import { Check, Clock, MapPin, RefreshCcw, Send, Ban, X, CreditCard } from "@calcom/ui/components/icon"; +import { Ban, Check, Clock, CreditCard, MapPin, RefreshCcw, Send, X } from "@calcom/ui/components/icon"; import useMeQuery from "@lib/hooks/useMeQuery"; @@ -58,7 +58,6 @@ function BookingListItem(booking: BookingItemProps) { i18n: { language }, } = useLocale(); const utils = trpc.useContext(); - const router = useRouter(); const [rejectionReason, setRejectionReason] = useState(""); const [rejectionDialogIsOpen, setRejectionDialogIsOpen] = useState(false); const [chargeCardDialogIsOpen, setChargeCardDialogIsOpen] = useState(false); @@ -259,14 +258,16 @@ function BookingListItem(booking: BookingItemProps) { .concat(booking.recurringInfo?.bookings[BookingStatus.PENDING]) .sort((date1: Date, date2: Date) => date1.getTime() - date2.getTime()); - const onClickTableData = () => { + const buildBookingLink = () => { const urlSearchParams = new URLSearchParams({ allRemainingBookings: isTabRecurring.toString(), }); if (booking.attendees[0]) urlSearchParams.set("email", booking.attendees[0].email); - router.push(`/booking/${booking.uid}?${urlSearchParams.toString()}`); + return `/booking/${booking.uid}?${urlSearchParams.toString()}`; }; + const bookingLink = buildBookingLink(); + const title = booking.title; // To be used after we run query on legacy bookings // const showRecordingsButtons = booking.isRecorded && isPast && isConfirmed; @@ -337,54 +338,11 @@ function BookingListItem(booking: BookingItemProps) { - -
-
{startTime}
-
- {formatTime(booking.startTime, user?.timeFormat, user?.timeZone)} -{" "} - {formatTime(booking.endTime, user?.timeFormat, user?.timeZone)} - -
- {isPending && ( - - {t("unconfirmed")} - - )} - {booking.eventType?.team && ( - - {booking.eventType.team.name} - - )} - {booking.paid && !booking.payment[0] ? ( - - {t("error_collecting_card")} - - ) : booking.paid ? ( - - {booking.payment[0].paymentOption === "HOLD" ? t("card_held") : t("paid")} - - ) : null} - {recurringDates !== undefined && ( -
- -
- )} -
- - - {/* Time and Badges for mobile */} -
-
+ + +
{startTime}
-
+
{formatTime(booking.startTime, user?.timeFormat, user?.timeZone)} -{" "} {formatTime(booking.endTime, user?.timeFormat, user?.timeZone)}
+ {isPending && ( + + {t("unconfirmed")} + + )} + {booking.eventType?.team && ( + + {booking.eventType.team.name} + + )} + {booking.paid && !booking.payment[0] ? ( + + {t("error_collecting_card")} + + ) : booking.paid ? ( + + {booking.payment[0].paymentOption === "HOLD" ? t("card_held") : t("paid")} + + ) : null} + {recurringDates !== undefined && ( +
+ +
+ )}
- - {isPending && ( - - {t("unconfirmed")} - - )} - {booking.eventType?.team && ( - - {booking.eventType.team.name} - - )} - {!!booking?.eventType?.price && !booking.paid && ( - - {t("pending_payment")} - - )} - {recurringDates !== undefined && ( -
- + + + + + {/* Time and Badges for mobile */} +
+
+
{startTime}
+
+ {formatTime(booking.startTime, user?.timeFormat, user?.timeZone)} -{" "} + {formatTime(booking.endTime, user?.timeFormat, user?.timeZone)} + +
- )} -
-
-
- {title} - - - {paymentAppData.enabled && !booking.paid && booking.payment.length && ( - + {isPending && ( + + {t("unconfirmed")} + + )} + {booking.eventType?.team && ( + + {booking.eventType.team.name} + + )} + {!!booking?.eventType?.price && !booking.paid && ( + {t("pending_payment")} )} + {recurringDates !== undefined && ( +
+ +
+ )}
- {booking.description && ( + +
- "{booking.description}" + title={title} + className={classNames( + "max-w-10/12 sm:max-w-56 text-emphasis text-sm font-medium leading-6 md:max-w-full", + isCancelled ? "line-through" : "" + )}> + {title} + + + {paymentAppData.enabled && !booking.paid && booking.payment.length && ( + + {t("pending_payment")} + + )}
- )} - {booking.attendees.length !== 0 && ( - - )} - {isCancelled && booking.rescheduled && ( -
- -
- )} -
+ {booking.description && ( +
+ "{booking.description}" +
+ )} + {booking.attendees.length !== 0 && ( + + )} + {isCancelled && booking.rescheduled && ( +
+ +
+ )} +
+ {isUpcoming && !isCancelled ? (