// @flow import * as React from 'react'; import CardMedia from 'component/cardMedia'; import TruncatedText from 'component/common/truncated-text'; import classnames from 'classnames'; import SubscribeButton from 'component/subscribeButton'; import type { Claim } from 'types/claim'; type Props = { uri: string, isResolvingUri: boolean, totalItems: number, size: string, claim: ?Claim, resolveUri: string => void, navigate: (string, ?{}) => void, }; class ChannelTile extends React.PureComponent { static defaultProps = { size: 'regular', }; componentDidMount() { const { uri, resolveUri } = this.props; resolveUri(uri); } componentWillReceiveProps(nextProps: Props) { const { uri, resolveUri } = this.props; if (nextProps.uri !== uri) { resolveUri(uri); } } render() { const { claim, navigate, isResolvingUri, totalItems, uri, size } = this.props; let channelName; let subscriptionUri; if (claim) { channelName = claim.name; subscriptionUri = `lbry://${claim.permanent_url}`; } const onClick = () => navigate('/show', { uri, page: 1 }); return (
{isResolvingUri &&
{__('Loading...')}
} {!isResolvingUri && (
{totalItems > 0 && ( {totalItems} {totalItems === 1 ? 'publish' : 'publishes'} )} {!isResolvingUri && !totalItems && This is an empty channel.}
)} {subscriptionUri && (
)}
); } } export default ChannelTile;