diff --git a/package.json b/package.json index c5ba594fe..0edec7dca 100644 --- a/package.json +++ b/package.json @@ -114,7 +114,7 @@ "react-bootstrap-icons": "1.0.0", "react-copy-to-clipboard": "5.0.2", "react-countdown": "2.3.1", - "react-dev-utils": "^10.2.1", + "react-dev-utils": "^11.0.4", "react-dom": "16.13.0", "react-helmet-async": "1.0.4", "react-i18next": "11.3.4", diff --git a/src/app/components/NotificationForm/NotificationFormContainer/index.tsx b/src/app/components/NotificationForm/NotificationFormContainer/index.tsx index b4e2a13b4..080a61d40 100644 --- a/src/app/components/NotificationForm/NotificationFormContainer/index.tsx +++ b/src/app/components/NotificationForm/NotificationFormContainer/index.tsx @@ -20,18 +20,9 @@ export function NotificationForm() { const mailSrv = backendUrl[currentChainId]; const walletAddress = useAccount(); - const emptyUser = { - user_address: '', - email: '', - name: '', - first_transaction: '', - marketing: true, - notifications: true, - referred_by: '', - }; const [response, setResponse] = useState(''); - const [foundUser, setFoundUser] = useState(emptyUser); + const [userExists, setUserExists] = useState(false); const [loading, setLoading] = useState(true); const [showForm, setShowForm] = useState(false); @@ -59,15 +50,6 @@ export function NotificationForm() { } }; - //SET VALUES IN UPDATE FORM - useEffect(() => { - if (foundUser && foundUser.email && foundUser.name) { - dispatch({ field: 'name', value: foundUser.name }); - dispatch({ field: 'email', value: foundUser.email }); - dispatch({ field: 'marketing', value: foundUser.marketing }); - } - }, [foundUser]); - //UPDATE OR ADD USER const addUser = (e, formType) => { e.preventDefault(); @@ -113,26 +95,16 @@ export function NotificationForm() { walletAddress: walletAddress, }) .then(res => { - setFoundUser(res.data[0]); + setUserExists(res.data.found); + console.log('User exists: ' + userExists); setLoading(false); }) .catch(e => { console.log(e); setLoading(false); }); - } else { - setFoundUser({ - user_address: '', - email: '', - name: '', - first_transaction: '', - marketing: true, - notifications: true, - referred_by: '', - }); - setLoading(false); } - }, [mailSrv, walletAddress]); + }, [mailSrv, walletAddress, userExists]); //GET USER useEffect(() => { @@ -145,6 +117,8 @@ export function NotificationForm() { setResponse(''); getUser(); setLoading(false); + state.name = ''; + state.email = ''; } return ( @@ -152,7 +126,7 @@ export function NotificationForm() {
)} - {response === 'success' && !foundUser && ( + {response === 'success' && !userExists && (
{t(translations.notificationFormContainer.updated_success)}
)} - {response === 'success' && foundUser && ( + {response === 'success' && userExists && (
{t( translations.notificationFormContainer diff --git a/src/app/containers/MarketingPage/Loadable.tsx b/src/app/containers/MarketingPage/Loadable.tsx new file mode 100644 index 000000000..dab4b1386 --- /dev/null +++ b/src/app/containers/MarketingPage/Loadable.tsx @@ -0,0 +1,15 @@ +/** + * + * Asynchronously loads the component for MarketingPage + * + */ + +import React from 'react'; +import { lazyLoad } from 'utils/loadable'; +import { PageSkeleton } from 'app/components/PageSkeleton'; + +export const MarketingPage = lazyLoad( + () => import('./index'), + module => module.MarketingPage, + { fallback: }, +); diff --git a/src/app/containers/MarketingPage/index.tsx b/src/app/containers/MarketingPage/index.tsx new file mode 100644 index 000000000..09b69188b --- /dev/null +++ b/src/app/containers/MarketingPage/index.tsx @@ -0,0 +1,35 @@ +/** + * + * EmailOptInSuccessPage + * + */ + +import React from 'react'; +import { Helmet } from 'react-helmet-async'; +import { useTranslation } from 'react-i18next'; + +import { translations } from 'locales/i18n'; + +import { Header } from 'app/components/Header'; +import { Footer } from '../../components/Footer'; + +const s = translations.tradingPage; + +export function MarketingPage() { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const { t } = useTranslation(); + + return ( + <> + + {t(s.meta.title)} + + +
+
+

Marketing Page

+
+