* Icon and IconName * Button and ButtonGroup * UserAvatar * AvatarGroup * Avatar * WizardLayout * Dialogs * EmptyScreen * showToast and TextField * Editor * Skeleton * Skeleton * TopBanner and showToast * Button again * more * perf: Remove app-store reference from @calcom/ui * more * Fixing types * Icon * Fixed casing * dropdown * more * Select * more * Badge * List * more * Divider * more * fix * fix type check * refactor * fix * fix * fix * fix * fix * fix * fix * fix type check * fix * fix * fix * fix * more * more * more * more * add index file to components/command * fix * fix * fix * fix imports * fix * fix * fix * fix * fix * fix * fix * fix build errors * fix build errors * fix --------- Co-authored-by: Keith Williams <keithwillcode@gmail.com>
62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import { useSession } from "next-auth/react";
|
|
import { useRouter } from "next/navigation";
|
|
import { useEffect } from "react";
|
|
|
|
import { APP_NAME } from "@calcom/lib/constants";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { trpc } from "@calcom/trpc";
|
|
import useEmailVerifyCheck from "@calcom/trpc/react/hooks/useEmailVerifyCheck";
|
|
import { showToast } from "@calcom/ui/components/toast";
|
|
import { Button } from "@calcom/ui/components/button";
|
|
import { EmptyScreen } from "@calcom/ui/components/empty-screen";
|
|
|
|
function VerifyEmailPage() {
|
|
const { data } = useEmailVerifyCheck();
|
|
const { data: session } = useSession();
|
|
const router = useRouter();
|
|
const { t, isLocaleReady } = useLocale();
|
|
const mutation = trpc.viewer.auth.resendVerifyEmail.useMutation();
|
|
|
|
useEffect(() => {
|
|
if (data?.isVerified) {
|
|
router.replace("/getting-started");
|
|
}
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [data?.isVerified]);
|
|
if (!isLocaleReady) {
|
|
return null;
|
|
}
|
|
return (
|
|
<div className="h-[100vh] w-full ">
|
|
<div className="flex h-full w-full flex-col items-center justify-center">
|
|
<div className="max-w-3xl">
|
|
<EmptyScreen
|
|
border
|
|
dashedBorder={false}
|
|
Icon="mail-open"
|
|
headline={t("check_your_email")}
|
|
description={t("verify_email_page_body", { email: session?.user?.email, appName: APP_NAME })}
|
|
className="bg-default"
|
|
buttonRaw={
|
|
<Button
|
|
color="minimal"
|
|
className="underline"
|
|
loading={mutation.isPending}
|
|
onClick={() => {
|
|
showToast(t("send_email"), "success");
|
|
mutation.mutate();
|
|
}}>
|
|
{t("resend_email")}
|
|
</Button>
|
|
}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default VerifyEmailPage;
|