mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-02 18:25:12 +00:00
Use lbry.search() to fetch costs
This commit is contained in:
parent
1a66fafd2d
commit
4c01cf4259
3 changed files with 9 additions and 15 deletions
|
@ -73,7 +73,7 @@ var CreditAmount = React.createClass({
|
||||||
var formattedAmount = lbry.formatCredits(this.props.amount);
|
var formattedAmount = lbry.formatCredits(this.props.amount);
|
||||||
return (
|
return (
|
||||||
<span className="credit-amount">
|
<span className="credit-amount">
|
||||||
<span style={creditAmountStyle}>{formattedAmount}</span>
|
<span style={creditAmountStyle}>{formattedAmount} credits</span>
|
||||||
{ this.props.isEstimate ? <span style={estimateStyle}>(est)</span> : null }
|
{ this.props.isEstimate ? <span style={estimateStyle}>(est)</span> : null }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
|
|
|
@ -123,17 +123,15 @@ var FeaturedContentItem = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
lbry.resolveName(this.props.name, (metadata) => {
|
lbry.search(this.props.name, (results) => {
|
||||||
|
var result = results[0];
|
||||||
|
var metadata = result.value;
|
||||||
this.setState({
|
this.setState({
|
||||||
metadata: metadata,
|
metadata: metadata,
|
||||||
|
amount: result.cost,
|
||||||
title: metadata && metadata.title ? metadata.title : ('lbry://' + this.props.name),
|
title: metadata && metadata.title ? metadata.title : ('lbry://' + this.props.name),
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
lbry.getCostEstimate(this.props.name, (amount) => {
|
|
||||||
this.setState({
|
|
||||||
amount: amount,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function() {
|
render: function() {
|
||||||
|
|
|
@ -106,18 +106,14 @@ var DetailPage = React.createClass({
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
document.title = 'lbry://' + this.props.name;
|
document.title = 'lbry://' + this.props.name;
|
||||||
|
|
||||||
lbry.getClaimInfo(this.props.name, (claimInfo) => {
|
lbry.search(this.props.name, (results) => {
|
||||||
|
var result = results[0];
|
||||||
this.setState({
|
this.setState({
|
||||||
claimInfo: claimInfo.value,
|
amount: result.amount,
|
||||||
|
claimInfo: result.value,
|
||||||
searching: false,
|
searching: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
lbry.getCostEstimate(this.props.name, (amount) => {
|
|
||||||
this.setState({
|
|
||||||
amount: amount,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
if (this.state.claimInfo == null && this.state.searching) {
|
if (this.state.claimInfo == null && this.state.searching) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue