/* Copyright 2024 New Vector Ltd. Copyright 2022 The Matrix.org Foundation C.I.C. SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only Please see LICENSE files in the repository root for full details. */ import React, { ReactNode } from "react"; import { Tooltip } from "@vector-im/compound-web"; import AccessibleButton from "../../../views/elements/AccessibleButton"; import { Icon as EMailPromptIcon } from "../../../../../res/img/element-icons/email-prompt.svg"; import { Icon as RetryIcon } from "../../../../../res/img/compound/retry-16px.svg"; import { _t } from "../../../../languageHandler"; import { useTimeoutToggle } from "../../../../hooks/useTimeoutToggle"; import { ErrorMessage } from "../../ErrorMessage"; interface CheckEmailProps { email: string; errorText: string | ReactNode | null; onReEnterEmailClick: () => void; onResendClick: () => Promise; onSubmitForm: (ev: React.FormEvent) => void; } /** * This component renders the email verification view of the forgot password flow. */ export const CheckEmail: React.FC = ({ email, errorText, onReEnterEmailClick, onSubmitForm, onResendClick, }) => { const { toggle: toggleTooltipVisible, value: tooltipVisible } = useTimeoutToggle(false, 2500); const onResendClickFn = async (): Promise => { await onResendClick(); toggleTooltipVisible(); }; return ( <>

{_t("auth|uia|email_auth_header")}

{_t("auth|check_email_explainer", { email: email }, { b: (t) => {t} })}

{_t("auth|check_email_wrong_email_prompt")} {_t("auth|check_email_wrong_email_button")}
{errorText && }
{_t("auth|check_email_resend_prompt")} {_t("action|resend")}
); };