lbry.tv account copy changes

This commit is contained in:
Sean Yesmunt 2019-11-13 13:14:19 -05:00
parent 486f15eba1
commit da10296132
12 changed files with 84 additions and 43 deletions

View file

@ -1,6 +1,6 @@
{ {
"linters": { "linters": {
"src/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"], "ui/**/*.{js,jsx,scss,json}": ["prettier --write", "git add"],
"src/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"] "ui/**/*.{js,jsx}": ["eslint", "flow focus-check --color always", "git add"]
} }
} }

View file

@ -113,6 +113,7 @@
"eslint-plugin-promise": "^4.0.1", "eslint-plugin-promise": "^4.0.1",
"eslint-plugin-react": "^7.7.0", "eslint-plugin-react": "^7.7.0",
"eslint-plugin-react-hooks": "^1.6.0", "eslint-plugin-react-hooks": "^1.6.0",
"eslint-plugin-standard": "^4.0.1",
"file-loader": "^4.2.0", "file-loader": "^4.2.0",
"flow-bin": "^0.97.0", "flow-bin": "^0.97.0",
"flow-typed": "^2.3.0", "flow-typed": "^2.3.0",

View file

@ -0,0 +1,12 @@
import { connect } from 'react-redux';
import { selectUnclaimedRewardValue } from 'lbryinc';
import RewardAuthIntro from './view';
const select = state => ({
totalRewardValue: selectUnclaimedRewardValue(state),
});
export default connect(
select,
null
)(RewardAuthIntro);

View file

@ -0,0 +1,35 @@
// @flow
import React from 'react';
import CreditAmount from 'component/common/credit-amount';
import Button from 'component/button';
import Card from 'component/common/card';
import I18nMessage from 'component/i18nMessage';
type Props = {
balance: number,
totalRewardValue: number,
};
function RewardAuthIntro(props: Props) {
const { totalRewardValue } = props;
const totalRewardRounded = Math.floor(totalRewardValue / 10) * 10;
return (
<Card
title={__('Sign In to lbry.tv to Earn Rewards')}
subtitle={
<I18nMessage
tokens={{
credit_amount: <CreditAmount inheritStyle amount={totalRewardRounded} />,
}}
>
A lbry.tv account allows you to earn more than %credit_amount% in rewards, backup your data, and get content
and security updates.
</I18nMessage>
}
actions={<Button button="primary" navigate="/$/rewards" label={__('Unlock Rewards')} />}
/>
);
}
export default RewardAuthIntro;

View file

