You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import React, { useEffect, useState } from "react";
  2. import PropTypes from "prop-types";
  3. import {
  4. MailSentContainer,
  5. Description,
  6. Footer,
  7. FooterText,
  8. FormContainer,
  9. SendAgainTextContainer,
  10. StandardText,
  11. Title,
  12. } from "./MailSent.styled";
  13. import { ReactComponent as MailSentImage } from "../../../assets/images/svg/mail-sent.svg";
  14. import { PrimaryButton } from "../../../components/Buttons/PrimaryButton/PrimaryButton";
  15. import { NavLink, useHistory, useLocation } from "react-router-dom";
  16. import Link from "../../../components/Link/Link";
  17. import { Trans, useTranslation } from "react-i18next";
  18. import { LOGIN_PAGE } from "../../../constants/pages";
  19. import selectedTheme from "../../../themes";
  20. import { useDispatch } from "react-redux";
  21. import { forgotPassword } from "../../../store/actions/user/userActions";
  22. const MailSent = () => {
  23. const [mail, setEmail] = useState("");
  24. const { t } = useTranslation();
  25. const history = useHistory();
  26. const location = useLocation();
  27. const dispatch = useDispatch();
  28. useEffect(() => {
  29. setEmail(location.state.email);
  30. }, []);
  31. const navigateLogin = () => {
  32. history.replace(LOGIN_PAGE);
  33. };
  34. const handleResend = () => {
  35. dispatch(forgotPassword({ email: mail }));
  36. };
  37. return (
  38. <MailSentContainer>
  39. <MailSentImage />
  40. <Title component="h1" variant="h5">
  41. {t("forgotPassword.mailSent")}
  42. </Title>
  43. <Description component="h1" variant="h6">
  44. {t("forgotPassword.mailSentDescription")}
  45. </Description>
  46. <FormContainer>
  47. <PrimaryButton
  48. type="submit"
  49. variant="contained"
  50. height="48px"
  51. fullWidth
  52. buttoncolor={selectedTheme.primaryPurple}
  53. textcolor="white"
  54. onClick={navigateLogin}
  55. >
  56. {t("login.logIn")}
  57. </PrimaryButton>
  58. <SendAgainTextContainer>
  59. <StandardText>{t("forgotPassword.notRecievedMail")}</StandardText>
  60. <Link
  61. to="#"
  62. component={NavLink}
  63. underline="hover"
  64. align="center"
  65. textsize="16px"
  66. onClick={handleResend}
  67. >
  68. {t("common.sendAgain")}
  69. </Link>
  70. </SendAgainTextContainer>
  71. </FormContainer>
  72. <Footer>
  73. <FooterText>
  74. <Trans i18nKey="forgotPassword.checkSpam" />
  75. </FooterText>
  76. </Footer>
  77. </MailSentContainer>
  78. );
  79. };
  80. MailSent.propTypes = {
  81. children: PropTypes.node,
  82. };
  83. export default MailSent;