mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
* refactor: move Booker hooks from packages/features to apps/web/modules Migrate the following Booker hooks: - useOverlayCalendar - useSkipConfirmStep - useInitializeWeekStart - useIsQuickAvailabilityCheckFeatureEnabled - useDecoyBooking These hooks are only imported by apps/web files, making them safe to move without creating circular dependencies. Part of the tRPC-driven UI migration from packages/features to apps/web/modules. Co-Authored-By: [email protected] <[email protected]> * fix: revert useIsQuickAvailabilityCheckFeatureEnabled move and fix import paths - Reverted useIsQuickAvailabilityCheckFeatureEnabled.ts back to packages/features since it's imported by useSlots.ts in packages/features (would create circular dependency) - Fixed import paths in useOverlayCalendar.ts to use @calcom/features paths - Fixed import paths in useSkipConfirmStep.ts to use @calcom/features paths - Updated Booker.tsx to import useIsQuickAvailabilityCheckFeatureEnabled from original location Co-Authored-By: [email protected] <[email protected]> * fix: use @calcom/web alias for hook imports to fix vitest resolution Co-Authored-By: [email protected] <[email protected]> * refactor * migrate more hooks * fix * mv types * fix * fix * fix * fix * revert: remove formatting-only changes to make PR easier to review Co-Authored-By: [email protected] <[email protected]> * fix * fix * fix * revert: restore original import ordering in moved hooks Co-Authored-By: [email protected] <[email protected]> * fix imports * fix * fix * wip * wip * wip * wip * wip * wip * fix: add isBrowser guard to useSlotsViewOnSmallScreen hook Address Cubic AI review feedback (confidence 9/10) by adding the isBrowser guard to the useSlotsViewOnSmallScreen hook to follow the file's client-only contract and avoid executing during SSR/prerendering. Co-Authored-By: unknown <> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
"use client";
|
|
|
|
import { useParams } from "next/navigation";
|
|
|
|
import dayjs from "@calcom/dayjs";
|
|
import { DecoyBookingSuccessCard } from "~/bookings/components/DecoyBookingSuccessCard";
|
|
import { useDecoyBooking } from "~/bookings/hooks/useDecoyBooking";
|
|
|
|
export default function BookingSuccessful() {
|
|
const params = useParams();
|
|
|
|
const uid = params?.uid as string;
|
|
const bookingData = useDecoyBooking(uid);
|
|
|
|
if (!bookingData) {
|
|
return null;
|
|
}
|
|
|
|
const { booking } = bookingData;
|
|
|
|
// Format the data for the BookingSuccessCard
|
|
const startTime = booking.startTime ? dayjs(booking.startTime) : null;
|
|
const endTime = booking.endTime ? dayjs(booking.endTime) : null;
|
|
const timeZone = booking.booker?.timeZone || booking.host?.timeZone || dayjs.tz.guess();
|
|
|
|
const formattedDate = startTime ? startTime.tz(timeZone).format("dddd, MMMM D, YYYY") : "";
|
|
const formattedTime = startTime ? startTime.tz(timeZone).format("h:mm A") : "";
|
|
const formattedEndTime = endTime ? endTime.tz(timeZone).format("h:mm A") : "";
|
|
const formattedTimeZone = timeZone;
|
|
|
|
const hostName = booking.host?.name || null;
|
|
const hostEmail = null; // Email not stored for spam decoy bookings
|
|
const attendeeName = booking.booker?.name || null;
|
|
const attendeeEmail = booking.booker?.email || null;
|
|
|
|
return (
|
|
<DecoyBookingSuccessCard
|
|
title={booking.title || "Booking"}
|
|
formattedDate={formattedDate}
|
|
formattedTime={formattedTime}
|
|
endTime={formattedEndTime}
|
|
formattedTimeZone={formattedTimeZone}
|
|
hostName={hostName}
|
|
hostEmail={hostEmail}
|
|
attendeeName={attendeeName}
|
|
attendeeEmail={attendeeEmail}
|
|
location={booking.location || null}
|
|
/>
|
|
);
|
|
}
|