@ -35,10 +35,14 @@ function UserEmail(props: Props) {
return ( return (
<Card <Card
title={__('Email')} title={__('lbry.tv Account')}
subtitle={__( subtitle={
'This information is disclosed only to LBRY, Inc. and not to the LBRY network. It is only required to save account information and earn rewards.' isVerified
)} ? undefined
: __(
'Creating a lbry.tv account will allow you to earn rewards, receive content and security updates, and optionally backup your data.'
)
}
actions={ actions={
isVerified ? ( isVerified ? (
<FormField <FormField
@ -59,7 +63,7 @@ function UserEmail(props: Props) {
value={email || ''} value={email || ''}
/> />
) : ( ) : (
<Button button="primary" label={__('Add Email')} navigate={`/$/${PAGES.AUTH}`} /> <Button button="primary" label={__('Sign In')} navigate={`/$/${PAGES.AUTH}`} />
) )
} }
/> />

View file

@ -29,8 +29,15 @@ function UserEmailNew(props: Props) {
return ( return (
<React.Fragment> <React.Fragment>
<h1 className="section__title--large">{__('Sign In to LBRY')}</h1> <h1 className="section__title--large">{__('Sign In to lbry.tv')}</h1>
<p className="section__subtitle">{__('Create a new account or sign in.')}</p> <p className="section__subtitle">
{/* @if TARGET='web' */}
{__('Create a new account or sign in.')}
{/* @endif */}
{/* @if TARGET='app' */}
{__('An account with lbry.tv allows you to earn rewards and backup your data.')}
{/* @endif */}
</p>
<Form onSubmit={handleSubmit} className="section__body"> <Form onSubmit={handleSubmit} className="section__body">
<FormField <FormField
autoFocus autoFocus
@ -49,7 +56,7 @@ function UserEmailNew(props: Props) {
name="sync_checkbox" name="sync_checkbox"
label={ label={
<React.Fragment> <React.Fragment>
{__('Sync balance and preferences across devices.')}{' '} {__('Backup your account and wallet data.')}{' '}
<Button button="link" href="https://lbry.com/faq/account-sync" label={__('Learn More')} /> <Button button="link" href="https://lbry.com/faq/account-sync" label={__('Learn More')} />
</React.Fragment> </React.Fragment>
} }

View file

@ -142,7 +142,7 @@ class FilePage extends React.Component<Props> {
{__( {__(
'The publisher has chosen to charge LBC to view this content. Your balance is currently too low to view it.' 'The publisher has chosen to charge LBC to view this content. Your balance is currently too low to view it.'
)}{' '} )}{' '}
{__('Checkout')} <Button button="link" navigate="/$/rewards" label={__('the rewards page')} />{' '} {__('Check out')} <Button button="link" navigate="/$/rewards" label={__('the rewards page')} />{' '}
{__('or send more LBC to your wallet.')} {__('or send more LBC to your wallet.')}
</div> </div>
)} )}

View file

@ -4,8 +4,7 @@ import PublishForm from 'component/publishForm';
import Page from 'component/page'; import Page from 'component/page';
import Yrbl from 'component/yrbl'; import Yrbl from 'component/yrbl';
import LbcSymbol from 'component/common/lbc-symbol'; import LbcSymbol from 'component/common/lbc-symbol';
import CreditAmount from 'component/common/credit-amount'; import RewardAuthIntro from 'component/rewardAuthIntro';
import Button from 'component/button';
type Props = { type Props = {
balance: number, balance: number,
@ -13,8 +12,7 @@ type Props = {
}; };
function PublishPage(props: Props) { function PublishPage(props: Props) {
const { balance, totalRewardValue } = props; const { balance } = props;
const totalRewardRounded = Math.floor(totalRewardValue / 10) * 10;
function scrollToTop() { function scrollToTop() {
const mainContent = document.querySelector('main'); const mainContent = document.querySelector('main');
@ -50,17 +48,7 @@ function PublishPage(props: Props) {
</Fragment> </Fragment>
} }
/> />
<section className="card card--section"> <RewardAuthIntro />
<h1 className="card__title">{__('LBRY Credits Required')}</h1>
<p className="card__subtitle">
{__(' There are a variety of ways to get credits, including more than')}{' '}
<CreditAmount inheritStyle amount={totalRewardRounded} />{' '}
{__('in free rewards for participating in the LBRY beta.')}
</p>
<div className="card__actions">
<Button button="link" navigate="/$/rewards" label={__('Checkout the rewards')} />
</div>
</section>
</Fragment> </Fragment>
)} )}
<PublishForm scrollToTop={scrollToTop} disabled={balance === 0} /> <PublishForm scrollToTop={scrollToTop} disabled={balance === 0} />

View file

@ -1,14 +1,13 @@
// @flow // @flow
import * as PAGES from 'constants/pages';
import React, { PureComponent, Fragment } from 'react'; import React, { PureComponent, Fragment } from 'react';
import BusyIndicator from 'component/common/busy-indicator'; import BusyIndicator from 'component/common/busy-indicator';
import RewardListClaimed from 'component/rewardListClaimed'; import RewardListClaimed from 'component/rewardListClaimed';
import RewardTile from 'component/rewardTile'; import RewardTile from 'component/rewardTile';
import Button from 'component/button'; import Button from 'component/button';
import Page from 'component/page'; import Page from 'component/page';
import Card from 'component/common/card';
import classnames from 'classnames'; import classnames from 'classnames';
import { rewards as REWARD_TYPES } from 'lbryinc'; import { rewards as REWARD_TYPES } from 'lbryinc';
import RewardAuthIntro from 'component/rewardAuthIntro';
type Props = { type Props = {
doAuth: () => void, doAuth: () => void,
@ -38,21 +37,7 @@ class RewardsPage extends PureComponent<Props> {
if (user && !user.is_reward_approved && rewardsEnabled) { if (user && !user.is_reward_approved && rewardsEnabled) {
if (!user.primary_email || !user.has_verified_email || !user.is_identity_verified) { if (!user.primary_email || !user.has_verified_email || !user.is_identity_verified) {
return ( return <RewardAuthIntro />;
<Card
title={__('Sign In To Unlock Rewards')}
subtitle={__(
'This is optional. You can continue to use this app without rewards, but LBC may be needed for some tasks.'
)}
actions={
<Button
navigate={`/$/${PAGES.AUTH}?redirect=/$/${PAGES.REWARDS}`}
button="primary"
label={__('Unlock Rewards')}
/>
}
/>
);
} }
return ( return (
<section className="card card--section"> <section className="card card--section">

View file

@ -57,6 +57,7 @@
} }
.section__subtitle { .section__subtitle {
font-size: var(--font-body);
color: $lbry-gray-5; color: $lbry-gray-5;
} }

View file

@ -44,6 +44,9 @@ h6 {
p { p {
font-size: var(--font-body); font-size: var(--font-body);
&:not(:last-child) {
margin-bottom: var(--spacing-small);
}
} }
ul, ul,

View file

@ -4504,6 +4504,11 @@ eslint-plugin-react@^7.7.0:
prop-types "^15.7.2" prop-types "^15.7.2"
resolve "^1.10.1" resolve "^1.10.1"
eslint-plugin-standard@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/eslint-plugin-standard/-/eslint-plugin-standard-4.0.1.tgz#ff0519f7ffaff114f76d1bd7c3996eef0f6e20b4"
integrity sha512-v/KBnfyaOMPmZc/dmc6ozOdWqekGp7bBGq4jLAecEfPGmfKiWS4sA8sC0LqiV9w5qmXAtXVn4M3p1jSyhY85SQ==
eslint-scope@3.7.1: eslint-scope@3.7.1:
version "3.7.1" version "3.7.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8"