From 3ac31df63fa13b1471a0b0e4ac8cbec8b892a392 Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Mon, 17 Apr 2017 18:28:24 -0400 Subject: [PATCH] Discover: update search to use new format from Lighthouse --- CHANGELOG.md | 1 + ui/js/page/discover.js | 28 ++++++++++++++++++++-------- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bb336c848..2002e1aad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Web UI version numbers should always match the corresponding version of LBRY App ### Changed * Update process now easier and more reliable + * Updated search to be compatible with new Lighthouse servers * Cleaned up shutdown logic * Support lbry v0.10 API signatures diff --git a/ui/js/page/discover.js b/ui/js/page/discover.js index 8aadd2df4..fd0f25811 100644 --- a/ui/js/page/discover.js +++ b/ui/js/page/discover.js @@ -1,8 +1,9 @@ import React from 'react'; import lbry from '../lbry.js'; import lbryio from '../lbryio.js'; +import uri from '../uri.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 {ToolTip} from '../component/tooltip.js'; import {BusyMessage} from '../component/common.js'; @@ -45,14 +46,25 @@ var SearchResults = React.createClass({ render: function() { var rows = [], seenNames = {}; //fix this when the search API returns claim IDs - this.props.results.forEach(function({name, value}) { - if (!seenNames[name]) { - seenNames[name] = name; - rows.push( - - ); + for (let {name, claim, claim_id, channel_name, channel_id, txid, nout} of this.props.results) { + let lbryUri; + if (channel_name) { + lbryUri = uri.buildLbryUri({ + name: channel_name, + path: name, + claimId: channel_id, + }); + } else { + lbryUri = uri.buildLbryUri({ + name: name, + claimId: claim_id, + }) } - }); + + rows.push( + + ); + } return (
{rows}
);