Scheduling infrastructure for absolutely everyone.
Fixed opt-in layout plus some tweaks (#1067)
Alex van Andel91fca7477d14
diff --git a/pages/success.tsx b/pages/success.tsxindex adcbf478c34..9ec84739cf2 100644--- a/pages/success.tsx+++ b/pages/success.tsx@@ -10,7 +10,7 @@ import Link from "next/link";import { useRouter } from "next/router";import { useEffect, useState } from "react";-import { asStringOrNull } from "@lib/asStringOrNull";+import { asStringOrThrow, asStringOrNull } from "@lib/asStringOrNull";import { getEventName } from "@lib/event";import { useLocale } from "@lib/hooks/useLocale";import useTheme from "@lib/hooks/useTheme";@@ -31,7 +31,7 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)const { location, name, reschedule } = router.query;const [is24h, setIs24h] = useState(false);- const [date, setDate] = useState(dayjs.utc(asStringOrNull(router.query.date)));+ const [date, setDate] = useState(dayjs.utc(asStringOrThrow(router.query.date)));const { isReady } = useTheme(props.profile.theme);useEffect(() => {@@ -48,11 +48,13 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)}const event = createEvent({- start: date- .utc()- .toArray()- .slice(0, 6)- .map((v, i) => (i === 1 ? v + 1 : v)) as any, // <-- FIXME fix types, not sure what's going on here+ start: [+ date.toDate().getUTCFullYear(),+ date.toDate().getUTCMonth(),+ date.toDate().getUTCDate(),+ date.toDate().getUTCHours(),+ date.toDate().getUTCMinutes(),+ ],startInputType: "utc",title: eventName,description: props.eventType.description ? props.eventType.description : undefined,@@ -77,20 +79,20 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)title={needsConfirmation ? t("booking_submitted") : t("booking_confirmed")}description={needsConfirmation ? t("booking_submitted") : t("booking_confirmed")}/>- <main className="py-24 mx-auto max-w-3xl">- <div className="overflow-y-auto fixed inset-0 z-50">- <div className="flex justify-center items-end px-4 pt-4 pb-20 min-h-screen text-center sm:block sm:p-0">+ <main className="max-w-3xl py-24 mx-auto">+ <div className="fixed inset-0 z-50 overflow-y-auto">+ <div className="flex items-end justify-center min-h-screen px-4 pt-4 pb-20 text-center sm:block sm:p-0"><div className="fixed inset-0 my-4 transition-opacity sm:my-0" aria-hidden="true"><span className="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span><div- className="inline-block overflow-hidden px-8 pt-5 pb-4 text-left align-bottom bg-white rounded-sm border transition-all transform dark:bg-gray-800 border-neutral-200 dark:border-neutral-700 sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:py-6"+ className="inline-block px-8 pt-5 pb-4 overflow-hidden text-left align-bottom transition-all transform bg-white border rounded-sm dark:bg-gray-800 border-neutral-200 dark:border-neutral-700 sm:my-8 sm:align-middle sm:max-w-lg sm:w-full sm:py-6"role="dialog"aria-modal="true"aria-labelledby="modal-headline"><div>- <div className="flex justify-center items-center mx-auto w-12 h-12 bg-green-100 rounded-full">+ <div className="flex items-center justify-center w-12 h-12 mx-auto bg-green-100 rounded-full">{!needsConfirmation && <CheckIcon className="w-8 h-8 text-green-600" />}{needsConfirmation && <ClockIcon className="w-8 h-8 text-green-600" />}</div>@@ -113,7 +115,7 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)<div className="font-medium">{t("what")}</div><div className="col-span-2 mb-6">{eventName}</div><div className="font-medium">{t("when")}</div>- <div className="col-span-2 mb-6">+ <div className="col-span-2">{date.format("dddd, DD MMMM YYYY")}<br />{date.format(is24h ? "H:mm" : "h:mma")} - {props.eventType.length} mins{" "}@@ -131,11 +133,11 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)</div></div>{!needsConfirmation && (- <div className="flex pt-2 mt-5 text-center sm:mt-0 sm:pt-4">+ <div className="flex pt-2 pb-4 mt-5 text-center border-b sm:mt-0 sm:pt-4"><span className="flex self-center mr-2 font-medium text-gray-700 dark:text-gray-50">{t("add_to_calendar")}</span>- <div className="flex">+ <div className="flex justify-center flex-grow text-center"><Linkhref={`https://calendar.google.com/calendar/r/eventedit?dates=${date@@ -147,9 +149,9 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)props.eventType.description}` + (typeof location === "string" ? encodeURIComponent(location) : "")}>- <a className="px-3 w-10 h-10 py-2 mx-2 rounded-sm border border-neutral-200 dark:border-neutral-700 dark:text-white">+ <a className="w-10 h-10 px-3 py-2 mx-2 border rounded-sm border-neutral-200 dark:border-neutral-700 dark:text-white"><svg- className="inline-block -mt-1 w-4 h-4"+ className="inline-block w-4 h-4 -mt-1"fill="currentColor"xmlns="http://www.w3.org/2000/svg"viewBox="0 0 24 24">@@ -172,10 +174,10 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)) + (location ? "&location=" + location : "")}><a- className="px-3 w-10 h-10 py-2 mx-2 rounded-sm border border-neutral-200 dark:border-neutral-700 dark:text-white"+ className="w-10 h-10 px-3 py-2 mx-2 border rounded-sm border-neutral-200 dark:border-neutral-700 dark:text-white"target="_blank"><svg- className="inline-block -mt-1 mr-1 w-4 h-4"+ className="inline-block w-4 h-4 mr-1 -mt-1"fill="currentColor"xmlns="http://www.w3.org/2000/svg"viewBox="0 0 24 24">@@ -198,10 +200,10 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)) + (location ? "&location=" + location : "")}><a- className="px-3 w-10 h-10 py-2 mx-2 rounded-sm border border-neutral-200 dark:border-neutral-700 dark:text-white"+ className="w-10 h-10 px-3 py-2 mx-2 border rounded-sm border-neutral-200 dark:border-neutral-700 dark:text-white"target="_blank"><svg- className="inline-block -mt-1 mr-1 w-4 h-4"+ className="inline-block w-4 h-4 mr-1 -mt-1"fill="currentColor"xmlns="http://www.w3.org/2000/svg"viewBox="0 0 24 24">@@ -212,14 +214,14 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)</Link><Link href={"data:text/calendar," + eventLink()}><a- className="px-3 w-10 h-10 py-2 mx-2 rounded-sm border border-neutral-200 dark:border-neutral-700 dark:text-white"+ className="w-10 h-10 px-3 py-2 mx-2 border rounded-sm border-neutral-200 dark:border-neutral-700 dark:text-white"download={props.eventType.title + ".ics"}><svgversion="1.1"fill="currentColor"xmlns="http://www.w3.org/2000/svg"viewBox="0 0 1000 1000"- className="inline-block -mt-1 mr-1 w-4 h-4">+ className="inline-block w-4 h-4 mr-1 -mt-1"><title>{t("other")}</title><path d="M971.3,154.9c0-34.7-28.2-62.9-62.9-62.9H611.7c-1.3,0-2.6,0.1-3.9,0.2V10L28.7,87.3v823.4L607.8,990v-84.6c1.3,0.1,2.6,0.2,3.9,0.2h296.7c34.7,0,62.9-28.2,62.9-62.9V154.9z M607.8,636.1h44.6v-50.6h-44.6v-21.9h44.6v-50.6h-44.6v-92h277.9v230.2c0,3.8-3.1,7-7,7H607.8V636.1z M117.9,644.7l-50.6-2.4V397.5l50.6-2.2V644.7z M288.6,607.3c17.6,0.6,37.3-2.8,49.1-7.2l9.1,48c-11,5.1-35.6,9.9-66.9,8.3c-85.4-4.3-127.5-60.7-127.5-132.6c0-86.2,57.8-136.7,133.2-140.1c30.3-1.3,53.7,4,64.3,9.2l-12.2,48.9c-12.1-4.9-28.8-9.2-49.5-8.6c-45.3,1.2-79.5,30.1-79.5,87.4C208.8,572.2,237.8,605.7,288.6,607.3z M455.5,665.2c-32.4-1.6-63.7-11.3-79.1-20.5l12.6-50.7c16.8,9.1,42.9,18.5,70.4,19.4c30.1,1,46.3-10.7,46.3-29.3c0-17.8-14-28.1-48.8-40.6c-46.9-16.4-76.8-41.7-76.8-81.5c0-46.6,39.3-84.1,106.8-87.1c33.3-1.5,58.3,4.2,76.5,11.2l-15.4,53.3c-12.1-5.3-33.5-12.8-62.3-12c-28.3,0.8-41.9,13.6-41.9,28.1c0,17.8,16.1,25.5,53.6,39c52.9,18.5,78.4,45.3,78.4,86.4C575.6,629.7,536.2,669.2,455.5,665.2z M935.3,842.7c0,14.9-12.1,27-27,27H611.7c-1.3,0-2.6-0.2-3.9-0.4V686.2h270.9c19.2,0,34.9-15.6,34.9-34.9V398.4c0-19.2-15.6-34.9-34.9-34.9h-47.1v-32.3H808v32.3h-44.8v-32.3h-22.7v32.3h-43.3v-32.3h-22.7v32.3H628v-32.3h-20.2v-203c1.31.2,2.6-0.4,3.9-0.4h296.7c14.9,0,27,12.1,27,27L935.3,842.7L935.3,842.7z" /></svg>@@ -229,7 +231,7 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)</div>)}{!props.hideBranding && (- <div className="pt-4 mt-4 text-xs text-center text-gray-400 border-t dark:border-gray-900 dark:text-white">+ <div className="pt-4 text-xs text-center text-gray-400 dark:border-gray-900 dark:text-white"><a href="https://cal.com/signup">{t("create_booking_link_with_calcom")}</a><form@@ -244,7 +246,7 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)id="email"inputMode="email"defaultValue={router.query.email}- className="shadow-sm text-gray-600 dark:bg-black dark:text-white dark:border-gray-900 focus:ring-black focus:border-black block w-full sm:text-sm border-gray-300"+ className="block w-full text-gray-600 border-gray-300 shadow-sm dark:bg-black dark:text-white dark:border-gray-900 focus:ring-black focus:border-black sm:text-sm"placeholder="[email protected]"/><Button type="submit" className="min-w-max" color="primary">