feat(app-store): Add Giphy app (#2580)
This commit is contained in:
1 parent
276821e0b5
commit
21867c9cd4
20 files changed
+484
-8
No files matched your search
@@ -29,6 +29,7 @@ import { FormattedNumber, IntlProvider } from "react-intl";
|
||||
import { JSONObject } from "superjson/dist/types";
|
||||
import { z } from "zod";
|
||||
|
||||
import { SelectGifInput } from "@calcom/app-store/giphyother/components";
|
||||
import getApps, { getLocationOptions, hasIntegration } from "@calcom/app-store/utils";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import showToast from "@calcom/lib/notification";
|
||||
@@ -199,7 +200,15 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
||||
prefix: t("indefinitely_into_future"),
|
||||
},
|
||||
];
|
||||
const { eventType, locationOptions, team, teamMembers, hasPaymentIntegration, currency } = props;
|
||||
const {
|
||||
eventType,
|
||||
locationOptions,
|
||||
team,
|
||||
teamMembers,
|
||||
hasPaymentIntegration,
|
||||
currency,
|
||||
hasGiphyIntegration,
|
||||
} = props;
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@@ -496,6 +505,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
||||
externalId: string;
|
||||
};
|
||||
successRedirectUrl: string;
|
||||
giphyThankYouPage: string;
|
||||
}>({
|
||||
defaultValues: {
|
||||
locations: eventType.locations || [],
|
||||
@@ -914,6 +924,7 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
||||
periodDates,
|
||||
periodCountCalendarDays,
|
||||
smartContractAddress,
|
||||
giphyThankYouPage,
|
||||
beforeBufferTime,
|
||||
afterBufferTime,
|
||||
locations,
|
||||
@@ -931,11 +942,10 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
||||
id: eventType.id,
|
||||
beforeEventBuffer: beforeBufferTime,
|
||||
afterEventBuffer: afterBufferTime,
|
||||
metadata: smartContractAddress
|
||||
? {
|
||||
smartContractAddress,
|
||||
}
|
||||
: "",
|
||||
metadata: {
|
||||
...(smartContractAddress ? { smartContractAddress } : {}),
|
||||
...(giphyThankYouPage ? { giphyThankYouPage } : {}),
|
||||
},
|
||||
});
|
||||
}}
|
||||
className="space-y-6">
|
||||
@@ -1725,6 +1735,39 @@ const EventTypePage = (props: inferSSRProps<typeof getServerSideProps>) => {
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{hasGiphyIntegration && (
|
||||
<>
|
||||
<hr className="border-neutral-200" />
|
||||
<div className="block sm:flex">
|
||||
<div className="min-w-48 mb-4 sm:mb-0">
|
||||
<label
|
||||
htmlFor="gif"
|
||||
className="mt-2 flex text-sm font-medium text-neutral-700">
|
||||
{t("confirmation_page_gif")}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col">
|
||||
<div className="w-full">
|
||||
<div className="block items-center sm:flex">
|
||||
<div className="w-full">
|
||||
<div className="relative flex items-start">
|
||||
<div className="flex items-center">
|
||||
<SelectGifInput
|
||||
defaultValue={eventType?.metadata?.giphyThankYouPage as string}
|
||||
onChange={(url) => {
|
||||
formMethods.setValue("giphyThankYouPage", url);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</CollapsibleContent>
|
||||
</>
|
||||
{/* )} */}
|
||||
@@ -2076,6 +2119,8 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||
: false,
|
||||
};
|
||||
|
||||
const hasGiphyIntegration = !!credentials.find((credential) => credential.type === "giphy_other");
|
||||
|
||||
// backwards compat
|
||||
if (eventType.users.length === 0 && !eventType.team) {
|
||||
const fallbackUser = await prisma.user.findUnique({
|
||||
@@ -2133,6 +2178,7 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
|
||||
team: eventTypeObject.team || null,
|
||||
teamMembers,
|
||||
hasPaymentIntegration,
|
||||
hasGiphyIntegration,
|
||||
currency,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -159,6 +159,8 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)
|
||||
host: props.profile.name || "Nameless",
|
||||
t,
|
||||
};
|
||||
const metadata = props.eventType?.metadata as { giphyThankYouPage: string };
|
||||
const giphyImage = metadata?.giphyThankYouPage;
|
||||
|
||||
const eventName = getEventName(eventNameObject);
|
||||
const needsConfirmation = eventType.requiresConfirmation && reschedule != "true";
|
||||
@@ -245,8 +247,13 @@ export default function Success(props: inferSSRProps<typeof getServerSideProps>)
|
||||
aria-modal="true"
|
||||
aria-labelledby="modal-headline">
|
||||
<div>
|
||||
<div className="mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100">
|
||||
{!needsConfirmation && <CheckIcon className="h-8 w-8 text-green-600" />}
|
||||
<div
|
||||
className={classNames(
|
||||
"mx-auto flex items-center justify-center",
|
||||
!giphyImage ? "h-12 w-12 rounded-full bg-green-100" : ""
|
||||
)}>
|
||||
{giphyImage && !needsConfirmation && <img src={giphyImage} alt={"Gif from Giphy"} />}
|
||||
{!giphyImage && !needsConfirmation && <CheckIcon className="h-8 w-8 text-green-600" />}
|
||||
{needsConfirmation && <ClockIcon className="h-8 w-8 text-green-600" />}
|
||||
</div>
|
||||
<div className="mt-3 text-center sm:mt-5">
|
||||
@@ -468,6 +475,7 @@ const getEventTypesFromDB = async (typeId: number) => {
|
||||
hideBranding: true,
|
||||
},
|
||||
},
|
||||
metadata: true,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
@@ -768,6 +768,8 @@
|
||||
"edit_booking": "Edit booking",
|
||||
"reschedule_booking": "Reschedule booking",
|
||||
"former_time": "Former time",
|
||||
"confirmation_page_gif": "Gif for confirmation page",
|
||||
"search": "Search",
|
||||
"impersonate":"Impersonate",
|
||||
"impersonate_user_tip":"All uses of this feature is audited.",
|
||||
"impersonating_user_warning":"Impersonating username \"{{user}}\".",
|
||||
|
||||
Reference in new issue
Block a user