Redux #115
2 changed files with 38 additions and 107 deletions
|
@ -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 (
|
||||
<main className="page">
|
||||
<BusyMessage message="Loading" />
|
||||
</main>
|
||||
);
|
||||
content = <BusyMessage message="Loading" />
|
||||
} else if (!downloadedContent.length) {
|
||||
return (
|
||||
<main className="page">
|
||||
<span>You haven't downloaded anything from LBRY yet. Go <Link href="#" onClick={() => navigate('discover')} label="search for your first download" />!</span>
|
||||
</main>
|
||||
);
|
||||
content = <span>You haven't downloaded anything from LBRY yet. Go <Link href="#" onClick={() => navigate('discover')} label="search for your first download" />!</span>
|
||||
} else {
|
||||
content = <FileList fileInfos={downloadedContent} hidePrices={true} />
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="page">
|
||||
<FileList fileInfos={downloadedContent} hidePrices={true} />
|
||||
<SubHeader />
|
||||
{content}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 (
|
||||
<main className="page">
|
||||
<BusyMessage message="Loading" />
|
||||
</main>
|
||||
);
|
||||
content = <BusyMessage message="Loading" />
|
||||
} else if (!publishedContent.length) {
|
||||
return (
|
||||
<main className="page">
|
||||
<span>You haven't downloaded anything from LBRY yet. Go <Link href="#" onClick={() => navigate('discover')} label="search for your first download" />!</span>
|
||||
</main>
|
||||
);
|
||||
content = <span>You haven't downloaded anything from LBRY yet. Go <Link href="#" onClick={() => navigate('discover')} label="search for your first download" />!</span>
|
||||
} else {
|
||||
content = <FileList fileInfos={publishedContent} hidePrices={true} />
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="page">
|
||||
<FileList fileInfos={publishedContent} hidePrices={true} />
|
||||
<SubHeader />
|
||||
{content}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
// 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 (
|
||||
// <main className="page">
|
||||
// <BusyMessage message="Loading" />
|
||||
// </main>
|
||||
// );
|
||||
// }
|
||||
// else if (!this.state.fileInfos.length) {
|
||||
// return (
|
||||
// <main className="page">
|
||||
// <span>You haven't published anything to LBRY yet.</span> Try <Link href="?publish" label="publishing" />!
|
||||
// </main>
|
||||
// );
|
||||
// }
|
||||
// else {
|
||||
// return (
|
||||
// <main className="page">
|
||||
// <FileList fileInfos={this.state.fileInfos} />
|
||||
// </main>
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
export default FileListPublished
|
||||
|
|
Loading…
Reference in a new issue