Merge pull request #47 from lbryio/new-search
Discover: update search to use new format from Lighthouse
This commit is contained in:
commit
5c65d83f7d
2 changed files with 21 additions and 8 deletions
|
@ -22,6 +22,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
* Update process now easier and more reliable
|
* Update process now easier and more reliable
|
||||||
|
* Updated search to be compatible with new Lighthouse servers
|
||||||
* Cleaned up shutdown logic
|
* Cleaned up shutdown logic
|
||||||
* Support lbry v0.10 API signatures
|
* Support lbry v0.10 API signatures
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import lbry from '../lbry.js';
|
import lbry from '../lbry.js';
|
||||||
import lbryio from '../lbryio.js';
|
import lbryio from '../lbryio.js';
|
||||||
|
import uri from '../uri.js';
|
||||||
import lighthouse from '../lighthouse.js';
|
import lighthouse from '../lighthouse.js';
|
||||||
import {FileTile} from '../component/file-tile.js';
|
import {FileTile, FileTileStream} from '../component/file-tile.js';
|
||||||
import {Link} from '../component/link.js';
|
import {Link} from '../component/link.js';
|
||||||
import {ToolTip} from '../component/tooltip.js';
|
import {ToolTip} from '../component/tooltip.js';
|
||||||
import {BusyMessage} from '../component/common.js';
|
import {BusyMessage} from '../component/common.js';
|
||||||
|
@ -45,14 +46,25 @@ var SearchResults = React.createClass({
|
||||||
render: function() {
|
render: function() {
|
||||||
var rows = [],
|
var rows = [],
|
||||||
seenNames = {}; //fix this when the search API returns claim IDs
|
seenNames = {}; //fix this when the search API returns claim IDs
|
||||||
this.props.results.forEach(function({name, value}) {
|
for (let {name, claim, claim_id, channel_name, channel_id, txid, nout} of this.props.results) {
|
||||||
if (!seenNames[name]) {
|
let lbryUri;
|
||||||
seenNames[name] = name;
|
if (channel_name) {
|
||||||
rows.push(
|
lbryUri = uri.buildLbryUri({
|
||||||
<FileTile key={name} uri={name} sdHash={value.sources.lbry_sd_hash} />
|
name: channel_name,
|
||||||
);
|
path: name,
|
||||||
|
claimId: channel_id,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
lbryUri = uri.buildLbryUri({
|
||||||
|
name: name,
|
||||||
|
claimId: claim_id,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
rows.push(
|
||||||
|
<FileTileStream key={name} uri={lbryUri} outpoint={txid + ':' + nout} metadata={claim.stream.metadata} contentType={claim.stream.source.contentType} />
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div>{rows}</div>
|
<div>{rows}</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Reference in a new issue