feat: gmail, outlook, yahoo links during email verification (#26038)
* added gmail, outlook, yahoo links during email verification * added proton * enable for self-hosters too * undo i18n * Discard changes to companion/bun.lock * nit * refactor: code quality improvments --------- Co-authored-by: Dhairyashil <[email protected]>
This commit is contained in:
1 parent
c8a8c37b45
commit
3423777ee3
5 files changed
+195
-14
No files matched your search
@@ -2,17 +2,40 @@
|
||||
|
||||
import { useSession } from "next-auth/react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { useEffect } from "react";
|
||||
import posthog from "posthog-js";
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { useFlagMap } from "@calcom/features/flags/context/provider";
|
||||
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";
|
||||
import { useFlagMap } from "@calcom/features/flags/context/provider";
|
||||
import { showToast } from "@calcom/ui/components/toast";
|
||||
|
||||
const EMAIL_CLIENTS = [
|
||||
{
|
||||
name: "Gmail",
|
||||
icon: "/email-clients/gmail.svg",
|
||||
href: 'https://mail.google.com/mail/u/0/#search/%22api%2Fauth%2Fverify-email%22',
|
||||
},
|
||||
{
|
||||
name: "Outlook",
|
||||
icon: "/email-clients/outlook.svg",
|
||||
href: "https://outlook.live.com/mail/0/",
|
||||
},
|
||||
{
|
||||
name: "Yahoo",
|
||||
icon: "/email-clients/yahoo.svg",
|
||||
href: "https://mail.yahoo.com/d/search?p=Cal.com",
|
||||
},
|
||||
{
|
||||
name: "Proton",
|
||||
icon: "/email-clients/proton.svg",
|
||||
href: "https://mail.proton.me",
|
||||
},
|
||||
] as const;
|
||||
|
||||
function VerifyEmailPage() {
|
||||
const { data } = useEmailVerifyCheck();
|
||||
@@ -47,17 +70,30 @@ function VerifyEmailPage() {
|
||||
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={() => {
|
||||
posthog.capture("verify_email_resend_clicked");
|
||||
showToast(t("send_email"), "success");
|
||||
mutation.mutate();
|
||||
}}>
|
||||
{t("resend_email")}
|
||||
</Button>
|
||||
<>
|
||||
<div className="mb-4 flex flex-wrap items-center gap-2">
|
||||
{EMAIL_CLIENTS.map(({ name, icon, href }) => (
|
||||
<Button
|
||||
key={name}
|
||||
color="secondary"
|
||||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">
|
||||
<img src={icon} alt={name} className="me-1 h-4 w-4" /> {name}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
<Button
|
||||
color="minimal"
|
||||
loading={mutation.isPending}
|
||||
onClick={() => {
|
||||
posthog.capture("verify_email_resend_clicked");
|
||||
showToast(t("send_email"), "success");
|
||||
mutation.mutate();
|
||||
}}>
|
||||
{t("resend_email")}
|
||||
</Button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user