diff --git a/app/main.js b/app/main.js index e2fad0905..4b9a4664f 100644 --- a/app/main.js +++ b/app/main.js @@ -62,7 +62,7 @@ function getPidsForProcessName(name) { } function createWindow () { - win = new BrowserWindow({backgroundColor: '#155B4A', minWidth: 800, minHeight: 1000 }) //$color-primary + win = new BrowserWindow({backgroundColor: '#155B4A', minWidth: 800, minHeight: 600 }) //$color-primary win.maximize() win.webContents.openDevTools(); win.loadURL(`file://${__dirname}/dist/index.html`) diff --git a/ui/js/component/auth.js b/ui/js/component/auth.js index ace7c84df..197fc0b38 100644 --- a/ui/js/component/auth.js +++ b/ui/js/component/auth.js @@ -5,6 +5,7 @@ import Modal from './modal.js'; import ModalPage from './modal-page.js'; import {Link, RewardLink} from '../component/link.js'; import {FormField, FormRow} from '../component/form.js'; +import {CreditAmount} from '../component/common.js'; import rewards from '../rewards.js'; @@ -114,9 +115,10 @@ const WelcomeStage = React.createClass({ } }, onRewardClaim: function(reward) { + console.log(reward); this.setState({ hasReward: true, - rewardAmount: reward + rewardAmount: reward.amount }) }, render: function() { @@ -127,8 +129,8 @@ const WelcomeStage = React.createClass({

Welcome to LBRY.

Using LBRY is like dating a centaur. Totally normal up top, and way different underneath.

On the upper level, LBRY is like other popular video and media sites.

-

Below, LBRY is like nothing else. Using blockchain and decentralization, LBRY is controlled by its users -- you -- and no one else.

-

Thanks for being a part of it! Here's a nickel, kid.

+

Below, LBRY is controlled by its users -- you -- through the power of blockchain and decentralization.

+

Thanks for making it possible! Here's a nickel, kid.

@@ -137,8 +139,8 @@ const WelcomeStage = React.createClass({

About Your Reward

-

You earned a reward of %award% LBRY credits, or LBC.

-

This reward will show in your Wallet momentarily, likely while you are reading this message.

+

You earned a reward of LBRY credits, or LBC.

+

This reward will show in your Wallet momentarily, probably while you are reading this message.

LBC is used to compensate creators, to publish, and to have say in how the network works.

No need to understand it all just yet! Try watching or downloading something next.

diff --git a/ui/js/component/file-actions.js b/ui/js/component/file-actions.js index d16e61bab..fff8191e2 100644 --- a/ui/js/component/file-actions.js +++ b/ui/js/component/file-actions.js @@ -43,8 +43,6 @@ let FileActionsRow = React.createClass({ attemptingRemove: false }); lbry.getCostInfo(this.props.uri).then(({cost}) => { - console.log(cost); - console.log(this.props.uri); lbry.getBalance((balance) => { if (cost > balance) { this.setState({ diff --git a/ui/js/component/form.js b/ui/js/component/form.js index ef8a7169b..f75310c92 100644 --- a/ui/js/component/form.js +++ b/ui/js/component/form.js @@ -96,7 +96,7 @@ export let FormField = React.createClass({ export let FormRow = React.createClass({ _fieldRequiredText: 'This field is required', propTypes: { - label: React.PropTypes.string, + label: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.element]) // helper: React.PropTypes.html, }, getInitialState: function() { diff --git a/ui/js/component/link.js b/ui/js/component/link.js index 88e60bf7e..55c0060dd 100644 --- a/ui/js/component/link.js +++ b/ui/js/component/link.js @@ -92,20 +92,20 @@ export let RewardLink = React.createClass({ this.setState({ pending: true }) - rewards.claimReward(this.props.type).then(function(reward) { + rewards.claimReward(this.props.type).then((reward) => { this.setState({ pending: false, errorMessage: null }) if (this.props.onRewardClaim) { - this.props.onRewardClaim(); + this.props.onRewardClaim(reward); } - }.bind(this)).catch(function(error) { + }).catch((error) => { this.setState({ errorMessage: error.message, pending: false }) - }.bind(this)) + }) }, clearError: function() { if (this.props.onRewardFailure) { @@ -120,7 +120,8 @@ export let RewardLink = React.createClass({
{this.props.claimed ? Reward claimed. - : } + : } {this.state.errorMessage ? {this.state.errorMessage} diff --git a/ui/js/lbryio.js b/ui/js/lbryio.js index 06dbd46d9..53ba92f8a 100644 --- a/ui/js/lbryio.js +++ b/ui/js/lbryio.js @@ -6,7 +6,8 @@ const querystring = require('querystring'); const lbryio = { _accessToken: getLocal('accessToken'), _authenticationPromise: null, - _user : null + _user : null, + enabled: false }; const CONNECTION_STRING = 'http://localhost:8080/'; @@ -25,6 +26,10 @@ const mocks = { lbryio.call = function(resource, action, params={}, method='get') { return new Promise((resolve, reject) => { + if (!lbryio.enabled) { + reject(new Error("LBRY interal API is disabled")) + return + } /* temp code for mocks */ if (`${resource}.${action}` in mocks) { resolve(mocks[`${resource}.${action}`](params)); @@ -90,6 +95,14 @@ lbryio.setAccessToken = (token) => { } lbryio.authenticate = function() { + if (!lbryio.enabled) { + return new Promise((resolve, reject) => { + resolve({ + ID: 1, + HasVerifiedEmail: true + }) + }) + } if (lbryio._authenticationPromise === null) { lbryio._authenticationPromise = new Promise((resolve, reject) => { lbry.status().then(({installation_id}) => { diff --git a/ui/js/main.js b/ui/js/main.js index d31b4c7d5..610ca8594 100644 --- a/ui/js/main.js +++ b/ui/js/main.js @@ -30,8 +30,7 @@ let init = function() { function onDaemonReady() { window.sessionStorage.setItem('loaded', 'y'); //once we've made it here once per session, we don't need to show splash again - // - ReactDOM.render(
, canvas) + ReactDOM.render(
{ lbryio.enabled ? : '' }
, canvas) } if (window.sessionStorage.getItem('loaded') == 'y') { diff --git a/ui/js/page/discover.js b/ui/js/page/discover.js index b3d427cfe..8aadd2df4 100644 --- a/ui/js/page/discover.js +++ b/ui/js/page/discover.js @@ -81,6 +81,7 @@ var FeaturedContent = React.createClass({ getInitialState: function() { return { featuredUris: {}, + failed: false }; }, componentWillMount: function() { @@ -92,19 +93,25 @@ var FeaturedContent = React.createClass({ } }) this.setState({ featuredUris: featuredUris }); + }, () => { + this.setState({ + failed: true + }) }); }, render: function() { return ( -
- { - Object.keys(this.state.featuredUris).map(function(category) { - return this.state.featuredUris[category].length ? - : - ''; - }.bind(this)) - } -
+ this.state.failed ? +
Failed to load landing content.
: +
+ { + Object.keys(this.state.featuredUris).map(function(category) { + return this.state.featuredUris[category].length ? + : + ''; + }.bind(this)) + } +
); } }); diff --git a/ui/js/page/publish.js b/ui/js/page/publish.js index ea3bdb00e..3dfc8ac1e 100644 --- a/ui/js/page/publish.js +++ b/ui/js/page/publish.js @@ -27,7 +27,7 @@ var PublishPage = React.createClass({ // Calls API to update displayed list of channels. If a channel name is provided, will select // that channel at the same time (used immediately after creating a channel) lbry.channel_list_mine().then((channels) => { - rewards.claimReward(rewards.TYPE_FIRST_CHANNEL) + rewards.claimReward(rewards.TYPE_FIRST_CHANNEL).then(() => {}, () => {}) this.setState({ channels: channels, ... channel ? {channel} : {} diff --git a/ui/js/page/rewards.js b/ui/js/page/rewards.js index 62c5d0497..18e936aee 100644 --- a/ui/js/page/rewards.js +++ b/ui/js/page/rewards.js @@ -42,6 +42,7 @@ var RewardsPage = React.createClass({ getInitialState: function() { return { userRewards: null, + failed: null }; }, loadRewards: function() { @@ -49,6 +50,8 @@ var RewardsPage = React.createClass({ this.setState({ userRewards: userRewards, }); + }, () => { + this.setState({failed: true }) }); }, render: function() { @@ -56,7 +59,7 @@ var RewardsPage = React.createClass({
{!this.state.userRewards - ? null + ? (this.state.failed ?
Failed to load rewards.
: '') : this.state.userRewards.map(({RewardType, RewardTitle, RewardDescription, TransactionID, RewardAmount}) => { return ; })} diff --git a/ui/js/page/show.js b/ui/js/page/show.js index a488bb4a2..5ad238ae8 100644 --- a/ui/js/page/show.js +++ b/ui/js/page/show.js @@ -83,8 +83,7 @@ let ShowPage = React.createClass({ const metadata = this.state.uriLookupComplete ? this.state.metadata : null, title = this.state.uriLookupComplete ? metadata.title : this._uri; - - console.log(metadata); + return (
diff --git a/ui/js/page/watch.js b/ui/js/page/watch.js index 3e3d163dc..833cd5775 100644 --- a/ui/js/page/watch.js +++ b/ui/js/page/watch.js @@ -3,6 +3,7 @@ import {Icon, Thumbnail} from '../component/common.js'; import {Link} from '../component/link.js'; import lbry from '../lbry.js'; import Modal from '../component/modal.js'; +import lbryio from '../lbryio.js'; import LoadScreen from '../component/load_screen.js' const fs = require('fs'); @@ -25,6 +26,12 @@ export let WatchLink = React.createClass({ attemptingDownload: false, }); } + + lbryio.call('file', 'view', { + uri: this.props.uri, + outpoint: streamInfo.outpoint, + claimId: streamInfo.claim_id + }) }); if (this.props.onGet) { this.props.onGet() diff --git a/ui/js/rewards.js b/ui/js/rewards.js index ec043de02..8b66ce371 100644 --- a/ui/js/rewards.js +++ b/ui/js/rewards.js @@ -24,6 +24,10 @@ rewards.TYPE_NEW_DEVELOPER = "new_developer", rewards.claimReward = function (type) { function requestReward(resolve, reject, params) { + if (!lbryio.enabled) { + reject(new Error("Rewards are not enabled.")) + return; + } lbryio.call('reward', 'new', params, 'post').then(({RewardAmount}) => { const message = rewardMessage(type, RewardAmount),