format code

This commit is contained in:
Sean Yesmunt 2019-11-14 09:34:55 -05:00
parent 7ae4c3301d
commit 1b62fe8a5a
2 changed files with 56 additions and 48 deletions

View file

@ -18,7 +18,7 @@ import { IS_MAC } from 'component/app/view';
type Props = { type Props = {
balance: string, balance: string,
roundedBalance: number, roundedBalance: number,
history: { push: string => void, goBack: () => void, goForward: () => void }, history: { push: string => void, goBack: () => void, goForward: () => void, location: { pathname: string } },
currentTheme: string, currentTheme: string,
automaticDarkModeEnabled: boolean, automaticDarkModeEnabled: boolean,
setClientSetting: (string, boolean | string) => void, setClientSetting: (string, boolean | string) => void,
@ -49,9 +49,7 @@ const Header = (props: Props) => {
// Sign out if they click the "x" when they are on the password prompt // Sign out if they click the "x" when they are on the password prompt
const authHeaderAction = syncError ? { onClick: signOut } : { navigate: '/' }; const authHeaderAction = syncError ? { onClick: signOut } : { navigate: '/' };
const homeButtonNavigationProps = isVerifyPage ? const homeButtonNavigationProps = isVerifyPage ? {} : authHeader ? authHeaderAction : { navigate: '/' };
{ } :
authHeader ? authHeaderAction : { navigate: '/' };
const closeButtonNavigationProps = authHeader ? authHeaderAction : { onClick: () => history.goBack() }; const closeButtonNavigationProps = authHeader ? authHeaderAction : { onClick: () => history.goBack() };
function handleThemeToggle() { function handleThemeToggle() {
@ -188,7 +186,8 @@ const Header = (props: Props) => {
<Button navigate={`/$/${PAGES.AUTH}`} button="primary" label={__('Sign In')} /> <Button navigate={`/$/${PAGES.AUTH}`} button="primary" label={__('Sign In')} />
)} )}
</div> </div>
) : (!isVerifyPage && ) : (
!isVerifyPage && (
<div className="header__menu"> <div className="header__menu">
{/* Add an empty span here so we can use the same style as above */} {/* Add an empty span here so we can use the same style as above */}
{/* This pushes the close button to the right side */} {/* This pushes the close button to the right side */}
@ -197,6 +196,7 @@ const Header = (props: Props) => {
<Button icon={ICONS.REMOVE} {...closeButtonNavigationProps} /> <Button icon={ICONS.REMOVE} {...closeButtonNavigationProps} />
</Tooltip> </Tooltip>
</div> </div>
)
)} )}
</div> </div>
</header> </header>

View file

@ -2,18 +2,21 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { withRouter } from 'react-router'; import { withRouter } from 'react-router';
import Page from 'component/page'; import Page from 'component/page';
import ReCAPTCHA from "react-google-recaptcha"; import ReCAPTCHA from 'react-google-recaptcha';
import Button from 'component/button'; import Button from 'component/button';
import { Lbryio } from 'lbryinc'; import { Lbryio } from 'lbryinc';
import * as PAGES from 'constants/pages'; import * as PAGES from 'constants/pages';
type Props = { type Props = {
history: { push: string => void }, history: { push: string => void, location: { search: string } },
doToast: ({}) => void doToast: ({}) => void,
}; };
function SignInVerifyPage(props: Props) { function SignInVerifyPage(props: Props) {
const { history: { push }, doToast } = props; const {
history: { push, location },
doToast,
} = props;
const urlParams = new URLSearchParams(location.search); const urlParams = new URLSearchParams(location.search);
const authToken = urlParams.get('auth_token'); const authToken = urlParams.get('auth_token');
const userSubmittedEmail = urlParams.get('email'); const userSubmittedEmail = urlParams.get('email');
@ -53,9 +56,13 @@ function SignInVerifyPage(props: Props) {
return ( return (
<Page authPage className="main--auth-page"> <Page authPage className="main--auth-page">
<section className="main--contained"> <section className="main--contained">
<h1 className="section__title--large">{isAuthenticationSuccess ? __('Sign In Success!') : __('Sign In to lbry.tv') }</h1> <h1 className="section__title--large">
<p className="section__subtitle">{ isAuthenticationSuccess ? __('You can now close this tab.') : __('Click below to sign in to lbry.tv') }</p> {isAuthenticationSuccess ? __('Sign In Success!') : __('Sign In to lbry.tv')}
{ !isAuthenticationSuccess && </h1>
<p className="section__subtitle">
{isAuthenticationSuccess ? __('You can now close this tab.') : __('Click below to sign in to lbry.tv')}
</p>
{!isAuthenticationSuccess && (
<div className="section__actions"> <div className="section__actions">
<ReCAPTCHA <ReCAPTCHA
sitekey="6LePsJgUAAAAAFTuWOKRLnyoNKhm0HA4C3elrFMG" sitekey="6LePsJgUAAAAAFTuWOKRLnyoNKhm0HA4C3elrFMG"
@ -63,10 +70,11 @@ function SignInVerifyPage(props: Props) {
onExpired={onAuthError} onExpired={onAuthError}
onErrored={onAuthError} onErrored={onAuthError}
/> />
</div>} </div>
)}
</section> </section>
</Page> </Page>
); );
}; }
export default withRouter(SignInVerifyPage); export default withRouter(SignInVerifyPage);