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.
-
-
-
+
0}
- onClick={async (e) => {
- if (!customer) {
- return;
- }
- e.preventDefault();
- setSecondsLeft(30);
- // Update query params with t:timestamp, shallow: true doesn't re-render the page
- const _searchParams = new URLSearchParams(searchParams?.toString());
- _searchParams.set("t", `${Date.now()}`);
- router.replace(`${pathname}?${_searchParams.toString()}`);
- return await sendVerificationLogin(customer.email, customer.username);
- }}>
- {secondsLeft > 0 ? `Resend in ${secondsLeft} seconds` : "Send another mail"}
-
-
- Login using another method
+ href={
+ props.EMAIL_FROM
+ ? encodeURIComponent(`https://mail.google.com/mail/u/0/#search/from:${props.EMAIL_FROM}`)
+ : "https://mail.google.com/mail/u/0/"
+ }
+ target="_blank"
+ EndIcon={ExternalLink}>
+ Open in Gmail
+
+
Don’t seen an email?
+
0 ? "text-muted" : "underline underline-offset-2 hover:font-normal"
+ )}
+ disabled={secondsLeft > 0}
+ onClick={async (e) => {
+ if (!customer) {
+ return;
+ }
+ e.preventDefault();
+ setSecondsLeft(30);
+ // Update query params with t:timestamp, shallow: true doesn't re-render the page
+ const _searchParams = new URLSearchParams(searchParams?.toString());
+ _searchParams.set("t", `${Date.now()}`);
+ router.replace(`${pathname}?${_searchParams.toString()}`);
+ return await sendVerificationLogin(customer.email, customer.username);
+ }}>
+ {secondsLeft > 0 ? `Resend in ${secondsLeft} seconds` : "Resend"}
+
+
);
}
+export const getServerSideProps = async (context: GetServerSidePropsContext) => {
+ const EMAIL_FROM = process.env.EMAIL_FROM;
+
+ return {
+ props: {
+ EMAIL_FROM,
+ },
+ };
+};
Verify.PageWrapper = PageWrapper;