Skip to content

Commit 3986d61

Browse files
authored
feat(bookings): improve bookings redesign (calcom#25251)
* use booking.uid instead of booking.id for url param * show timezone on calendar * fix type * restore horizontal tab and remove header and subtitle * clean up sidebar items * fix event propagation from attendees * fetch all statuses except for cancelled on calendar view * clean up styles of the badges on BookingListItem * fix useMediaQuery * add close button to the header * add assignment reason to the details sheet * use separator row * use ToggleGroup for the top bookings tab * move ViewToggleButton * resize the action button * remove wrong prop * fix type error * fix type error * hide view toggle button on mobile (and fix the breakpoint) * remove unused e2e tests * fix e2e tests * hide toggle button when feature flag is off * update skeleton * improve attendees on booking list item and slide over * improve attendee dropdown * fix type error * move query to containers * select attendee email * infinite fetching for calendar view * update styles * fix compatibility * fix: add backward compatibility for status field in getAllUserBookings * increase calendar height * fix type error * support Member filter only for admin / owners * add debug log (TEMP) * add event border color * show Reject / Accept buttons on BookingDetailsSheet * move description section to the top * update When section * update style of Who section * add CancelBookingDialog WIP * fix CancelBookingDialog * increase clickable area * add schedule info section WIP * fix flaky reject button * fixing reschedule info WIP * add fromReschedule index to Booking * improve rescheduled information * improve reassignment * fix type error * fix unit test * respect user's weekStart value on the booking calendar view * update debug log * improve payment section * clean up * fix log message * reposition filters on list view * fix bookings controller api2 e2e test * clean up file by extracting logic into custom hooks * rename files * merge BookingCalendar into its container * extract logic into separate hook files * remove redundant logic * rearrange items on calendar view * add WeekPicker * extract filter button * responsive header on list view * horizontal scroll for ToggleGroup WIP * fix type error * fix cancelling recurring event * address feedback * fix e2e tests * fix unit test * fix e2e tests * make hover style more visible for ToggleGroup * fix margin on CancelBookingDialog * update styles on the slide over (mostly font weight) * update style of CancelBookingDialog * update styles * update margin top for the header * refactor getBookingDetails handler * fix gap in who section * auto-filter the current user on the calendar view * calculate calendar height considering top banners * improve booking details sheet interaction without overlay * update calendar event styles * update reject dialog style * put uid first in the query params * fix class name * memoize functions in useMediaQuery * query attendee with id instead of email * update margins * replace TRPCError with ErrorWithCode * move calculation outside loop * remove dead code
1 parent 41b71d8 commit 3986d61

File tree

90 files changed

+3733
-2071
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+3733
-2071
lines changed

apps/web/app/(use-page-wrapper)/(main-nav)/bookings/[status]/page.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ShellMainAppDir } from "app/(use-page-wrapper)/(main-nav)/ShellMainAppDir";
22
import type { PageProps } from "app/_types";
3-
import { _generateMetadata, getTranslate } from "app/_utils";
3+
import { _generateMetadata } from "app/_utils";
44
import { cookies, headers } from "next/headers";
55
import { redirect } from "next/navigation";
66
import { z } from "zod";
@@ -16,8 +16,6 @@ import { buildLegacyRequest } from "@lib/buildLegacyCtx";
1616
import { validStatuses } from "~/bookings/lib/validStatuses";
1717
import BookingsList from "~/bookings/views/bookings-view";
1818

19-
import { ViewToggleButton } from "./ViewToggleButton";
20-
2119
const querySchema = z.object({
2220
status: z.enum(validStatuses),
2321
});
@@ -36,7 +34,6 @@ const Page = async ({ params }: PageProps) => {
3634
if (!parsed.success) {
3735
redirect("/bookings/upcoming");
3836
}
39-
const t = await getTranslate();
4037
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
4138

4239
let canReadOthersBookings = false;
@@ -64,10 +61,7 @@ const Page = async ({ params }: PageProps) => {
6461
: false;
6562

6663
return (
67-
<ShellMainAppDir
68-
heading={t("bookings")}
69-
subtitle={t("bookings_description")}
70-
CTA={bookingsV3Enabled ? <ViewToggleButton /> : null}>
64+
<ShellMainAppDir>
7165
<BookingsList
7266
status={parsed.data.status}
7367
userId={session?.user?.id}

apps/web/components/apps/wipemycalother/wipeMyCalActionButton.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import { Button } from "@calcom/ui/components/button";
66
import { ConfirmDialog } from "./confirmDialog";
77

88
interface IWipeMyCalActionButtonProps {
9+
className?: string;
910
bookingsEmpty: boolean;
1011
bookingStatus: "upcoming" | "recurring" | "past" | "cancelled" | "unconfirmed";
1112
}
1213

1314
const WipeMyCalActionButton = (props: IWipeMyCalActionButtonProps) => {
14-
const { bookingsEmpty, bookingStatus } = props;
15+
const { className, bookingsEmpty, bookingStatus } = props;
1516
const [openDialog, setOpenDialog] = useState(false);
1617
const { isSuccess, isPending, data } = trpc.viewer.apps.integrations.useQuery({
1718
variant: "other",
@@ -28,7 +29,7 @@ const WipeMyCalActionButton = (props: IWipeMyCalActionButtonProps) => {
2829
return (
2930
<>
3031
{data && isSuccess && !isPending && credentialId && (
31-
<div className="mb-4">
32+
<div className={className}>
3233
<ConfirmDialog isOpenDialog={openDialog} setIsOpenDialog={setOpenDialog} />
3334
<Button color="primary" onClick={() => setOpenDialog(true)} data-testid="wipe-today-button">
3435
Wipe Today
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { useLocale } from "@calcom/lib/hooks/useLocale";
2+
import { Button } from "@calcom/ui/components/button";
3+
4+
import { useBookingConfirmation } from "./hooks/useBookingConfirmation";
5+
6+
interface AcceptBookingButtonProps {
7+
bookingId: number;
8+
bookingUid: string;
9+
recurringEventId?: string | null;
10+
isRecurring?: boolean;
11+
isTabRecurring?: boolean;
12+
isTabUnconfirmed?: boolean;
13+
size?: "sm" | "base" | "lg";
14+
color?: "primary" | "secondary" | "minimal" | "destructive";
15+
className?: string;
16+
}
17+
18+
export function AcceptBookingButton({
19+
bookingId,
20+
bookingUid,
21+
recurringEventId,
22+
isRecurring = false,
23+
isTabRecurring = false,
24+
isTabUnconfirmed = false,
25+
size = "base",
26+
color = "primary",
27+
className,
28+
}: AcceptBookingButtonProps) {
29+
const { t } = useLocale();
30+
31+
const { bookingConfirm, isPending } = useBookingConfirmation({
32+
isRecurring,
33+
isTabRecurring,
34+
isTabUnconfirmed,
35+
});
36+
37+
const confirmLabel = (isTabRecurring || isTabUnconfirmed) && isRecurring ? t("confirm_all") : t("confirm");
38+
39+
return (
40+
<Button
41+
color={color}
42+
size={size}
43+
className={className}
44+
onClick={() => bookingConfirm({ bookingId, confirmed: true, recurringEventId })}
45+
disabled={isPending}
46+
data-booking-uid={bookingUid}
47+
data-testid="confirm">
48+
{confirmLabel}
49+
</Button>
50+
);
51+
}

0 commit comments

Comments
 (0)