lbry-desktop/ui/js/component/channelTile/view.jsx

53 lines
1.4 KiB
React
Raw Normal View History

2017-10-10 01:19:50 +02:00
import React from "react";
import { TruncatedText, BusyMessage } from "component/common.js";
class ChannelTile extends React.PureComponent {
componentDidMount() {
const { uri, resolveUri } = this.props;
2017-10-10 01:19:50 +02:00
resolveUri(uri);
2017-10-10 01:19:50 +02:00
}
componentWillReceiveProps(nextProps) {
const { uri, resolveUri } = this.props;
2017-10-10 01:19:50 +02:00
if (nextProps.uri != uri) {
resolveUri(uri);
2017-10-10 01:19:50 +02:00
}
}
render() {
const { claim, navigate, isResolvingUri, totalItems, uri } = this.props;
2017-10-10 01:19:50 +02:00
let onClick = () => navigate("/show", { uri });
return (
<section className="file-tile card">
<div onClick={onClick} className="card__link">
<div className="file-tile__content">
<div className="card__title-primary">
<h3>
<TruncatedText lines={1}>{uri}</TruncatedText>
</h3>
</div>
<div className="card__content card__subtext">
{isResolvingUri &&
2017-10-10 01:19:50 +02:00
<BusyMessage message={__("Resolving channel")} />}
{totalItems > 0 &&
<span>
This is a channel with {totalItems}{" "}
{totalItems === 1 ? " item" : " items"} inside of it.
2017-10-10 01:19:50 +02:00
</span>}
{!isResolvingUri &&
!totalItems &&
2017-10-10 01:19:50 +02:00
<span className="empty">This is an empty channel.</span>}
</div>
</div>
</div>
</section>
);
}
}
export default ChannelTile;