2017-06-06 23:19:12 +02:00
|
|
|
import React from "react";
|
|
|
|
import lbryuri from "lbryuri";
|
|
|
|
import { BusyMessage } from "component/common";
|
|
|
|
import FileTile from "component/fileTile";
|
2017-05-04 05:44:08 +02:00
|
|
|
|
2017-06-08 06:42:19 +02:00
|
|
|
class ChannelPage extends React.PureComponent {
|
2017-05-13 00:50:51 +02:00
|
|
|
componentDidMount() {
|
2017-06-06 23:19:12 +02:00
|
|
|
this.fetchClaims(this.props);
|
2017-05-13 00:50:51 +02:00
|
|
|
}
|
2017-05-04 05:44:08 +02:00
|
|
|
|
2017-05-13 00:50:51 +02:00
|
|
|
componentWillReceiveProps(nextProps) {
|
2017-06-06 23:19:12 +02:00
|
|
|
this.fetchClaims(nextProps);
|
2017-05-13 00:50:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fetchClaims(props) {
|
2017-05-19 01:14:26 +02:00
|
|
|
if (props.claimsInChannel === undefined) {
|
2017-06-06 23:19:12 +02:00
|
|
|
props.fetchClaims(props.uri);
|
2017-05-13 00:50:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-06-06 23:19:12 +02:00
|
|
|
const { claimsInChannel, claim, uri } = this.props;
|
2017-05-13 00:50:51 +02:00
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
let contentList;
|
2017-05-21 16:42:34 +02:00
|
|
|
if (claimsInChannel === undefined) {
|
2017-06-06 23:19:12 +02:00
|
|
|
contentList = <BusyMessage message={__("Fetching content")} />;
|
2017-05-21 16:42:34 +02:00
|
|
|
} else if (claimsInChannel) {
|
2017-06-06 23:19:12 +02: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 16:42:34 +02:00
|
|
|
}
|
|
|
|
|
2017-06-06 23:19:12 +02: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-13 00:50:51 +02:00
|
|
|
}
|
2017-05-04 05:44:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default ChannelPage;
|