From 2410f8b3aa53587e3ca05eacc8e3ef2e1ce3d0a4 Mon Sep 17 00:00:00 2001 From: sean-brydon <55134778+sean-brydon@users.noreply.github.com> Date: Mon, 18 Dec 2023 22:34:20 +1000 Subject: [PATCH] Payment success screen re-design (#12831) Co-authored-by: Peer Richelsen --- apps/web/pages/auth/verify.tsx | 143 ++++++++++++++++++++++++--------- 1 file changed, 106 insertions(+), 37 deletions(-) diff --git a/apps/web/pages/auth/verify.tsx b/apps/web/pages/auth/verify.tsx index 85b17a4be0..384efcdac6 100644 --- a/apps/web/pages/auth/verify.tsx +++ b/apps/web/pages/auth/verify.tsx @@ -1,15 +1,18 @@ +import { motion } from "framer-motion"; +import type { GetServerSidePropsContext, InferGetServerSidePropsType } from "next"; import { signIn } from "next-auth/react"; import Head from "next/head"; import { usePathname, useRouter } from "next/navigation"; import { useEffect, useRef, useState } from "react"; import z from "zod"; +import { classNames } from "@calcom/lib"; import { APP_NAME, WEBAPP_URL } from "@calcom/lib/constants"; import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams"; import { useRouterQuery } from "@calcom/lib/hooks/useRouterQuery"; import { trpc } from "@calcom/trpc/react"; import { Button, showToast } from "@calcom/ui"; -import { AlertTriangle, Check, MailOpen } from "@calcom/ui/components/icon"; +import { AlertTriangle, ExternalLink, MailOpen } from "@calcom/ui/components/icon"; import Loader from "@components/Loader"; import PageWrapper from "@components/PageWrapper"; @@ -54,7 +57,62 @@ const querySchema = z.object({ t: z.string().optional(), }); -export default function Verify() { +const PaymentFailedIcon = () => ( +
+ +
+); + +const PaymentSuccess = () => ( +
+ + + + + + + +
+); + +const MailOpenIcon = () => ( +
+ +
+); + +export default function Verify(props: InferGetServerSidePropsType) { const searchParams = useCompatSearchParams(); const pathname = usePathname(); const router = useRouter(); @@ -112,7 +170,7 @@ export default function Verify() { } return ( -
+
{/* @note: Ternary can look ugly ant his might be extracted later but I think at 3 it's not yet worth @@ -125,17 +183,9 @@ export default function Verify() {
-
-
- {hasPaymentFailed ? ( - - ) : sessionId ? ( - - ) : ( - - )} -
-

+
+ {hasPaymentFailed ? : sessionId ? : } +

{hasPaymentFailed ? "Your payment failed" : sessionId @@ -145,41 +195,60 @@ export default function Verify() { {hasPaymentFailed && (

Your account has been created, but your premium has not been reserved.

)} -

+

We have sent an email to {customer?.email} with a link to activate your account.{" "} {hasPaymentFailed && "Once you activate your account you will be able to try purchase your premium username again or select a different one."}

-

- Don't see an email? Click the button below to send another email. -

- -
+
-
+
+

Don’t seen an email?

+ +

); } +export const getServerSideProps = async (context: GetServerSidePropsContext) => { + const EMAIL_FROM = process.env.EMAIL_FROM; + + return { + props: { + EMAIL_FROM, + }, + }; +}; Verify.PageWrapper = PageWrapper;