diff --git a/src/renderer/component/channelTile/view.jsx b/src/renderer/component/channelTile/view.jsx index 531b9fccd..60f7e29b7 100644 --- a/src/renderer/component/channelTile/view.jsx +++ b/src/renderer/component/channelTile/view.jsx @@ -2,16 +2,13 @@ import * as React from 'react'; import CardMedia from 'component/cardMedia'; import TruncatedText from 'component/common/truncated-text'; - -/* - This component can probably be combined with FileTile - Currently the only difference is showing the number of files/empty channel -*/ +import classnames from 'classnames'; type Props = { uri: string, isResolvingUri: boolean, totalItems: number, + size: string, claim: ?{ claim_id: string, name: string, @@ -21,6 +18,10 @@ type Props = { }; class ChannelTile extends React.PureComponent { + static defaultProps = { + size: 'regular', + }; + componentDidMount() { const { uri, resolveUri } = this.props; @@ -36,27 +37,52 @@ class ChannelTile extends React.PureComponent { } render() { - const { claim, navigate, isResolvingUri, totalItems, uri } = this.props; - let channelName, channelId; + const { claim, navigate, isResolvingUri, totalItems, uri, size } = this.props; + let channelName; if (claim) { channelName = claim.name; - channelId = claim.claim_id; } const onClick = () => navigate('/show', { uri }); return ( -
+
- {isResolvingUri &&
{__('Loading...')}
} + {isResolvingUri && ( +
+ {__('Loading...')} +
+ )} {!isResolvingUri && ( -
+
{channelName || uri}
-
+
{totalItems > 0 && ( {totalItems} {totalItems === 1 ? 'file' : 'files'} diff --git a/src/renderer/page/search/view.jsx b/src/renderer/page/search/view.jsx index 4b2497797..d3000a9c9 100644 --- a/src/renderer/page/search/view.jsx +++ b/src/renderer/page/search/view.jsx @@ -1,9 +1,10 @@ // @flow import * as React from 'react'; import * as settings from 'constants/settings'; -import { isURIValid, normalizeURI } from 'lbry-redux'; +import { isURIValid, normalizeURI, parseURI } from 'lbry-redux'; import { FormField, FormRow } from 'component/common/form'; import FileTile from 'component/fileTile'; +import ChannelTile from 'component/channelTile'; import FileListSearch from 'component/fileListSearch'; import Page from 'component/page'; @@ -32,13 +33,27 @@ class SearchPage extends React.PureComponent { render() { const { query, resultCount } = this.props; + + const isValid = isURIValid(query); + + let uri; + let isChannel; + if (isValid) { + uri = normalizeURI(query); + ({ isChannel } = parseURI(uri)); + } + return ( {query && - isURIValid(query) && ( + isValid && (
{`lbry://${query}`}
- + {isChannel ? ( + + ) : ( + + )}
)}