lbry-desktop/ui/js/page/channel/view.jsx

58 lines
1.5 KiB
React
Raw Normal View History

2017-06-06 17:19:12 -04:00
import React from "react";
import lbryuri from "lbryuri";
import { BusyMessage } from "component/common";
import FileTile from "component/fileTile";
2017-05-03 23:44:08 -04:00
2017-06-05 21:21:55 -07:00
class ChannelPage extends React.Component {
2017-05-12 18:50:51 -04:00
componentDidMount() {
2017-06-06 17:19:12 -04:00
this.fetchClaims(this.props);
2017-05-12 18:50:51 -04:00
}
2017-05-03 23:44:08 -04:00
2017-05-12 18:50:51 -04:00
componentWillReceiveProps(nextProps) {
2017-06-06 17:19:12 -04:00
this.fetchClaims(nextProps);
2017-05-12 18:50:51 -04:00
}
fetchClaims(props) {
if (props.claimsInChannel === undefined) {
2017-06-06 17:19:12 -04:00
props.fetchClaims(props.uri);
2017-05-12 18:50:51 -04:00
}
}
render() {
2017-06-06 17:19:12 -04:00
const { claimsInChannel, claim, uri } = this.props;
2017-05-12 18:50:51 -04:00
2017-06-06 17:19:12 -04:00
let contentList;
2017-05-21 10:42:34 -04:00
if (claimsInChannel === undefined) {
2017-06-06 17:19:12 -04:00
contentList = <BusyMessage message={__("Fetching content")} />;
2017-05-21 10:42:34 -04:00
} else if (claimsInChannel) {
2017-06-06 17:19:12 -04:00
contentList = claimsInChannel.length
? claimsInChannel.map(claim =>
<FileTile
key={claim.claim_id}
uri={lbryuri.build({ name: claim.name, claimId: claim.claim_id })}
/>
)
: <span className="empty">{__("No content found.")}</span>;
2017-05-21 10:42:34 -04:00
}
2017-06-06 17:19:12 -04:00
return (
<main className="main--single-column">
<section className="card">
<div className="card__inner">
<div className="card__title-identity"><h1>{uri}</h1></div>
</div>
<div className="card__content">
<p>
{__("This channel page is a stub.")}
</p>
</div>
</section>
<h3 className="card-row__header">{__("Published Content")}</h3>
{contentList}
</main>
);
2017-05-12 18:50:51 -04:00
}
2017-05-03 23:44:08 -04:00
}
export default ChannelPage;