// @flow import React from 'react'; import FileTile from 'component/fileTile'; import ChannelTile from 'component/channelTile'; import { parseURI } from 'lbry-redux'; const NoResults = () =>
{__('No results')}
; type Props = { query: string, isSearching: boolean, uris: ?Array, downloadUris: ?Array, resultCount: number, }; class FileListSearch extends React.PureComponent { render() { const { uris, query, downloadUris, isSearching } = this.props; const fileResults = []; const channelResults = []; if (uris && uris.length) { uris.forEach(uri => { const isChannel = parseURI(uri).claimName[0] === '@'; if (isChannel) { channelResults.push(uri); } else { fileResults.push(uri); } }); } return ( query && (
{__('Content')}
{!isSearching && (fileResults.length ? ( fileResults.map(uri => ) ) : ( ))}
{__('Channels')}
{!isSearching && (channelResults.length ? ( channelResults.map(uri => ) ) : ( ))}
{__('Your downloads')}
{downloadUris && downloadUris.length ? ( downloadUris.map(uri => ) ) : ( )}
) ); } } export default FileListSearch;