feature/space-booking-app (#2673)
* Reschedule for dynamic events * Fix lint * feature/space-booking-app initial commit * added loom video and fixes for main branch * Revert previous commmit * Renames spacebookingother to spacebooking * Type and perf improvements * Updated comment * Update seed-app-store.ts Co-authored-by: zomars <zomars@me.com>
This commit is contained in:
parent
fa1ca5fba0
commit
2cb663cd6a
19 changed files with 658 additions and 220 deletions
|
@ -10,21 +10,21 @@ import { GetServerSidePropsContext } from "next";
|
||||||
import { useSession } from "next-auth/react";
|
import { useSession } from "next-auth/react";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { useEffect, useState, useRef } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
|
import { SpaceBookingSuccessPage } from "@calcom/app-store/spacebooking/components";
|
||||||
import {
|
import {
|
||||||
useIsEmbed,
|
sdkActionManager,
|
||||||
useEmbedStyles,
|
|
||||||
useIsBackgroundTransparent,
|
|
||||||
useEmbedNonStylesConfig,
|
useEmbedNonStylesConfig,
|
||||||
|
useIsBackgroundTransparent,
|
||||||
|
useIsEmbed,
|
||||||
} from "@calcom/embed-core";
|
} from "@calcom/embed-core";
|
||||||
import { sdkActionManager } from "@calcom/embed-core";
|
|
||||||
import { getDefaultEvent } from "@calcom/lib/defaultEvents";
|
import { getDefaultEvent } from "@calcom/lib/defaultEvents";
|
||||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||||
import Button from "@calcom/ui/Button";
|
import Button from "@calcom/ui/Button";
|
||||||
import { EmailInput } from "@calcom/ui/form/fields";
|
import { EmailInput } from "@calcom/ui/form/fields";
|
||||||
|
|
||||||
import { asStringOrThrow, asStringOrNull } from "@lib/asStringOrNull";
|
import { asStringOrNull, asStringOrThrow } from "@lib/asStringOrNull";
|
||||||
import { getEventName } from "@lib/event";
|
import { getEventName } from "@lib/event";
|
||||||
import useTheme from "@lib/hooks/useTheme";
|
import useTheme from "@lib/hooks/useTheme";
|
||||||
import { isBrandingHidden } from "@lib/isBrandingHidden";
|
import { isBrandingHidden } from "@lib/isBrandingHidden";
|
||||||
|
@ -215,228 +215,258 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)
|
||||||
const userIsOwner = !!(session?.user?.id && eventType.users.find((user) => (user.id = session.user.id)));
|
const userIsOwner = !!(session?.user?.id && eventType.users.find((user) => (user.id = session.user.id)));
|
||||||
return (
|
return (
|
||||||
(isReady && (
|
(isReady && (
|
||||||
<div
|
<>
|
||||||
className={isEmbed ? "" : "h-screen bg-neutral-100 dark:bg-neutral-900"}
|
<div
|
||||||
data-testid="success-page">
|
className={isEmbed ? "" : "h-screen bg-neutral-100 dark:bg-neutral-900"}
|
||||||
<Theme />
|
data-testid="success-page">
|
||||||
<HeadSeo
|
<Theme />
|
||||||
title={needsConfirmation ? t("booking_submitted") : t("booking_confirmed")}
|
<HeadSeo
|
||||||
description={needsConfirmation ? t("booking_submitted") : t("booking_confirmed")}
|
title={needsConfirmation ? t("booking_submitted") : t("booking_confirmed")}
|
||||||
/>
|
description={needsConfirmation ? t("booking_submitted") : t("booking_confirmed")}
|
||||||
<CustomBranding lightVal={props.profile.brandColor} darkVal={props.profile.darkBrandColor} />
|
/>
|
||||||
<main className={classNames(shouldAlignCentrally ? "mx-auto" : "", isEmbed ? "" : "max-w-3xl")}>
|
<CustomBranding lightVal={props.profile.brandColor} darkVal={props.profile.darkBrandColor} />
|
||||||
<div className={classNames("overflow-y-auto", isEmbed ? "" : "z-50 ")}>
|
<main className={classNames(shouldAlignCentrally ? "mx-auto" : "", isEmbed ? "" : "max-w-3xl")}>
|
||||||
{isSuccessRedirectAvailable(eventType) && eventType.successRedirectUrl ? (
|
<div className={classNames("overflow-y-auto", isEmbed ? "" : "z-50 ")}>
|
||||||
<RedirectionToast url={eventType.successRedirectUrl}></RedirectionToast>
|
{isSuccessRedirectAvailable(eventType) && eventType.successRedirectUrl ? (
|
||||||
) : null}{" "}
|
<RedirectionToast url={eventType.successRedirectUrl}></RedirectionToast>
|
||||||
<div
|
) : null}{" "}
|
||||||
className={classNames(
|
|
||||||
shouldAlignCentrally ? "text-center" : "",
|
|
||||||
"flex items-end justify-center px-4 pt-4 pb-20 sm:block sm:p-0"
|
|
||||||
)}>
|
|
||||||
<div
|
<div
|
||||||
className={classNames("my-4 transition-opacity sm:my-0", isEmbed ? "" : " inset-0")}
|
className={classNames(
|
||||||
aria-hidden="true">
|
shouldAlignCentrally ? "text-center" : "",
|
||||||
|
"flex items-end justify-center px-4 pt-4 pb-20 sm:block sm:p-0"
|
||||||
|
)}>
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames("my-4 transition-opacity sm:my-0", isEmbed ? "" : " inset-0")}
|
||||||
"inline-block transform overflow-hidden rounded-md border sm:my-8 sm:max-w-lg",
|
aria-hidden="true">
|
||||||
isBackgroundTransparent ? "" : "bg-white dark:border-neutral-700 dark:bg-gray-800",
|
<div
|
||||||
"px-8 pt-5 pb-4 text-left align-bottom transition-all sm:w-full sm:py-6 sm:align-middle"
|
className={classNames(
|
||||||
)}
|
"inline-block transform overflow-hidden rounded-md border sm:my-8 sm:max-w-lg",
|
||||||
role="dialog"
|
isBackgroundTransparent ? "" : "bg-white dark:border-neutral-700 dark:bg-gray-800",
|
||||||
aria-modal="true"
|
"px-8 pt-5 pb-4 text-left align-bottom transition-all sm:w-full sm:py-6 sm:align-middle"
|
||||||
aria-labelledby="modal-headline">
|
)}
|
||||||
<div>
|
role="dialog"
|
||||||
<div
|
aria-modal="true"
|
||||||
className={classNames(
|
aria-labelledby="modal-headline">
|
||||||
"mx-auto flex items-center justify-center",
|
<div>
|
||||||
!giphyImage ? "h-12 w-12 rounded-full bg-green-100" : ""
|
<div
|
||||||
)}>
|
className={classNames(
|
||||||
{giphyImage && !needsConfirmation && <img src={giphyImage} alt={"Gif from Giphy"} />}
|
"mx-auto flex items-center justify-center",
|
||||||
{!giphyImage && !needsConfirmation && <CheckIcon className="h-8 w-8 text-green-600" />}
|
!giphyImage ? "h-12 w-12 rounded-full bg-green-100" : ""
|
||||||
{needsConfirmation && <ClockIcon className="h-8 w-8 text-green-600" />}
|
)}>
|
||||||
</div>
|
{giphyImage && !needsConfirmation && <img src={giphyImage} alt={"Gif from Giphy"} />}
|
||||||
<div className="mt-3 text-center sm:mt-5">
|
{!giphyImage && !needsConfirmation && (
|
||||||
<h3
|
<CheckIcon className="h-8 w-8 text-green-600" />
|
||||||
className="text-2xl font-semibold leading-6 text-neutral-900 dark:text-white"
|
|
||||||
id="modal-headline">
|
|
||||||
{needsConfirmation ? t("submitted") : t("meeting_is_scheduled")}
|
|
||||||
</h3>
|
|
||||||
<div className="mt-3">
|
|
||||||
<p className="text-sm text-neutral-600 dark:text-gray-300">
|
|
||||||
{needsConfirmation
|
|
||||||
? props.profile.name !== null
|
|
||||||
? t("user_needs_to_confirm_or_reject_booking", { user: props.profile.name })
|
|
||||||
: t("needs_to_be_confirmed_or_rejected")
|
|
||||||
: t("emailed_you_and_attendees")}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div className="border-bookinglightest text-bookingdark mt-4 grid grid-cols-3 border-t border-b py-4 text-left dark:border-gray-900 dark:text-gray-300">
|
|
||||||
<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">
|
|
||||||
{date.format("dddd, DD MMMM YYYY")}
|
|
||||||
<br />
|
|
||||||
{date.format(is24h ? "H:mm" : "h:mma")} - {props.eventType.length} mins{" "}
|
|
||||||
<span className="text-bookinglight">
|
|
||||||
({localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess()})
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
{location && (
|
|
||||||
<>
|
|
||||||
<div className="mt-6 font-medium">{t("where")}</div>
|
|
||||||
<div className="col-span-2 mt-6">
|
|
||||||
{location.startsWith("http") ? (
|
|
||||||
<a title="Meeting Link" href={location}>
|
|
||||||
{location}
|
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
location
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
{needsConfirmation && <ClockIcon className="h-8 w-8 text-green-600" />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="mt-3 text-center sm:mt-5">
|
||||||
</div>
|
<h3
|
||||||
{!needsConfirmation && (
|
className="text-2xl font-semibold leading-6 text-neutral-900 dark:text-white"
|
||||||
<div className="border-bookinglightest mt-5 flex border-b pt-2 pb-4 text-center dark:border-gray-900 sm:mt-0 sm:pt-4">
|
id="modal-headline">
|
||||||
<span className="flex self-center font-medium text-gray-700 ltr:mr-2 rtl:ml-2 dark:text-gray-50">
|
{needsConfirmation ? t("submitted") : t("meeting_is_scheduled")}
|
||||||
{t("add_to_calendar")}
|
</h3>
|
||||||
</span>
|
<div className="mt-3">
|
||||||
<div className="flex flex-grow justify-center text-center">
|
<p className="text-sm text-neutral-600 dark:text-gray-300">
|
||||||
<Link
|
{needsConfirmation
|
||||||
href={
|
? props.profile.name !== null
|
||||||
`https://calendar.google.com/calendar/r/eventedit?dates=${date
|
? t("user_needs_to_confirm_or_reject_booking", { user: props.profile.name })
|
||||||
.utc()
|
: t("needs_to_be_confirmed_or_rejected")
|
||||||
.format("YYYYMMDDTHHmmss[Z]")}/${date
|
: t("emailed_you_and_attendees")}
|
||||||
.add(props.eventType.length, "minute")
|
</p>
|
||||||
.utc()
|
</div>
|
||||||
.format("YYYYMMDDTHHmmss[Z]")}&text=${eventName}&details=${
|
|
||||||
props.eventType.description
|
|
||||||
}` +
|
|
||||||
(typeof location === "string" ? "&location=" + encodeURIComponent(location) : "")
|
|
||||||
}>
|
|
||||||
<a className="mx-2 h-10 w-10 rounded-sm border border-neutral-200 px-3 py-2 dark:border-neutral-700 dark:text-white">
|
|
||||||
<svg
|
|
||||||
className="-mt-1 inline-block h-4 w-4"
|
|
||||||
fill="currentColor"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24">
|
|
||||||
<title>Google</title>
|
|
||||||
<path d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z" />
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
encodeURI(
|
|
||||||
"https://outlook.live.com/calendar/0/deeplink/compose?body=" +
|
|
||||||
props.eventType.description +
|
|
||||||
"&enddt=" +
|
|
||||||
date.add(props.eventType.length, "minute").utc().format() +
|
|
||||||
"&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=" +
|
|
||||||
date.utc().format() +
|
|
||||||
"&subject=" +
|
|
||||||
eventName
|
|
||||||
) + (location ? "&location=" + location : "")
|
|
||||||
}>
|
|
||||||
<a
|
|
||||||
className="mx-2 h-10 w-10 rounded-sm border border-neutral-200 px-3 py-2 dark:border-neutral-700 dark:text-white"
|
|
||||||
target="_blank">
|
|
||||||
<svg
|
|
||||||
className="mr-1 -mt-1 inline-block h-4 w-4"
|
|
||||||
fill="currentColor"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24">
|
|
||||||
<title>Microsoft Outlook</title>
|
|
||||||
<path d="M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V10.85l1.24.72h.01q.1.07.18.18.07.12.07.25zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.8v-2.73zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z" />
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
<Link
|
|
||||||
href={
|
|
||||||
encodeURI(
|
|
||||||
"https://outlook.office.com/calendar/0/deeplink/compose?body=" +
|
|
||||||
props.eventType.description +
|
|
||||||
"&enddt=" +
|
|
||||||
date.add(props.eventType.length, "minute").utc().format() +
|
|
||||||
"&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=" +
|
|
||||||
date.utc().format() +
|
|
||||||
"&subject=" +
|
|
||||||
eventName
|
|
||||||
) + (location ? "&location=" + location : "")
|
|
||||||
}>
|
|
||||||
<a
|
|
||||||
className="mx-2 h-10 w-10 rounded-sm border border-neutral-200 px-3 py-2 dark:border-neutral-700 dark:text-white"
|
|
||||||
target="_blank">
|
|
||||||
<svg
|
|
||||||
className="mr-1 -mt-1 inline-block h-4 w-4"
|
|
||||||
fill="currentColor"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 24 24">
|
|
||||||
<title>Microsoft Office</title>
|
|
||||||
<path d="M21.53 4.306v15.363q0 .807-.472 1.433-.472.627-1.253.85l-6.888 1.974q-.136.037-.29.055-.156.019-.293.019-.396 0-.72-.105-.321-.106-.656-.292l-4.505-2.544q-.248-.137-.391-.366-.143-.23-.143-.515 0-.434.304-.738.304-.305.739-.305h5.831V4.964l-4.38 1.563q-.533.187-.856.658-.322.472-.322 1.03v8.078q0 .496-.248.912-.25.416-.683.651l-2.072 1.13q-.286.148-.571.148-.497 0-.844-.347-.348-.347-.348-.844V6.563q0-.62.33-1.19.328-.571.874-.881L11.07.285q.248-.136.534-.21.285-.075.57-.075.211 0 .38.031.166.031.364.093l6.888 1.899q.384.11.7.329.317.217.547.52.23.305.353.67.125.367.125.764zm-1.588 15.363V4.306q0-.273-.16-.478-.163-.204-.423-.28l-3.388-.93q-.397-.111-.794-.23-.397-.117-.794-.216v19.68l4.976-1.427q.26-.074.422-.28.161-.204.161-.477z" />
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
<Link href={"data:text/calendar," + eventLink()}>
|
|
||||||
<a
|
|
||||||
className="mx-2 h-10 w-10 rounded-sm border border-neutral-200 px-3 py-2 dark:border-neutral-700 dark:text-white"
|
|
||||||
download={props.eventType.title + ".ics"}>
|
|
||||||
<svg
|
|
||||||
version="1.1"
|
|
||||||
fill="currentColor"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 1000 1000"
|
|
||||||
className="mr-1 -mt-1 inline-block h-4 w-4">
|
|
||||||
<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>
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
{!(userIsOwner || props.hideBranding) && (
|
|
||||||
<div className="border-bookinglightest text-booking-lighter pt-4 text-center text-xs dark:border-gray-900 dark:text-white">
|
|
||||||
<a href="https://cal.com/signup">{t("create_booking_link_with_calcom")}</a>
|
|
||||||
|
|
||||||
<form
|
<div className="border-bookinglightest text-bookingdark mt-4 grid grid-cols-3 border-t border-b py-4 text-left dark:border-gray-900 dark:text-gray-300">
|
||||||
onSubmit={(e) => {
|
<div className="font-medium">{t("what")}</div>
|
||||||
e.preventDefault();
|
<div className="col-span-2 mb-6">{eventName}</div>
|
||||||
router.push(`https://cal.com/signup?email=` + (e as any).target.email.value);
|
<div className="font-medium">{t("when")}</div>
|
||||||
}}
|
<div className="col-span-2">
|
||||||
className="mt-4 flex">
|
{date.format("dddd, DD MMMM YYYY")}
|
||||||
<EmailInput
|
<br />
|
||||||
name="email"
|
{date.format(is24h ? "H:mm" : "h:mma")} - {props.eventType.length} mins{" "}
|
||||||
id="email"
|
<span className="text-bookinglight">
|
||||||
defaultValue={router.query.email}
|
({localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess()})
|
||||||
className="focus:border-brand border-bookinglightest mt-0 block w-full rounded-sm border-gray-300 shadow-sm focus:ring-black dark:border-gray-900 dark:bg-black dark:text-white sm:text-sm"
|
</span>
|
||||||
placeholder="rick.astley@cal.com"
|
</div>
|
||||||
/>
|
{location && (
|
||||||
<Button size="lg" type="submit" className="min-w-max" color="primary">
|
<>
|
||||||
{t("try_for_free")}
|
<div className="mt-6 font-medium">{t("where")}</div>
|
||||||
</Button>
|
<div className="col-span-2 mt-6">
|
||||||
</form>
|
{location.startsWith("http") ? (
|
||||||
|
<a title="Meeting Link" href={location}>
|
||||||
|
{location}
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
location
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
{!needsConfirmation && (
|
||||||
{userIsOwner && !isEmbed && (
|
<div className="border-bookinglightest mt-5 flex border-b pt-2 pb-4 text-center dark:border-gray-900 sm:mt-0 sm:pt-4">
|
||||||
<div className="mt-4">
|
<span className="flex self-center font-medium text-gray-700 ltr:mr-2 rtl:ml-2 dark:text-gray-50">
|
||||||
<Link href="/bookings">
|
{t("add_to_calendar")}
|
||||||
<a className="flex items-center text-black dark:text-white">
|
</span>
|
||||||
<ArrowLeftIcon className="mr-1 h-4 w-4" /> {t("back_to_bookings")}
|
<div className="flex flex-grow justify-center text-center">
|
||||||
</a>
|
<Link
|
||||||
</Link>
|
href={
|
||||||
</div>
|
`https://calendar.google.com/calendar/r/eventedit?dates=${date
|
||||||
)}
|
.utc()
|
||||||
|
.format("YYYYMMDDTHHmmss[Z]")}/${date
|
||||||
|
.add(props.eventType.length, "minute")
|
||||||
|
.utc()
|
||||||
|
.format("YYYYMMDDTHHmmss[Z]")}&text=${eventName}&details=${
|
||||||
|
props.eventType.description
|
||||||
|
}` +
|
||||||
|
(typeof location === "string"
|
||||||
|
? "&location=" + encodeURIComponent(location)
|
||||||
|
: "")
|
||||||
|
}>
|
||||||
|
<a className="mx-2 h-10 w-10 rounded-sm border border-neutral-200 px-3 py-2 dark:border-neutral-700 dark:text-white">
|
||||||
|
<svg
|
||||||
|
className="-mt-1 inline-block h-4 w-4"
|
||||||
|
fill="currentColor"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24">
|
||||||
|
<title>Google</title>
|
||||||
|
<path d="M12.48 10.92v3.28h7.84c-.24 1.84-.853 3.187-1.787 4.133-1.147 1.147-2.933 2.4-6.053 2.4-4.827 0-8.6-3.893-8.6-8.72s3.773-8.72 8.6-8.72c2.6 0 4.507 1.027 5.907 2.347l2.307-2.307C18.747 1.44 16.133 0 12.48 0 5.867 0 .307 5.387.307 12s5.56 12 12.173 12c3.573 0 6.267-1.173 8.373-3.36 2.16-2.16 2.84-5.213 2.84-7.667 0-.76-.053-1.467-.173-2.053H12.48z" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
href={
|
||||||
|
encodeURI(
|
||||||
|
"https://outlook.live.com/calendar/0/deeplink/compose?body=" +
|
||||||
|
props.eventType.description +
|
||||||
|
"&enddt=" +
|
||||||
|
date.add(props.eventType.length, "minute").utc().format() +
|
||||||
|
"&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=" +
|
||||||
|
date.utc().format() +
|
||||||
|
"&subject=" +
|
||||||
|
eventName
|
||||||
|
) + (location ? "&location=" + location : "")
|
||||||
|
}>
|
||||||
|
<a
|
||||||
|
className="mx-2 h-10 w-10 rounded-sm border border-neutral-200 px-3 py-2 dark:border-neutral-700 dark:text-white"
|
||||||
|
target="_blank">
|
||||||
|
<svg
|
||||||
|
className="mr-1 -mt-1 inline-block h-4 w-4"
|
||||||
|
fill="currentColor"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24">
|
||||||
|
<title>Microsoft Outlook</title>
|
||||||
|
<path d="M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V10.85l1.24.72h.01q.1.07.18.18.07.12.07.25zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.8v-2.73zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
href={
|
||||||
|
encodeURI(
|
||||||
|
"https://outlook.office.com/calendar/0/deeplink/compose?body=" +
|
||||||
|
props.eventType.description +
|
||||||
|
"&enddt=" +
|
||||||
|
date.add(props.eventType.length, "minute").utc().format() +
|
||||||
|
"&path=%2Fcalendar%2Faction%2Fcompose&rru=addevent&startdt=" +
|
||||||
|
date.utc().format() +
|
||||||
|
"&subject=" +
|
||||||
|
eventName
|
||||||
|
) + (location ? "&location=" + location : "")
|
||||||
|
}>
|
||||||
|
<a
|
||||||
|
className="mx-2 h-10 w-10 rounded-sm border border-neutral-200 px-3 py-2 dark:border-neutral-700 dark:text-white"
|
||||||
|
target="_blank">
|
||||||
|
<svg
|
||||||
|
className="mr-1 -mt-1 inline-block h-4 w-4"
|
||||||
|
fill="currentColor"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 24 24">
|
||||||
|
<title>Microsoft Office</title>
|
||||||
|
<path d="M21.53 4.306v15.363q0 .807-.472 1.433-.472.627-1.253.85l-6.888 1.974q-.136.037-.29.055-.156.019-.293.019-.396 0-.72-.105-.321-.106-.656-.292l-4.505-2.544q-.248-.137-.391-.366-.143-.23-.143-.515 0-.434.304-.738.304-.305.739-.305h5.831V4.964l-4.38 1.563q-.533.187-.856.658-.322.472-.322 1.03v8.078q0 .496-.248.912-.25.416-.683.651l-2.072 1.13q-.286.148-.571.148-.497 0-.844-.347-.348-.347-.348-.844V6.563q0-.62.33-1.19.328-.571.874-.881L11.07.285q.248-.136.534-.21.285-.075.57-.075.211 0 .38.031.166.031.364.093l6.888 1.899q.384.11.7.329.317.217.547.52.23.305.353.67.125.367.125.764zm-1.588 15.363V4.306q0-.273-.16-.478-.163-.204-.423-.28l-3.388-.93q-.397-.111-.794-.23-.397-.117-.794-.216v19.68l4.976-1.427q.26-.074.422-.28.161-.204.161-.477z" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
<Link href={"data:text/calendar," + eventLink()}>
|
||||||
|
<a
|
||||||
|
className="mx-2 h-10 w-10 rounded-sm border border-neutral-200 px-3 py-2 dark:border-neutral-700 dark:text-white"
|
||||||
|
download={props.eventType.title + ".ics"}>
|
||||||
|
<svg
|
||||||
|
version="1.1"
|
||||||
|
fill="currentColor"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
viewBox="0 0 1000 1000"
|
||||||
|
className="mr-1 -mt-1 inline-block h-4 w-4">
|
||||||
|
<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>
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{!(userIsOwner || props.hideBranding) && (
|
||||||
|
<div className="border-bookinglightest text-booking-lighter pt-4 text-center text-xs dark:border-gray-900 dark:text-white">
|
||||||
|
<a href="https://cal.com/signup">{t("create_booking_link_with_calcom")}</a>
|
||||||
|
|
||||||
|
<form
|
||||||
|
onSubmit={(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
router.push(`https://cal.com/signup?email=` + (e as any).target.email.value);
|
||||||
|
}}
|
||||||
|
className="mt-4 flex">
|
||||||
|
<EmailInput
|
||||||
|
name="email"
|
||||||
|
id="email"
|
||||||
|
defaultValue={router.query.email}
|
||||||
|
className="focus:border-brand border-bookinglightest mt-0 block w-full rounded-sm border-gray-300 shadow-sm focus:ring-black dark:border-gray-900 dark:bg-black dark:text-white sm:text-sm"
|
||||||
|
placeholder="rick.astley@cal.com"
|
||||||
|
/>
|
||||||
|
<Button size="lg" type="submit" className="min-w-max" color="primary">
|
||||||
|
{t("try_for_free")}
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{userIsOwner && !isEmbed && (
|
||||||
|
<div className="mt-4">
|
||||||
|
<Link href="/bookings">
|
||||||
|
<a className="flex items-center text-black dark:text-white">
|
||||||
|
<ArrowLeftIcon className="mr-1 h-4 w-4" /> {t("back_to_bookings")}
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</main>
|
||||||
</main>
|
</div>
|
||||||
</div>
|
{/* SPACE BOOKING APP */}
|
||||||
|
{props.userHasSpaceBooking && (
|
||||||
|
<SpaceBookingSuccessPage
|
||||||
|
open={props.userHasSpaceBooking}
|
||||||
|
what={`
|
||||||
|
${needsConfirmation ? t("submitted") : `${t("meeting_is_scheduled")}.`}
|
||||||
|
${
|
||||||
|
needsConfirmation
|
||||||
|
? props.profile.name !== null
|
||||||
|
? t("user_needs_to_confirm_or_reject_booking", { user: props.profile.name })
|
||||||
|
: t("needs_to_be_confirmed_or_rejected")
|
||||||
|
: t("emailed_you_and_attendees")
|
||||||
|
} ${t("what")}: ${eventName}`}
|
||||||
|
where={`${t("where")}: ${
|
||||||
|
location ? (location?.startsWith("http") ? { location } : location) : "Far far a way galaxy"
|
||||||
|
}`}
|
||||||
|
when={`${t("when")}: ${date.format("dddd, DD MMMM YYYY")} ${date.format(
|
||||||
|
is24h ? "H:mm" : "h:mma"
|
||||||
|
)} - ${props.eventType.length} mins (${
|
||||||
|
localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess()
|
||||||
|
})`}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
)) ||
|
)) ||
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
@ -499,6 +529,21 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||||
notFound: true,
|
notFound: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
let spaceBookingAvailable = false;
|
||||||
|
|
||||||
|
let userHasSpaceBooking = false;
|
||||||
|
if (eventType.users[0] && eventType.users[0].id) {
|
||||||
|
const credential = await prisma.credential.findFirst({
|
||||||
|
where: {
|
||||||
|
type: "spacebooking_other",
|
||||||
|
userId: eventType.users[0].id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (credential && credential.type === "spacebooking_other") {
|
||||||
|
userHasSpaceBooking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!eventType.users.length && eventType.userId) {
|
if (!eventType.users.length && eventType.userId) {
|
||||||
// TODO we should add `user User` relation on `EventType` so this extra query isn't needed
|
// TODO we should add `user User` relation on `EventType` so this extra query isn't needed
|
||||||
const user = await prisma.user.findUnique({
|
const user = await prisma.user.findUnique({
|
||||||
|
@ -545,6 +590,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||||
eventType,
|
eventType,
|
||||||
trpcState: ssr.dehydrate(),
|
trpcState: ssr.dehydrate(),
|
||||||
dynamicEventName,
|
dynamicEventName,
|
||||||
|
userHasSpaceBooking,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ export const apiHandlers = {
|
||||||
huddle01video: import("./huddle01video/api"),
|
huddle01video: import("./huddle01video/api"),
|
||||||
metamask: import("./metamask/api"),
|
metamask: import("./metamask/api"),
|
||||||
giphy: import("./giphy/api"),
|
giphy: import("./giphy/api"),
|
||||||
|
spacebookingother: import("./spacebooking/api"),
|
||||||
// @todo Until we use DB slugs everywhere
|
// @todo Until we use DB slugs everywhere
|
||||||
zapierother: import("./zapier/api"),
|
zapierother: import("./zapier/api"),
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,7 @@ export const InstallAppButtonMap = {
|
||||||
huddle01video: dynamic(() => import("./huddle01video/components/InstallAppButton")),
|
huddle01video: dynamic(() => import("./huddle01video/components/InstallAppButton")),
|
||||||
metamask: dynamic(() => import("./metamask/components/InstallAppButton")),
|
metamask: dynamic(() => import("./metamask/components/InstallAppButton")),
|
||||||
giphy: dynamic(() => import("./giphy/components/InstallAppButton")),
|
giphy: dynamic(() => import("./giphy/components/InstallAppButton")),
|
||||||
|
spacebookingother: dynamic(() => import("./spacebooking/components/InstallAppButton")),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const InstallAppButton = (
|
export const InstallAppButton = (
|
||||||
|
|
|
@ -12,6 +12,7 @@ import * as metamask from "./metamask";
|
||||||
import * as office365calendar from "./office365calendar";
|
import * as office365calendar from "./office365calendar";
|
||||||
import * as office365video from "./office365video";
|
import * as office365video from "./office365video";
|
||||||
import * as slackmessaging from "./slackmessaging";
|
import * as slackmessaging from "./slackmessaging";
|
||||||
|
import * as spacebooking from "./spacebooking";
|
||||||
import * as stripepayment from "./stripepayment";
|
import * as stripepayment from "./stripepayment";
|
||||||
import * as tandemvideo from "./tandemvideo";
|
import * as tandemvideo from "./tandemvideo";
|
||||||
import * as wipemycalother from "./wipemycalother";
|
import * as wipemycalother from "./wipemycalother";
|
||||||
|
@ -32,6 +33,7 @@ const appStore = {
|
||||||
office365video,
|
office365video,
|
||||||
slackmessaging,
|
slackmessaging,
|
||||||
stripepayment,
|
stripepayment,
|
||||||
|
spacebooking,
|
||||||
tandemvideo,
|
tandemvideo,
|
||||||
zoomvideo,
|
zoomvideo,
|
||||||
wipemycalother,
|
wipemycalother,
|
||||||
|
|
|
@ -11,6 +11,7 @@ import { metadata as metamask } from "./metamask/_metadata";
|
||||||
import { metadata as office365calendar } from "./office365calendar/_metadata";
|
import { metadata as office365calendar } from "./office365calendar/_metadata";
|
||||||
import { metadata as office365video } from "./office365video/_metadata";
|
import { metadata as office365video } from "./office365video/_metadata";
|
||||||
import { metadata as slackmessaging } from "./slackmessaging/_metadata";
|
import { metadata as slackmessaging } from "./slackmessaging/_metadata";
|
||||||
|
import { metadata as spacebooking } from "./spacebooking/_metadata";
|
||||||
import { metadata as stripepayment } from "./stripepayment/_metadata";
|
import { metadata as stripepayment } from "./stripepayment/_metadata";
|
||||||
import { metadata as tandemvideo } from "./tandemvideo/_metadata";
|
import { metadata as tandemvideo } from "./tandemvideo/_metadata";
|
||||||
import { metadata as wipemycalother } from "./wipemycalother/_metadata";
|
import { metadata as wipemycalother } from "./wipemycalother/_metadata";
|
||||||
|
@ -30,6 +31,7 @@ export const appStoreMetadata = {
|
||||||
office365video,
|
office365video,
|
||||||
slackmessaging,
|
slackmessaging,
|
||||||
stripepayment,
|
stripepayment,
|
||||||
|
spacebooking,
|
||||||
tandemvideo,
|
tandemvideo,
|
||||||
zoomvideo,
|
zoomvideo,
|
||||||
wipemycalother,
|
wipemycalother,
|
||||||
|
|
10
packages/app-store/spacebooking/README.mdx
Normal file
10
packages/app-store/spacebooking/README.mdx
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<iframe
|
||||||
|
width="640"
|
||||||
|
height="360"
|
||||||
|
src="https://www.loom.com/embed/f8d2cd9b2ac74f0c916f20c4441bd1da"
|
||||||
|
frameborder="0"
|
||||||
|
webkitallowfullscreen
|
||||||
|
mozallowfullscreen
|
||||||
|
allowfullscreen></iframe>
|
||||||
|
|
||||||
|
Looking to honor May 4th? Search no further. Download this app to make your booking success page resemble a long time ago in a galaxy far far away.
|
26
packages/app-store/spacebooking/_metadata.ts
Normal file
26
packages/app-store/spacebooking/_metadata.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import type { App } from "@calcom/types/App";
|
||||||
|
|
||||||
|
import _package from "./package.json";
|
||||||
|
|
||||||
|
export const metadata = {
|
||||||
|
name: "SpaceBooking",
|
||||||
|
description: _package.description,
|
||||||
|
installed: true,
|
||||||
|
category: "other",
|
||||||
|
// If using static next public folder, can then be referenced from the base URL (/).
|
||||||
|
imageSrc: "/api/app-store/spacebooking/spacebooking.webp",
|
||||||
|
logo: "/api/app-store/spacebooking/spacebooking.webp",
|
||||||
|
publisher: "Cal.com",
|
||||||
|
rating: 0,
|
||||||
|
reviews: 0,
|
||||||
|
slug: "space-booking",
|
||||||
|
title: "SpaceBooking",
|
||||||
|
trending: true,
|
||||||
|
type: "spacebooking_other",
|
||||||
|
url: "https://cal.com/apps/spacebooking",
|
||||||
|
variant: "other",
|
||||||
|
verified: true,
|
||||||
|
email: "help@cal.com",
|
||||||
|
} as App;
|
||||||
|
|
||||||
|
export default metadata;
|
43
packages/app-store/spacebooking/api/add.ts
Normal file
43
packages/app-store/spacebooking/api/add.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
|
||||||
|
import prisma from "@calcom/prisma";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param req
|
||||||
|
* @param res
|
||||||
|
*/
|
||||||
|
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
|
if (!req.session?.user?.id) {
|
||||||
|
return res.status(401).json({ message: "You must be logged in to do this" });
|
||||||
|
}
|
||||||
|
const appType = "spacebooking_other";
|
||||||
|
try {
|
||||||
|
const alreadyInstalled = await prisma.credential.findFirst({
|
||||||
|
where: {
|
||||||
|
type: appType,
|
||||||
|
userId: req.session.user.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (alreadyInstalled) {
|
||||||
|
throw new Error("Already installed");
|
||||||
|
}
|
||||||
|
const installation = await prisma.credential.create({
|
||||||
|
data: {
|
||||||
|
type: appType,
|
||||||
|
key: {},
|
||||||
|
userId: req.session.user.id,
|
||||||
|
appId: "space-booking",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (!installation) {
|
||||||
|
throw new Error("Unable to create user credential for spacebooking");
|
||||||
|
}
|
||||||
|
} catch (error: unknown) {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
return res.status(500).json({ message: error.message });
|
||||||
|
}
|
||||||
|
return res.status(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.status(200).json({ url: "/apps/installed" });
|
||||||
|
}
|
1
packages/app-store/spacebooking/api/index.ts
Normal file
1
packages/app-store/spacebooking/api/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export { default as add } from "./add";
|
|
@ -0,0 +1,30 @@
|
||||||
|
import { XIcon } from "@heroicons/react/solid";
|
||||||
|
import { useState } from "react";
|
||||||
|
|
||||||
|
import { Dialog, DialogContent } from "@calcom/ui/Dialog";
|
||||||
|
|
||||||
|
const FullScreenDialog = (props: React.PropsWithChildren<{ open: boolean }>) => {
|
||||||
|
const [open, setOpen] = useState(props.open);
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Dialog open={open} onOpenChange={() => setOpen(false)}>
|
||||||
|
<DialogContent className="h-full w-full min-w-[30rem] bg-black p-0 sm:max-h-[50rem] sm:w-full sm:max-w-[60rem] sm:align-middle">
|
||||||
|
<div
|
||||||
|
className="flex h-8 w-8 justify-center text-white hover:bg-gray-200 hover:text-black"
|
||||||
|
onClick={() => setOpen(false)}
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
top: 16,
|
||||||
|
right: 16,
|
||||||
|
zIndex: "inherit",
|
||||||
|
}}>
|
||||||
|
<XIcon className="w-4" />
|
||||||
|
</div>
|
||||||
|
{props.children}
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export { FullScreenDialog };
|
|
@ -0,0 +1,17 @@
|
||||||
|
import useAddAppMutation from "../../_utils/useAddAppMutation";
|
||||||
|
import { InstallAppButtonProps } from "../../types";
|
||||||
|
|
||||||
|
export default function InstallAppButton(props: InstallAppButtonProps) {
|
||||||
|
const mutation = useAddAppMutation("spacebooking_other");
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{props.render({
|
||||||
|
onClick() {
|
||||||
|
mutation.mutate("");
|
||||||
|
},
|
||||||
|
loading: mutation.isLoading,
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
|
@ -0,0 +1,230 @@
|
||||||
|
import { useEffect } from "react";
|
||||||
|
|
||||||
|
import { FullScreenDialog } from "./FullScreenDialog";
|
||||||
|
|
||||||
|
const SpaceBookingSuccessPage = (props: { what: string; where: string; when: string; open: boolean }) => {
|
||||||
|
const { what, where, when, open } = props;
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const canvas = document.getElementById("canvas") as HTMLCanvasElement;
|
||||||
|
const c = canvas.getContext("2d") as CanvasRenderingContext2D;
|
||||||
|
|
||||||
|
let w: number;
|
||||||
|
let h: number;
|
||||||
|
|
||||||
|
const setCanvasExtents = () => {
|
||||||
|
w = document.body.clientWidth;
|
||||||
|
h = document.body.clientHeight;
|
||||||
|
canvas.width = Math.min(1600, w);
|
||||||
|
canvas.height = Math.min(900, h);
|
||||||
|
};
|
||||||
|
|
||||||
|
setCanvasExtents();
|
||||||
|
|
||||||
|
const crawl = document.getElementById("crawl") as HTMLDivElement;
|
||||||
|
const crawlContent = document.getElementById("crawl-content") as HTMLDivElement;
|
||||||
|
const crawlContentStyle = crawlContent.style;
|
||||||
|
|
||||||
|
// start crawl at bottom of 3d plane
|
||||||
|
let crawlPos = crawl.clientHeight;
|
||||||
|
|
||||||
|
const makeStars = (count: number) => {
|
||||||
|
const out = [];
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
const s = {
|
||||||
|
x: Math.random() * 1600 - 800,
|
||||||
|
y: Math.random() * 900 - 450,
|
||||||
|
z: Math.random() * 1000,
|
||||||
|
};
|
||||||
|
out.push(s);
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
};
|
||||||
|
|
||||||
|
let stars = makeStars(2000);
|
||||||
|
|
||||||
|
window.onresize = () => {
|
||||||
|
setCanvasExtents();
|
||||||
|
};
|
||||||
|
|
||||||
|
const clear = () => {
|
||||||
|
c.fillStyle = "black";
|
||||||
|
c.fillRect(0, 0, canvas.width, canvas.height);
|
||||||
|
};
|
||||||
|
|
||||||
|
const putPixel = (x: number, y: number, brightness: number) => {
|
||||||
|
const intensity = brightness * 255;
|
||||||
|
const rgb = "rgb(" + intensity + "," + intensity + "," + intensity + ")";
|
||||||
|
c.fillStyle = rgb;
|
||||||
|
c.fillRect(x, y, 1, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const moveStars = (distance: number) => {
|
||||||
|
const count = stars.length;
|
||||||
|
for (var i = 0; i < count; i++) {
|
||||||
|
const s = stars[i];
|
||||||
|
s.z -= distance;
|
||||||
|
if (s.z <= 1) {
|
||||||
|
s.z += 999;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const moveCrawl = (distance: number) => {
|
||||||
|
crawlPos -= distance;
|
||||||
|
crawlContentStyle.top = crawlPos + "px";
|
||||||
|
|
||||||
|
// if we've scrolled all content past the top edge
|
||||||
|
// of the plane, reposition content at bottom of plane
|
||||||
|
if (crawlPos < -crawlContent.clientHeight) {
|
||||||
|
crawlPos = crawl.clientHeight;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const paintStars = () => {
|
||||||
|
const cx = canvas.width / 2;
|
||||||
|
const cy = canvas.height / 2;
|
||||||
|
|
||||||
|
const count = stars.length;
|
||||||
|
for (var i = 0; i < count; i++) {
|
||||||
|
const star = stars[i];
|
||||||
|
|
||||||
|
const x = cx + star.x / (star.z * 0.001);
|
||||||
|
const y = cy + star.y / (star.z * 0.001);
|
||||||
|
|
||||||
|
if (x < 0 || x >= w || y < 0 || y >= h) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const d = star.z / 1000.0;
|
||||||
|
const b = 1 - d * d;
|
||||||
|
|
||||||
|
putPixel(x, y, b);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let prevTime: number;
|
||||||
|
const init = (time: number) => {
|
||||||
|
prevTime = time;
|
||||||
|
requestAnimationFrame(tick);
|
||||||
|
};
|
||||||
|
|
||||||
|
const tick = (time: number) => {
|
||||||
|
let elapsed = time - prevTime;
|
||||||
|
prevTime = time;
|
||||||
|
|
||||||
|
moveStars(elapsed * 0.02);
|
||||||
|
|
||||||
|
// time-scale of crawl, increase factor to go faster
|
||||||
|
moveCrawl(elapsed * 0.06);
|
||||||
|
|
||||||
|
clear();
|
||||||
|
paintStars();
|
||||||
|
|
||||||
|
requestAnimationFrame(tick);
|
||||||
|
};
|
||||||
|
|
||||||
|
requestAnimationFrame(init);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const episodeDetails = [
|
||||||
|
{ number: "IV", name: "A new hope" },
|
||||||
|
{ number: "V", name: "The Empire" },
|
||||||
|
{ number: "VI", name: "Return of the Jedi" },
|
||||||
|
{ number: "I", name: "The Phantom menace" },
|
||||||
|
{ number: "II", name: "Attack of the Clones" },
|
||||||
|
{ number: "III", name: "Revenge of the Sith" },
|
||||||
|
];
|
||||||
|
const randomEpisodeNumber = episodeDetails[Math.floor(Math.random() * episodeDetails.length)];
|
||||||
|
|
||||||
|
const css = `
|
||||||
|
#crawl-container {
|
||||||
|
perspective: calc(100vh * 0.4);
|
||||||
|
}
|
||||||
|
#crawl {
|
||||||
|
color: #f5c91c;
|
||||||
|
position: absolute;
|
||||||
|
width: 110%;
|
||||||
|
left: -5%;
|
||||||
|
bottom: -5%;
|
||||||
|
height: 200%;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
transform: rotate3d(1, 0, 0, 45deg);
|
||||||
|
transform-origin: 50% 100%;
|
||||||
|
|
||||||
|
mask-image: linear-gradient(
|
||||||
|
rgba(0, 0, 0, 0),
|
||||||
|
rgba(0, 0, 0, 0.66),
|
||||||
|
rgba(0, 0, 0, 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
-webkit-mask-image: -webkit-linear-gradient(
|
||||||
|
rgba(0, 0, 0, 0),
|
||||||
|
rgba(0, 0, 0, 0.66),
|
||||||
|
rgba(0, 0, 0, 1)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#crawl-content {
|
||||||
|
font-family: "Roboto";
|
||||||
|
font-size: calc(100vw * 0.074);
|
||||||
|
letter-spacing: 0.09em;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#crawl p {
|
||||||
|
text-align: justify;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 0 1.25em 0;
|
||||||
|
line-height: 1.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#crawl h1 {
|
||||||
|
font-size: 1em;
|
||||||
|
margin: 0 0 0.3em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#crawl h2 {
|
||||||
|
font-size: 1.5em;
|
||||||
|
margin: 0 0 0.7em 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#crawl h1,
|
||||||
|
#crawl h2 {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<FullScreenDialog open={open}>
|
||||||
|
<canvas id="canvas" className="absolute m-0 h-full w-full overflow-hidden p-0"></canvas>
|
||||||
|
<div
|
||||||
|
id="crawl-container"
|
||||||
|
className="perspective-[calc(100vh * 0.4)] absolute m-0 h-full w-full overflow-hidden p-0">
|
||||||
|
<div
|
||||||
|
id="crawl"
|
||||||
|
className="color-[#f5c91c] transform=[rotate3d(1, 0, 0, 45deg)] transform-origin-[50% 100%] absolute -left-[5%] -bottom-[5%] h-[200%] w-[110%] overflow-hidden">
|
||||||
|
<div id="crawl-content">
|
||||||
|
<h1>Episode {randomEpisodeNumber.number}</h1>
|
||||||
|
<h2>{randomEpisodeNumber.name}</h2>
|
||||||
|
<p>{what}</p>
|
||||||
|
<p>
|
||||||
|
{when}
|
||||||
|
<br />
|
||||||
|
</p>
|
||||||
|
<p>{where}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<style>{css}</style>
|
||||||
|
</FullScreenDialog>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default SpaceBookingSuccessPage;
|
5
packages/app-store/spacebooking/components/index.ts
Normal file
5
packages/app-store/spacebooking/components/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import dynamic from "next/dynamic";
|
||||||
|
|
||||||
|
export { default as InstallAppButton } from "./InstallAppButton";
|
||||||
|
/** These are like 12kb that not every user needs */
|
||||||
|
export const SpaceBookingSuccessPage = dynamic(() => import("./SpaceBookingSuccessPage"));
|
4
packages/app-store/spacebooking/index.ts
Normal file
4
packages/app-store/spacebooking/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export * as api from "./api";
|
||||||
|
export * as lib from "./lib";
|
||||||
|
export { metadata } from "./_metadata";
|
||||||
|
export * as components from "./components";
|
1
packages/app-store/spacebooking/lib/index.ts
Normal file
1
packages/app-store/spacebooking/lib/index.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
12
packages/app-store/spacebooking/package.json
Normal file
12
packages/app-store/spacebooking/package.json
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
|
"private": true,
|
||||||
|
"name": "@calcom/spacebooking",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"main": "./index.ts",
|
||||||
|
"description": "Looking to honor May 4th? Search no further. Install this app to make your booking success page resemble a long time ago in a galaxy far far away.",
|
||||||
|
"dependencies": {},
|
||||||
|
"devDependencies": {
|
||||||
|
"@calcom/types": "*"
|
||||||
|
}
|
||||||
|
}
|
BIN
packages/app-store/spacebooking/static/spacebooking.webp
Normal file
BIN
packages/app-store/spacebooking/static/spacebooking.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
|
@ -9,6 +9,7 @@ async function createApp(
|
||||||
/** The directory name for `/packages/app-store/[dirName]` */
|
/** The directory name for `/packages/app-store/[dirName]` */
|
||||||
dirName: Prisma.AppCreateInput["dirName"],
|
dirName: Prisma.AppCreateInput["dirName"],
|
||||||
categories: Prisma.AppCreateInput["categories"],
|
categories: Prisma.AppCreateInput["categories"],
|
||||||
|
/** This is used so credentials gets linked to the correct app */
|
||||||
type: Prisma.CredentialCreateInput["type"],
|
type: Prisma.CredentialCreateInput["type"],
|
||||||
keys?: Prisma.AppCreateInput["keys"]
|
keys?: Prisma.AppCreateInput["keys"]
|
||||||
) {
|
) {
|
||||||
|
@ -84,6 +85,7 @@ async function main() {
|
||||||
api_key: process.env.GIPHY_API_KEY,
|
api_key: process.env.GIPHY_API_KEY,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
await createApp("space-booking", "spacebooking", ["other"], "spacebooking_other");
|
||||||
await createApp("zapier", "zapier", ["other"], "zapier_other");
|
await createApp("zapier", "zapier", ["other"], "zapier_other");
|
||||||
// Web3 apps
|
// Web3 apps
|
||||||
await createApp("huddle01", "huddle01video", ["web3", "video"], "huddle01_video");
|
await createApp("huddle01", "huddle01video", ["web3", "video"], "huddle01_video");
|
||||||
|
|
|
@ -2,6 +2,8 @@ import * as DialogPrimitive from "@radix-ui/react-dialog";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import React, { ReactNode, useState } from "react";
|
import React, { ReactNode, useState } from "react";
|
||||||
|
|
||||||
|
import classNames from "@calcom/lib/classNames";
|
||||||
|
|
||||||
export type DialogProps = React.ComponentProps<typeof DialogPrimitive["Root"]> & {
|
export type DialogProps = React.ComponentProps<typeof DialogPrimitive["Root"]> & {
|
||||||
name?: string;
|
name?: string;
|
||||||
clearQueryParamsOnClose?: string[];
|
clearQueryParamsOnClose?: string[];
|
||||||
|
@ -63,7 +65,10 @@ export const DialogContent = React.forwardRef<HTMLDivElement, DialogContentProps
|
||||||
<DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-black bg-opacity-50 transition-opacity" />
|
<DialogPrimitive.Overlay className="fadeIn fixed inset-0 z-40 bg-black bg-opacity-50 transition-opacity" />
|
||||||
<DialogPrimitive.Content
|
<DialogPrimitive.Content
|
||||||
{...props}
|
{...props}
|
||||||
className="fadeIn fixed left-1/2 top-1/2 z-[9999999999] min-w-[360px] -translate-x-1/2 -translate-y-1/2 rounded bg-white p-6 text-left shadow-xl focus-visible:outline-none sm:w-full sm:max-w-[35rem] sm:align-middle"
|
className={classNames(
|
||||||
|
"fadeIn fixed left-1/2 top-1/2 z-[9999999999] min-w-[360px] -translate-x-1/2 -translate-y-1/2 rounded bg-white p-6 text-left shadow-xl focus-visible:outline-none sm:w-full sm:max-w-[35rem] sm:align-middle",
|
||||||
|
`${props.className}`
|
||||||
|
)}
|
||||||
ref={forwardedRef}>
|
ref={forwardedRef}>
|
||||||
{children}
|
{children}
|
||||||
</DialogPrimitive.Content>
|
</DialogPrimitive.Content>
|
||||||
|
|
Loading…
Reference in a new issue