mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-28 16:01:26 +00:00
Show: use new Lighthouse cost reporting
This commit is contained in:
parent
06de4534cd
commit
8b781694f2
1 changed files with 14 additions and 19 deletions
|
@ -116,30 +116,25 @@ var DetailPage = React.createClass({
|
||||||
return {
|
return {
|
||||||
metadata: null,
|
metadata: null,
|
||||||
cost: null,
|
cost: null,
|
||||||
searching: true,
|
costIncludesData: null,
|
||||||
matchFound: null,
|
nameLookupComplete: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
componentWillMount: function() {
|
componentWillMount: function() {
|
||||||
document.title = 'lbry://' + this.props.name;
|
document.title = 'lbry://' + this.props.name;
|
||||||
|
|
||||||
lighthouse.search(this.props.name, (results) => {
|
lbry.resolveName(this.props.name, (metadata) => {
|
||||||
var result = results[0];
|
this.setState({
|
||||||
|
metadata: metadata,
|
||||||
|
nameLookupComplete: true,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
if (result.name != this.props.name) {
|
lbry.getCostInfoForName(this.props.name, ({cost, includesData}) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
searching: false,
|
cost: cost,
|
||||||
matchFound: false,
|
costIncludesData: includesData,
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
this.setState({
|
|
||||||
cost: result.cost,
|
|
||||||
costIncludesData: result.costIncludesData,
|
|
||||||
metadata: result.value,
|
|
||||||
searching: false,
|
|
||||||
matchFound: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
|
@ -155,7 +150,7 @@ var DetailPage = React.createClass({
|
||||||
return (
|
return (
|
||||||
<main>
|
<main>
|
||||||
<section className="card">
|
<section className="card">
|
||||||
{this.state.matchFound ? (
|
{this.state.nameLookupComplete ? (
|
||||||
<FormatsSection name={name} claimInfo={metadata} cost={cost} costIncludesData={costIncludesData} />
|
<FormatsSection name={name} claimInfo={metadata} cost={cost} costIncludesData={costIncludesData} />
|
||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue