<commit_before>import { useEffect, useState } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import { c } from 'ttag';
import { FullLoader, GenericError, useApi, useLoading } from '@proton/components';
import { postVerifyValidate } from '@proton/shared/lib/api/verify';

import PublicLayout from '../components/PublicLayout';

const ValidateRecoveryEmailContainer = () => {
    const api = useApi();
    const [error, setError] = useState<any>();
    const [loading, withLoading] = useLoading(true);
    const location = useLocation();
    const history = useHistory();

    useEffect(() => {
        const jwt = location.hash.substring(1);

        history.replace(location.pathname);

        withLoading(api({ ...postVerifyValidate({ JWT: jwt }), silence: true }).catch(setError));
    }, []);

    const signIn = (
        <a key="1" href="/login" target="_self">
            {c('Action').t`sign in`}
        </a>
    );

    if (error) {
        return (
            <GenericError>
                <span>{c('Recovery Email').t`There was a problem verifying your email address.`}</span>
                <span>{c('Recovery Email').jt`Please ${signIn} to resend a recovery email verification request.`}</span>
            </GenericError>
        );
    }

    return (
        <main className="main-area">
            {loading ? (
                <div className="absolute-center text-center">
                    <FullLoader size={200} />
                </div>
            ) : (
                <PublicLayout
                    main={c('Recovery Email').jt`Your recovery email has been successfully verified.`}
                    footer={c('Recovery Email').jt`You can safely close this tab.`}
                    below={c('Recovery Email').jt`Back to ${signIn}.`}
                />
            )}
        </main>
    );<commit_msg>Point link to "/switch" after successful recovery email verification<commit_after>import { useEffect, useState } from 'react';
import { useHistory, useLocation } from 'react-router-dom';
import { c } from 'ttag';
import { FullLoader, GenericError, useApi, useLoading } from '@proton/components';
import { postVerifyValidate } from '@proton/shared/lib/api/verify';

import PublicLayout from '../components/PublicLayout';

const ValidateRecoveryEmailContainer = () => {
    const api = useApi();
    const [error, setError] = useState<any>();
    const [loading, withLoading] = useLoading(true);
    const location = useLocation();
    const history = useHistory();

    useEffect(() => {
        const jwt = location.hash.substring(1);

        history.replace(location.pathname);

        withLoading(api({ ...postVerifyValidate({ JWT: jwt }), silence: true }).catch(setError));
    }, []);

    const signIn = (
        <a key="1" href="/switch" target="_self">
            {c('Action').t`sign in`}
        </a>
    );

    if (error) {
        return (
            <GenericError>
                <span>{c('Recovery Email').t`There was a problem verifying your email address.`}</span>
                <span>{c('Recovery Email')
                    .jt`Please ${signIn} to resend a recovery email verification request.`}</span>
            </GenericError>
        );
    }

    return (
        <main className="main-area">
            {loading ? (
                <div className="absolute-center text-center">
                    <FullLoader size={200} />
                </div>
            ) : (
                <PublicLayout
                    main={c('Recovery Email').jt`Your recovery email has been successfully verified.`}
                    footer={c('Recovery Email').jt`You can safely close this tab.`}
                    below={c('Recovery Email').jt`Back to ${signIn}.`}
                />
            )}
        </main>
    );
{'fraction_non_alphanumeric': 0.14473338586813764, 'fraction_numerical': 0.002626740215392698, 'mean_word_length': 2.1601659751037343, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5045234', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1017, 'n_words': 257}