2021-09-14 08:45:28 +00:00
|
|
|
// Get router variables
|
2022-03-07 15:48:51 +00:00
|
|
|
import {
|
|
|
|
ArrowLeftIcon,
|
2022-04-14 21:25:24 +00:00
|
|
|
CalendarIcon,
|
2022-03-07 15:48:51 +00:00
|
|
|
ChevronDownIcon,
|
|
|
|
ChevronUpIcon,
|
|
|
|
ClockIcon,
|
|
|
|
CreditCardIcon,
|
|
|
|
GlobeIcon,
|
2022-04-14 21:25:24 +00:00
|
|
|
InformationCircleIcon,
|
2022-05-05 21:16:25 +00:00
|
|
|
RefreshIcon,
|
2022-03-07 15:48:51 +00:00
|
|
|
} from "@heroicons/react/solid";
|
2021-09-22 19:52:38 +00:00
|
|
|
import * as Collapsible from "@radix-ui/react-collapsible";
|
2022-02-03 23:23:20 +00:00
|
|
|
import { useContracts } from "contexts/contractsContext";
|
2021-09-14 08:45:28 +00:00
|
|
|
import dayjs, { Dayjs } from "dayjs";
|
|
|
|
import customParseFormat from "dayjs/plugin/customParseFormat";
|
|
|
|
import utc from "dayjs/plugin/utc";
|
2021-09-22 19:52:38 +00:00
|
|
|
import { useRouter } from "next/router";
|
2021-09-23 14:08:44 +00:00
|
|
|
import { useEffect, useMemo, useState } from "react";
|
2021-09-22 19:52:38 +00:00
|
|
|
import { FormattedNumber, IntlProvider } from "react-intl";
|
2022-05-05 21:16:25 +00:00
|
|
|
import { Frequency as RRuleFrequency } from "rrule";
|
2021-09-22 19:52:38 +00:00
|
|
|
|
2022-04-25 04:33:00 +00:00
|
|
|
import {
|
|
|
|
useEmbedStyles,
|
|
|
|
useIsEmbed,
|
|
|
|
useIsBackgroundTransparent,
|
|
|
|
sdkActionManager,
|
|
|
|
useEmbedType,
|
|
|
|
useEmbedNonStylesConfig,
|
|
|
|
} from "@calcom/embed-core";
|
2022-04-08 05:33:24 +00:00
|
|
|
import classNames from "@calcom/lib/classNames";
|
2022-05-05 21:16:25 +00:00
|
|
|
import { WEBAPP_URL } from "@calcom/lib/constants";
|
2022-04-14 21:25:24 +00:00
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
2022-04-08 05:33:24 +00:00
|
|
|
|
2021-09-22 19:52:38 +00:00
|
|
|
import { asStringOrNull } from "@lib/asStringOrNull";
|
2021-09-14 08:45:28 +00:00
|
|
|
import { timeZone } from "@lib/clock";
|
2022-04-04 15:44:04 +00:00
|
|
|
import { useExposePlanGlobally } from "@lib/hooks/useExposePlanGlobally";
|
2021-09-22 19:52:38 +00:00
|
|
|
import useTheme from "@lib/hooks/useTheme";
|
|
|
|
import { isBrandingHidden } from "@lib/isBrandingHidden";
|
2022-04-14 21:25:24 +00:00
|
|
|
import { parseDate } from "@lib/parseDate";
|
2021-09-22 19:52:38 +00:00
|
|
|
import { collectPageParameters, telemetryEventTypes, useTelemetry } from "@lib/telemetry";
|
2022-02-23 12:37:15 +00:00
|
|
|
import { detectBrowserTimeFormat } from "@lib/timeFormat";
|
2021-09-22 19:52:38 +00:00
|
|
|
|
2021-11-16 08:51:46 +00:00
|
|
|
import CustomBranding from "@components/CustomBranding";
|
2021-09-14 08:45:28 +00:00
|
|
|
import AvailableTimes from "@components/booking/AvailableTimes";
|
2021-09-22 19:52:38 +00:00
|
|
|
import DatePicker from "@components/booking/DatePicker";
|
2021-09-14 08:45:28 +00:00
|
|
|
import TimeOptions from "@components/booking/TimeOptions";
|
|
|
|
import { HeadSeo } from "@components/seo/head-seo";
|
|
|
|
import AvatarGroup from "@components/ui/AvatarGroup";
|
2021-09-26 14:04:01 +00:00
|
|
|
import PoweredByCal from "@components/ui/PoweredByCal";
|
2021-09-14 08:45:28 +00:00
|
|
|
|
2021-09-23 14:08:44 +00:00
|
|
|
import { AvailabilityPageProps } from "../../../pages/[user]/[type]";
|
2021-09-29 21:33:18 +00:00
|
|
|
import { AvailabilityTeamPageProps } from "../../../pages/team/[slug]/[type]";
|
2021-09-23 14:08:44 +00:00
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
dayjs.extend(utc);
|
|
|
|
dayjs.extend(customParseFormat);
|
|
|
|
|
2021-09-29 21:33:18 +00:00
|
|
|
type Props = AvailabilityTeamPageProps | AvailabilityPageProps;
|
|
|
|
|
2022-04-14 21:25:24 +00:00
|
|
|
const AvailabilityPage = ({ profile, plan, eventType, workingHours, previousPage, booking }: Props) => {
|
2021-09-14 08:45:28 +00:00
|
|
|
const router = useRouter();
|
2022-04-08 05:33:24 +00:00
|
|
|
const isEmbed = useIsEmbed();
|
2021-09-14 08:45:28 +00:00
|
|
|
const { rescheduleUid } = router.query;
|
2022-02-10 11:07:14 +00:00
|
|
|
const { isReady, Theme } = useTheme(profile.theme);
|
2022-04-14 21:25:24 +00:00
|
|
|
const { t, i18n } = useLocale();
|
2022-02-03 23:23:20 +00:00
|
|
|
const { contracts } = useContracts();
|
2022-04-08 05:33:24 +00:00
|
|
|
const availabilityDatePickerEmbedStyles = useEmbedStyles("availabilityDatePicker");
|
2022-04-25 04:33:00 +00:00
|
|
|
const shouldAlignCentrallyInEmbed = useEmbedNonStylesConfig("align") !== "left";
|
|
|
|
const shouldAlignCentrally = !isEmbed || shouldAlignCentrallyInEmbed;
|
2022-04-08 05:33:24 +00:00
|
|
|
let isBackgroundTransparent = useIsBackgroundTransparent();
|
2022-04-04 15:44:04 +00:00
|
|
|
useExposePlanGlobally(plan);
|
2022-02-03 23:23:20 +00:00
|
|
|
useEffect(() => {
|
|
|
|
if (eventType.metadata.smartContractAddress) {
|
|
|
|
const eventOwner = eventType.users[0];
|
|
|
|
if (!contracts[(eventType.metadata.smartContractAddress || null) as number])
|
|
|
|
router.replace(`/${eventOwner.username}`);
|
|
|
|
}
|
|
|
|
}, [contracts, eventType.metadata.smartContractAddress, router]);
|
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
const selectedDate = useMemo(() => {
|
|
|
|
const dateString = asStringOrNull(router.query.date);
|
|
|
|
if (dateString) {
|
2022-03-28 18:50:31 +00:00
|
|
|
const offsetString = dateString.substr(11, 14); // hhmm
|
|
|
|
const offsetSign = dateString.substr(10, 1); // + or -
|
|
|
|
|
|
|
|
const offsetHour = offsetString.slice(0, -2);
|
|
|
|
const offsetMinute = offsetString.slice(-2);
|
|
|
|
|
|
|
|
const utcOffsetInMinutes =
|
|
|
|
(offsetSign === "-" ? -1 : 1) *
|
|
|
|
(60 * (offsetHour !== "" ? parseInt(offsetHour) : 0) +
|
|
|
|
(offsetMinute !== "" ? parseInt(offsetMinute) : 0));
|
|
|
|
|
|
|
|
const date = dayjs(dateString.substr(0, 10)).utcOffset(utcOffsetInMinutes, true);
|
2021-09-14 08:45:28 +00:00
|
|
|
return date.isValid() ? date : null;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}, [router.query.date]);
|
|
|
|
|
2022-04-14 02:47:34 +00:00
|
|
|
if (selectedDate) {
|
|
|
|
// Let iframe take the width available due to increase in max-width
|
|
|
|
sdkActionManager?.fire("__refreshWidth", {});
|
|
|
|
}
|
2021-09-14 08:45:28 +00:00
|
|
|
const [isTimeOptionsOpen, setIsTimeOptionsOpen] = useState(false);
|
2022-02-23 12:37:15 +00:00
|
|
|
const [timeFormat, setTimeFormat] = useState(detectBrowserTimeFormat);
|
2022-05-05 21:16:25 +00:00
|
|
|
const [recurringEventCount, setRecurringEventCount] = useState(eventType.recurringEvent?.count);
|
2022-02-23 12:37:15 +00:00
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
const telemetry = useTelemetry();
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
handleToggle24hClock(localStorage.getItem("timeOption.is24hClock") === "true");
|
2022-02-23 12:37:15 +00:00
|
|
|
|
2022-04-14 02:47:34 +00:00
|
|
|
telemetry.withJitsu((jitsu) =>
|
|
|
|
jitsu.track(
|
|
|
|
telemetryEventTypes.pageView,
|
|
|
|
collectPageParameters("availability", { isTeamBooking: document.URL.includes("team/") })
|
|
|
|
)
|
|
|
|
);
|
2021-09-14 08:45:28 +00:00
|
|
|
}, [telemetry]);
|
|
|
|
|
|
|
|
const changeDate = (newDate: Dayjs) => {
|
|
|
|
router.replace(
|
|
|
|
{
|
|
|
|
query: {
|
|
|
|
...router.query,
|
|
|
|
date: newDate.format("YYYY-MM-DDZZ"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
undefined,
|
|
|
|
{
|
|
|
|
shallow: true,
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleSelectTimeZone = (selectedTimeZone: string): void => {
|
|
|
|
if (selectedDate) {
|
|
|
|
changeDate(selectedDate.tz(selectedTimeZone, true));
|
|
|
|
}
|
|
|
|
timeZone(selectedTimeZone);
|
|
|
|
setIsTimeOptionsOpen(false);
|
|
|
|
};
|
|
|
|
|
|
|
|
const handleToggle24hClock = (is24hClock: boolean) => {
|
|
|
|
setTimeFormat(is24hClock ? "HH:mm" : "h:mma");
|
|
|
|
};
|
|
|
|
|
2022-05-05 21:16:25 +00:00
|
|
|
// Recurring event sidebar requires more space
|
|
|
|
const maxWidth = selectedDate
|
|
|
|
? recurringEventCount
|
|
|
|
? "max-w-6xl"
|
|
|
|
: "max-w-5xl"
|
|
|
|
: recurringEventCount
|
|
|
|
? "max-w-4xl"
|
|
|
|
: "max-w-3xl";
|
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
return (
|
2021-09-24 22:11:30 +00:00
|
|
|
<>
|
2022-02-10 11:07:14 +00:00
|
|
|
<Theme />
|
2021-09-24 22:11:30 +00:00
|
|
|
<HeadSeo
|
2021-10-08 11:43:48 +00:00
|
|
|
title={`${rescheduleUid ? t("reschedule") : ""} ${eventType.title} | ${profile.name}`}
|
|
|
|
description={`${rescheduleUid ? t("reschedule") : ""} ${eventType.title}`}
|
2021-11-18 01:03:19 +00:00
|
|
|
name={profile.name || undefined}
|
2022-01-26 17:31:39 +00:00
|
|
|
username={profile.slug || undefined}
|
|
|
|
// avatar={profile.image || undefined}
|
2021-09-24 22:11:30 +00:00
|
|
|
/>
|
2022-03-05 15:37:46 +00:00
|
|
|
<CustomBranding lightVal={profile.brandColor} darkVal={profile.darkBrandColor} />
|
2021-09-24 22:11:30 +00:00
|
|
|
<div>
|
|
|
|
<main
|
2022-04-25 04:33:00 +00:00
|
|
|
className={classNames(
|
|
|
|
shouldAlignCentrally ? "mx-auto" : "",
|
2022-04-08 05:33:24 +00:00
|
|
|
isEmbed
|
2022-05-05 21:16:25 +00:00
|
|
|
? classNames(maxWidth)
|
|
|
|
: classNames("transition-max-width mx-auto my-0 duration-500 ease-in-out md:my-24", maxWidth)
|
2022-04-25 04:33:00 +00:00
|
|
|
)}>
|
2021-09-24 22:11:30 +00:00
|
|
|
{isReady && (
|
2022-04-08 05:33:24 +00:00
|
|
|
<div
|
|
|
|
style={availabilityDatePickerEmbedStyles}
|
|
|
|
className={classNames(
|
|
|
|
isBackgroundTransparent ? "" : "bg-white dark:bg-gray-800 sm:dark:border-gray-600",
|
2022-04-25 04:33:00 +00:00
|
|
|
"border-bookinglightest rounded-md md:border",
|
2022-05-05 21:16:25 +00:00
|
|
|
isEmbed ? "mx-auto" : maxWidth
|
2022-04-08 05:33:24 +00:00
|
|
|
)}>
|
2021-09-14 08:45:28 +00:00
|
|
|
{/* mobile: details */}
|
|
|
|
<div className="block p-4 sm:p-8 md:hidden">
|
2022-04-28 11:31:55 +00:00
|
|
|
<div>
|
2021-09-14 08:45:28 +00:00
|
|
|
<AvatarGroup
|
2022-03-24 13:15:24 +00:00
|
|
|
border="border-2 dark:border-gray-800 border-white"
|
2021-11-18 01:03:19 +00:00
|
|
|
items={
|
|
|
|
[
|
|
|
|
{ image: profile.image, alt: profile.name, title: profile.name },
|
|
|
|
...eventType.users
|
|
|
|
.filter((user) => user.name !== profile.name)
|
|
|
|
.map((user) => ({
|
|
|
|
title: user.name,
|
2022-03-26 00:39:38 +00:00
|
|
|
image: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}/avatar.png`,
|
2021-11-18 01:03:19 +00:00
|
|
|
alt: user.name || undefined,
|
|
|
|
})),
|
|
|
|
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
|
|
|
|
}
|
2021-09-14 08:45:28 +00:00
|
|
|
size={9}
|
|
|
|
truncateAfter={5}
|
|
|
|
/>
|
2022-04-28 11:31:55 +00:00
|
|
|
<div className="mt-4">
|
2022-04-04 10:20:49 +00:00
|
|
|
<p className="text-sm font-medium text-black dark:text-white">{profile.name}</p>
|
2022-04-28 11:31:55 +00:00
|
|
|
<div className="mt-2 gap-2 dark:text-gray-100">
|
2022-04-17 11:25:11 +00:00
|
|
|
<h1 className="text-bookingdark mb-4 text-xl font-semibold dark:text-white">
|
|
|
|
{eventType.title}
|
|
|
|
</h1>
|
2022-04-14 21:25:24 +00:00
|
|
|
{eventType?.description && (
|
2022-04-17 11:25:11 +00:00
|
|
|
<p className="text-bookinglight mb-2 dark:text-white">
|
2022-04-14 21:25:24 +00:00
|
|
|
<InformationCircleIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4" />
|
|
|
|
{eventType.description}
|
|
|
|
</p>
|
|
|
|
)}
|
2022-04-17 11:25:11 +00:00
|
|
|
<p className="text-bookinglight mb-2 dark:text-white">
|
2022-04-28 11:31:55 +00:00
|
|
|
<ClockIcon className="mr-[10px] -mt-1 ml-[2px] inline-block h-4 w-4" />
|
2021-10-08 11:43:48 +00:00
|
|
|
{eventType.length} {t("minutes")}
|
2022-04-17 11:25:11 +00:00
|
|
|
</p>
|
2021-09-22 18:36:13 +00:00
|
|
|
{eventType.price > 0 && (
|
2022-04-14 21:25:24 +00:00
|
|
|
<div className="text-gray-600 dark:text-white">
|
|
|
|
<CreditCardIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 dark:text-gray-400" />
|
2021-09-22 18:36:13 +00:00
|
|
|
<IntlProvider locale="en">
|
|
|
|
<FormattedNumber
|
|
|
|
value={eventType.price / 100.0}
|
|
|
|
style="currency"
|
|
|
|
currency={eventType.currency.toUpperCase()}
|
|
|
|
/>
|
|
|
|
</IntlProvider>
|
|
|
|
</div>
|
|
|
|
)}
|
2022-04-17 11:25:11 +00:00
|
|
|
<div className="md:hidden">
|
|
|
|
{booking?.startTime && rescheduleUid && (
|
|
|
|
<div>
|
|
|
|
<p
|
|
|
|
className="mt-8 mb-2 text-gray-600 dark:text-white"
|
2022-04-18 10:25:56 +00:00
|
|
|
data-testid="former_time_p_mobile">
|
2022-04-17 11:25:11 +00:00
|
|
|
{t("former_time")}
|
|
|
|
</p>
|
|
|
|
<p className="text-gray-500 line-through dark:text-white">
|
|
|
|
<CalendarIcon className="mr-[10px] -mt-1 inline-block h-4 w-4 text-gray-400" />
|
|
|
|
{typeof booking.startTime === "string" &&
|
|
|
|
parseDate(dayjs(booking.startTime), i18n)}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
2021-09-14 08:45:28 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="px-4 sm:flex sm:p-4 sm:py-5">
|
2021-09-14 08:45:28 +00:00
|
|
|
<div
|
|
|
|
className={
|
2022-03-24 13:15:24 +00:00
|
|
|
"hidden pr-8 sm:border-r sm:dark:border-gray-700 md:flex md:flex-col " +
|
2022-05-05 21:16:25 +00:00
|
|
|
(selectedDate ? "sm:w-1/3" : recurringEventCount ? "sm:w-2/3" : "sm:w-1/2")
|
2021-09-14 08:45:28 +00:00
|
|
|
}>
|
|
|
|
<AvatarGroup
|
2022-03-24 13:15:24 +00:00
|
|
|
border="border-2 dark:border-gray-800 border-white"
|
2021-11-18 01:03:19 +00:00
|
|
|
items={
|
|
|
|
[
|
|
|
|
{ image: profile.image, alt: profile.name, title: profile.name },
|
|
|
|
...eventType.users
|
|
|
|
.filter((user) => user.name !== profile.name)
|
|
|
|
.map((user) => ({
|
|
|
|
title: user.name,
|
|
|
|
alt: user.name,
|
2022-03-26 00:39:38 +00:00
|
|
|
image: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/${user.username}/avatar.png`,
|
2021-11-18 01:03:19 +00:00
|
|
|
})),
|
|
|
|
].filter((item) => !!item.image) as { image: string; alt?: string; title?: string }[]
|
|
|
|
}
|
2021-09-14 13:27:41 +00:00
|
|
|
size={10}
|
2021-09-14 08:45:28 +00:00
|
|
|
truncateAfter={3}
|
|
|
|
/>
|
2022-04-14 21:25:24 +00:00
|
|
|
<h2 className="mt-3 font-medium text-gray-500 dark:text-gray-300">{profile.name}</h2>
|
|
|
|
<h1 className="font-cal mb-4 text-xl font-semibold text-gray-900 dark:text-white">
|
2021-09-14 08:45:28 +00:00
|
|
|
{eventType.title}
|
|
|
|
</h1>
|
2022-04-14 21:25:24 +00:00
|
|
|
{eventType?.description && (
|
2022-05-05 21:16:25 +00:00
|
|
|
<p className="text-bookinglight mb-3 dark:text-white">
|
2022-04-14 21:25:24 +00:00
|
|
|
<InformationCircleIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
|
|
|
|
{eventType.description}
|
|
|
|
</p>
|
|
|
|
)}
|
2022-05-05 21:16:25 +00:00
|
|
|
<p className="text-bookinglight mb-3 dark:text-white">
|
2022-04-14 21:25:24 +00:00
|
|
|
<ClockIcon className="mr-[10px] -mt-1 ml-[2px] inline-block h-4 w-4 text-gray-400" />
|
2021-10-08 11:43:48 +00:00
|
|
|
{eventType.length} {t("minutes")}
|
2021-09-14 08:45:28 +00:00
|
|
|
</p>
|
2022-05-05 21:16:25 +00:00
|
|
|
{!rescheduleUid && eventType.recurringEvent?.count && eventType.recurringEvent?.freq && (
|
|
|
|
<div className="mb-3 text-gray-600 dark:text-white">
|
|
|
|
<RefreshIcon className="mr-[10px] -mt-1 ml-[2px] inline-block h-4 w-4 text-gray-400" />
|
|
|
|
<p className="mb-1 -ml-2 inline px-2 py-1">
|
|
|
|
{t("every_for_freq", {
|
|
|
|
freq: t(
|
|
|
|
`${RRuleFrequency[eventType.recurringEvent.freq].toString().toLowerCase()}`
|
|
|
|
),
|
|
|
|
})}
|
|
|
|
</p>
|
|
|
|
<input
|
|
|
|
type="number"
|
|
|
|
min="1"
|
|
|
|
max={eventType.recurringEvent.count}
|
|
|
|
className="w-16 rounded-sm border-gray-300 bg-white text-gray-600 shadow-sm [appearance:textfield] ltr:mr-2 rtl:ml-2 dark:border-gray-500 dark:bg-gray-600 dark:text-white sm:text-sm"
|
|
|
|
defaultValue={eventType.recurringEvent.count}
|
|
|
|
onChange={(event) => {
|
|
|
|
setRecurringEventCount(parseInt(event?.target.value));
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<p className="inline text-gray-600 dark:text-white">
|
|
|
|
{t(`${RRuleFrequency[eventType.recurringEvent.freq].toString().toLowerCase()}`, {
|
|
|
|
count: recurringEventCount,
|
|
|
|
})}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
)}
|
2021-09-22 18:36:13 +00:00
|
|
|
{eventType.price > 0 && (
|
2022-04-14 21:25:24 +00:00
|
|
|
<p className="mb-1 -ml-2 px-2 py-1 text-gray-600 dark:text-white">
|
|
|
|
<CreditCardIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
|
2021-09-22 18:36:13 +00:00
|
|
|
<IntlProvider locale="en">
|
|
|
|
<FormattedNumber
|
|
|
|
value={eventType.price / 100.0}
|
|
|
|
style="currency"
|
|
|
|
currency={eventType.currency.toUpperCase()}
|
|
|
|
/>
|
|
|
|
</IntlProvider>
|
|
|
|
</p>
|
|
|
|
)}
|
2021-09-14 08:45:28 +00:00
|
|
|
|
|
|
|
<TimezoneDropdown />
|
2022-04-25 08:32:01 +00:00
|
|
|
{previousPage === `${WEBAPP_URL}/${profile.slug}` && (
|
2022-03-07 15:48:51 +00:00
|
|
|
<div className="flex h-full flex-col justify-end">
|
|
|
|
<ArrowLeftIcon
|
|
|
|
className="h-4 w-4 text-black transition-opacity hover:cursor-pointer dark:text-white"
|
|
|
|
onClick={() => router.back()}
|
|
|
|
/>
|
|
|
|
<p className="sr-only">Go Back</p>
|
|
|
|
</div>
|
|
|
|
)}
|
2022-04-14 21:25:24 +00:00
|
|
|
{booking?.startTime && rescheduleUid && (
|
|
|
|
<div>
|
2022-04-18 10:25:56 +00:00
|
|
|
<p
|
2022-05-05 21:16:25 +00:00
|
|
|
className="mt-4 mb-3 text-gray-600 dark:text-white"
|
2022-04-18 10:25:56 +00:00
|
|
|
data-testid="former_time_p_desktop">
|
2022-04-14 21:25:24 +00:00
|
|
|
{t("former_time")}
|
|
|
|
</p>
|
|
|
|
<p className="text-gray-500 line-through dark:text-white">
|
|
|
|
<CalendarIcon className="mr-[10px] -mt-1 inline-block h-4 w-4 text-gray-400" />
|
|
|
|
{typeof booking.startTime === "string" && parseDate(dayjs(booking.startTime), i18n)}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
)}
|
2021-09-14 08:45:28 +00:00
|
|
|
</div>
|
2022-04-17 11:25:11 +00:00
|
|
|
|
2021-09-14 08:45:28 +00:00
|
|
|
<DatePicker
|
|
|
|
date={selectedDate}
|
|
|
|
periodType={eventType?.periodType}
|
|
|
|
periodStartDate={eventType?.periodStartDate}
|
|
|
|
periodEndDate={eventType?.periodEndDate}
|
|
|
|
periodDays={eventType?.periodDays}
|
|
|
|
periodCountCalendarDays={eventType?.periodCountCalendarDays}
|
|
|
|
onDatePicked={changeDate}
|
2021-09-23 14:08:44 +00:00
|
|
|
workingHours={workingHours}
|
2021-10-02 20:16:51 +00:00
|
|
|
weekStart={profile.weekStart || "Sunday"}
|
2021-09-14 08:45:28 +00:00
|
|
|
eventLength={eventType.length}
|
|
|
|
minimumBookingNotice={eventType.minimumBookingNotice}
|
|
|
|
/>
|
|
|
|
|
2022-02-09 00:05:13 +00:00
|
|
|
<div className="mt-4 ml-1 block sm:hidden">
|
2021-09-14 08:45:28 +00:00
|
|
|
<TimezoneDropdown />
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{selectedDate && (
|
|
|
|
<AvailableTimes
|
|
|
|
timeFormat={timeFormat}
|
|
|
|
minimumBookingNotice={eventType.minimumBookingNotice}
|
|
|
|
eventTypeId={eventType.id}
|
2022-04-06 17:20:30 +00:00
|
|
|
eventTypeSlug={eventType.slug}
|
2021-12-19 12:11:31 +00:00
|
|
|
slotInterval={eventType.slotInterval}
|
2021-09-14 08:45:28 +00:00
|
|
|
eventLength={eventType.length}
|
2022-05-05 21:16:25 +00:00
|
|
|
recurringCount={recurringEventCount}
|
2021-09-14 08:45:28 +00:00
|
|
|
date={selectedDate}
|
|
|
|
users={eventType.users}
|
|
|
|
schedulingType={eventType.schedulingType ?? null}
|
2022-03-04 10:19:03 +00:00
|
|
|
beforeBufferTime={eventType.beforeEventBuffer}
|
|
|
|
afterBufferTime={eventType.afterEventBuffer}
|
2021-09-14 08:45:28 +00:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-09-24 22:11:30 +00:00
|
|
|
)}
|
2022-04-08 05:33:24 +00:00
|
|
|
{(!eventType.users[0] || !isBrandingHidden(eventType.users[0])) && !isEmbed && <PoweredByCal />}
|
2021-09-24 22:11:30 +00:00
|
|
|
</main>
|
|
|
|
</div>
|
|
|
|
</>
|
2021-09-14 08:45:28 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
function TimezoneDropdown() {
|
|
|
|
return (
|
|
|
|
<Collapsible.Root open={isTimeOptionsOpen} onOpenChange={setIsTimeOptionsOpen}>
|
2022-04-14 21:25:24 +00:00
|
|
|
<Collapsible.Trigger className="min-w-32 mb-1 -ml-2 px-2 py-1 text-left text-gray-600 dark:text-white">
|
|
|
|
<GlobeIcon className="mr-[10px] ml-[2px] -mt-1 inline-block h-4 w-4 text-gray-400" />
|
2021-09-14 08:45:28 +00:00
|
|
|
{timeZone()}
|
|
|
|
{isTimeOptionsOpen ? (
|
2022-02-09 00:05:13 +00:00
|
|
|
<ChevronUpIcon className="ml-1 -mt-1 inline-block h-4 w-4" />
|
2021-09-14 08:45:28 +00:00
|
|
|
) : (
|
2022-02-09 00:05:13 +00:00
|
|
|
<ChevronDownIcon className="ml-1 -mt-1 inline-block h-4 w-4" />
|
2021-09-14 08:45:28 +00:00
|
|
|
)}
|
|
|
|
</Collapsible.Trigger>
|
|
|
|
<Collapsible.Content>
|
2021-10-12 13:11:33 +00:00
|
|
|
<TimeOptions onSelectTimeZone={handleSelectTimeZone} onToggle24hClock={handleToggle24hClock} />
|
2021-09-14 08:45:28 +00:00
|
|
|
</Collapsible.Content>
|
|
|
|
</Collapsible.Root>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
export default AvailabilityPage;
|