From 89e91c6d8a37e5c5bc4410ca81bb0690cf788bf3 Mon Sep 17 00:00:00 2001
From: 6ea86b96 <6ea86b96@gmail.com>
Date: Fri, 5 May 2017 15:10:51 +0700
Subject: [PATCH] Add downloaded/published nav and comment out broken reward
code
---
ui/js/page/fileListDownloaded/view.jsx | 27 +++---
ui/js/page/fileListPublished/view.jsx | 118 ++++++-------------------
2 files changed, 38 insertions(+), 107 deletions(-)
diff --git a/ui/js/page/fileListDownloaded/view.jsx b/ui/js/page/fileListDownloaded/view.jsx
index cf95e0224..0a0a39b00 100644
--- a/ui/js/page/fileListDownloaded/view.jsx
+++ b/ui/js/page/fileListDownloaded/view.jsx
@@ -8,6 +8,7 @@ import rewards from 'rewards.js';
import lbryio from 'lbryio.js';
import {BusyMessage, Thumbnail} from 'component/common.js';
import FileList from 'component/fileList'
+import SubHeader from 'component/subHeader'
class FileListDownloaded extends React.Component {
render() {
@@ -17,25 +18,21 @@ class FileListDownloaded extends React.Component {
navigate,
} = this.props
+ let content
if (fetching) {
- return (
-
-
-
- );
+ content =
} else if (!downloadedContent.length) {
- return (
-
- You haven't downloaded anything from LBRY yet. Go navigate('discover')} label="search for your first download" />!
-
- );
+ content = You haven't downloaded anything from LBRY yet. Go navigate('discover')} label="search for your first download" />!
} else {
- return (
-
-
-
- );
+ content =
}
+
+ return (
+
+
+ {content}
+
+ )
}
}
diff --git a/ui/js/page/fileListPublished/view.jsx b/ui/js/page/fileListPublished/view.jsx
index 56d00003b..fd4470ee1 100644
--- a/ui/js/page/fileListPublished/view.jsx
+++ b/ui/js/page/fileListPublished/view.jsx
@@ -8,6 +8,7 @@ import rewards from 'rewards.js';
import lbryio from 'lbryio.js';
import {BusyMessage, Thumbnail} from 'component/common.js';
import FileList from 'component/fileList'
+import SubHeader from 'component/subHeader'
class FileListPublished extends React.Component {
componentDidUpdate() {
@@ -15,17 +16,20 @@ class FileListPublished extends React.Component {
}
_requestPublishReward() {
- lbryio.call('reward', 'list', {}).then(function(userRewards) {
- //already rewarded
- if (userRewards.filter(function (reward) {
- return reward.RewardType == rewards.TYPE_FIRST_PUBLISH && reward.TransactionID
- }).length) {
- return
- }
- else {
- rewards.claimReward(rewards.TYPE_FIRST_PUBLISH).catch(() => {})
- }
- })
+ // TODO this is throwing an error now
+ // Error: LBRY internal API is disabled
+ //
+ // lbryio.call('reward', 'list', {}).then(function(userRewards) {
+ // //already rewarded
+ // if (userRewards.filter(function (reward) {
+ // return reward.RewardType == rewards.TYPE_FIRST_PUBLISH && reward.TransactionID
+ // }).length) {
+ // return
+ // }
+ // else {
+ // rewards.claimReward(rewards.TYPE_FIRST_PUBLISH).catch(() => {})
+ // }
+ // })
}
render() {
@@ -35,92 +39,22 @@ class FileListPublished extends React.Component {
navigate,
} = this.props
+ let content
if (fetching) {
- return (
-
-
-
- );
+ content =
} else if (!publishedContent.length) {
- return (
-
- You haven't downloaded anything from LBRY yet. Go navigate('discover')} label="search for your first download" />!
-
- );
+ content = You haven't downloaded anything from LBRY yet. Go navigate('discover')} label="search for your first download" />!
} else {
- return (
-
-
-
- );
+ content =
}
+
+ return (
+
+
+ {content}
+
+ )
}
}
-// const FileListPublished = React.createClass({
-// _isMounted: false,
-
-// getInitialState: function () {
-// return {
-// fileInfos: null,
-// };
-// },
-// _requestPublishReward: function() {
-// lbryio.call('reward', 'list', {}).then(function(userRewards) {
-// //already rewarded
-// if (userRewards.filter(function (reward) {
-// return reward.RewardType == rewards.TYPE_FIRST_PUBLISH && reward.TransactionID;
-// }).length) {
-// return;
-// }
-// else {
-// rewards.claimReward(rewards.TYPE_FIRST_PUBLISH).catch(() => {})
-// }
-// });
-// },
-// componentDidMount: function () {
-// this._isMounted = true;
-// this._requestPublishReward();
-// document.title = "Published Files";
-
-// lbry.claim_list_mine().then((claimInfos) => {
-// if (!this._isMounted) { return; }
-
-// lbry.file_list().then((fileInfos) => {
-// if (!this._isMounted) { return; }
-
-// const myClaimOutpoints = claimInfos.map(({txid, nout}) => txid + ':' + nout);
-// this.setState({
-// fileInfos: fileInfos.filter(({outpoint}) => myClaimOutpoints.includes(outpoint)),
-// });
-// });
-// });
-// },
-// componentWillUnmount: function() {
-// this._isMounted = false;
-// },
-// render: function () {
-// if (this.state.fileInfos === null) {
-// return (
-//
-//
-//
-// );
-// }
-// else if (!this.state.fileInfos.length) {
-// return (
-//
-// You haven't published anything to LBRY yet. Try !
-//
-// );
-// }
-// else {
-// return (
-//
-//
-//
-// );
-// }
-// }
-// });
export default FileListPublished