From bb161560349e906019b19993af6a21269e32bc09 Mon Sep 17 00:00:00 2001 From: Jeremy Kauffman Date: Fri, 19 May 2017 12:17:19 -0400 Subject: [PATCH] re-enable rewards --- ui/js/component/auth.js | 44 ++++++++++++++++------------------ ui/js/component/common.js | 12 +++++----- ui/js/component/modal-page.js | 2 ++ ui/js/component/reward-link.js | 1 + ui/js/lbryio.js | 2 +- ui/js/main.js | 8 +++---- 6 files changed, 35 insertions(+), 34 deletions(-) diff --git a/ui/js/component/auth.js b/ui/js/component/auth.js index 0ff99c26f..9e4a6ed54 100644 --- a/ui/js/component/auth.js +++ b/ui/js/component/auth.js @@ -125,6 +125,10 @@ class ConfirmEmailStage extends React.Component { } class WelcomeStage extends React.Component { + static propTypes = { + endAuth: React.PropTypes.func, + } + constructor(props) { super(props); @@ -169,31 +173,20 @@ class WelcomeStage extends React.Component { ); } } -WelcomeStage.propTypes = { - endAuth: React.PropTypes.func, -}; -class ErrorStage extends React.Component { - render() { - return ( -
-

An error was encountered that we cannot continue from.

-

At least we're earning the name beta.

- { this.props.errorText ?

Message: {this.props.errorText}

: '' } - { window.location.reload() } } /> -
- ); - } +const ErrorStage = (props) => { + return
+

An error was encountered that we cannot continue from.

+

At least we're earning the name beta.

+ { this.props.errorText ?

Message: {props.errorText}

: '' } + { window.location.reload() } } /> +
} -class PendingStage extends React.Component { - render() { - return ( -
-

Preparing for first access

-
- ); - } +const PendingStage = (props) => { + return
+

Preparing for first access

+
} @@ -315,9 +308,14 @@ export class AuthOverlay extends React.Component { return null; } const StageContent = this._stages[this.state.stage]; + + if (!StageContent) { + return Unknown authentication step. + } + return ( this.state.stage != "welcome" ? - +

LBRY Early Access

{ this.setStage(stage, stageProps) }} />
: diff --git a/ui/js/component/common.js b/ui/js/component/common.js index fc37c280a..c11e0d14c 100644 --- a/ui/js/component/common.js +++ b/ui/js/component/common.js @@ -9,15 +9,11 @@ export class Icon extends React.Component { fixed: React.PropTypes.bool, } - static defaultProps = { - lines: null - } - render() { - const {fixed, className, ...other} = this.props; + const {fixed, className} = this.props; const spanClassName = ('icon ' + ('fixed' in this.props ? 'icon-fixed-width ' : '') + this.props.icon + ' ' + (this.props.className || '')); - return + return } } @@ -26,6 +22,10 @@ export class TruncatedText extends React.Component { lines: React.PropTypes.number, } + static defaultProps = { + lines: null + } + render() { return {this.props.children}; } diff --git a/ui/js/component/modal-page.js b/ui/js/component/modal-page.js index 6a7f8ec5d..097829d45 100644 --- a/ui/js/component/modal-page.js +++ b/ui/js/component/modal-page.js @@ -14,3 +14,5 @@ export class ModalPage extends React.Component { ); } } + +export default ModalPage \ No newline at end of file diff --git a/ui/js/component/reward-link.js b/ui/js/component/reward-link.js index e9b511476..43d3d61e8 100644 --- a/ui/js/component/reward-link.js +++ b/ui/js/component/reward-link.js @@ -47,6 +47,7 @@ export class RewardLink extends React.Component { this.setState({ pending: true }) + rewards.claimReward(this.props.type).then((reward) => { this.setState({ pending: false, diff --git a/ui/js/lbryio.js b/ui/js/lbryio.js index 7c4b2a69c..f66d64817 100644 --- a/ui/js/lbryio.js +++ b/ui/js/lbryio.js @@ -7,7 +7,7 @@ const lbryio = { _accessToken: getLocal('accessToken'), _authenticationPromise: null, _user : null, - enabled: false + enabled: true }; const CONNECTION_STRING = 'https://api.lbry.io/'; diff --git a/ui/js/main.js b/ui/js/main.js index f9579804b..96cb02f13 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -3,10 +3,10 @@ import ReactDOM from 'react-dom'; import lbry from './lbry.js'; import lbryio from './lbryio.js'; import lighthouse from './lighthouse.js'; -import App from './component/app/index.js'; -import SplashScreen from './component/splash.js'; -import SnackBar from './component/snack-bar.js'; -import {AuthOverlay} from './component/auth.js'; +import App from 'component/app/index.js'; +import SplashScreen from 'component/splash.js'; +import SnackBar from 'component/snack-bar.js'; +import {AuthOverlay} from 'component/auth.js'; import { Provider } from 'react-redux'; import store from 'store.js'; import {