// @flow import React, { useState } from 'react'; import { FormField, Form } from 'component/common/form'; import Button from 'component/button'; import { Lbryio } from 'lbryinc'; import analytics from 'analytics'; import { EMAIL_REGEX } from 'constants/email'; import I18nMessage from 'component/i18nMessage'; type Props = { errorMessage: ?string, isPending: boolean, addUserEmail: string => void, syncEnabled: boolean, setSync: boolean => void, balance: number, }; function UserEmailNew(props: Props) { const { errorMessage, isPending, addUserEmail, syncEnabled, setSync, balance } = props; const [newEmail, setEmail] = useState(''); const [ageConfirmation, setAgeConfirmation] = useState(false); const valid = newEmail.match(EMAIL_REGEX); function handleSubmit() { addUserEmail(newEmail); analytics.emailProvidedEvent(); // @if TARGET='web' Lbryio.call('user_tag', 'edit', { add: 'lbrytv' }); // @endif } React.useEffect(() => { // Sync currently doesn't work for wallets with balances if (syncEnabled && balance) { setSync(false); } }, [balance, syncEnabled, setSync]); return (

{__('Welcome To LBRY')}

{__('Create a new account or sign in.')}

setEmail(e.target.value)} />
), }} > I am over the age of 13 and agree to the %terms%. } checked={ageConfirmation} onChange={() => setAgeConfirmation(!ageConfirmation)} /> {!IS_WEB && ( 0 ? ( __('This feature is not yet available for wallets with balances, but the gerbils are working on it.') ) : ( ), }} > Blockchain expert? %learn_more% ) } checked={syncEnabled} onChange={() => setSync(!syncEnabled)} disabled={balance > 0} /> )}
); } export default UserEmailNew;