Use lbry.search() to fetch costs

This commit is contained in:
Alex Liebowitz 2016-08-18 03:34:20 -04:00
parent 1a66fafd2d
commit 4c01cf4259
3 changed files with 9 additions and 15 deletions

View file

@ -73,7 +73,7 @@ var CreditAmount = React.createClass({
var formattedAmount = lbry.formatCredits(this.props.amount);
return (
<span className="credit-amount">
<span style={creditAmountStyle}>{formattedAmount}</span>
<span style={creditAmountStyle}>{formattedAmount} credits</span>
{ this.props.isEstimate ? <span style={estimateStyle}>(est)</span> : null }
</span>
);

View file

@ -123,17 +123,15 @@ var FeaturedContentItem = React.createClass({
},
componentWillMount: function() {
lbry.resolveName(this.props.name, (metadata) => {
lbry.search(this.props.name, (results) => {
var result = results[0];
var metadata = result.value;
this.setState({
metadata: metadata,
amount: result.cost,
title: metadata && metadata.title ? metadata.title : ('lbry://' + this.props.name),
})
});
lbry.getCostEstimate(this.props.name, (amount) => {
this.setState({
amount: amount,
});
});
},
render: function() {

View file

@ -106,18 +106,14 @@ var DetailPage = React.createClass({
componentWillMount: function() {
document.title = 'lbry://' + this.props.name;
lbry.getClaimInfo(this.props.name, (claimInfo) => {
lbry.search(this.props.name, (results) => {
var result = results[0];
this.setState({
claimInfo: claimInfo.value,
amount: result.amount,
claimInfo: result.value,
searching: false,
});
});
lbry.getCostEstimate(this.props.name, (amount) => {
this.setState({
amount: amount,
});
});
},
render: function() {
if (this.state.claimInfo == null && this.state.searching) {