2017-05-04 05:44:08 +02:00
|
|
|
import React from 'react';
|
2017-05-19 01:14:26 +02:00
|
|
|
import lbryuri from 'lbryuri'
|
2017-05-21 16:42:34 +02:00
|
|
|
import {BusyMessage} from 'component/common'
|
|
|
|
import FileTile from 'component/fileTile'
|
2017-05-04 05:44:08 +02:00
|
|
|
|
2017-05-13 00:50:51 +02:00
|
|
|
class ChannelPage extends React.Component{
|
|
|
|
componentDidMount() {
|
|
|
|
this.fetchClaims(this.props)
|
|
|
|
}
|
2017-05-04 05:44:08 +02:00
|
|
|
|
2017-05-13 00:50:51 +02:00
|
|
|
componentWillReceiveProps(nextProps) {
|
|
|
|
this.fetchClaims(nextProps)
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchClaims(props) {
|
2017-05-19 01:14:26 +02:00
|
|
|
if (props.claimsInChannel === undefined) {
|
2017-05-13 00:50:51 +02:00
|
|
|
props.fetchClaims(props.uri)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
2017-05-19 01:14:26 +02:00
|
|
|
claimsInChannel,
|
2017-05-13 00:50:51 +02:00
|
|
|
claim,
|
|
|
|
uri
|
|
|
|
} = this.props
|
|
|
|
|
2017-05-21 16:42:34 +02:00
|
|
|
let contentList
|
|
|
|
if (claimsInChannel === undefined) {
|
2017-05-26 02:16:25 +02:00
|
|
|
contentList = <BusyMessage message={__("Fetching content")} />
|
2017-05-21 16:42:34 +02:00
|
|
|
} else if (claimsInChannel) {
|
|
|
|
contentList = claimsInChannel.length ?
|
|
|
|
claimsInChannel.map((claim) => <FileTile key={claim.claim_id} uri={lbryuri.build({name: claim.name, claimId: claim.claim_id})} />) :
|
2017-05-26 02:16:25 +02:00
|
|
|
<span className="empty">{__("No content found.")}</span>
|
2017-05-21 16:42:34 +02:00
|
|
|
}
|
|
|
|
|
2017-05-13 00:50:51 +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>
|
2017-05-26 02:16:25 +02:00
|
|
|
{__("This channel page is a stub.")}
|
2017-05-13 00:50:51 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</section>
|
2017-05-26 02:16:25 +02:00
|
|
|
<h3 className="card-row__header">{__("Published Content")}</h3>
|
2017-05-21 16:42:34 +02:00
|
|
|
{contentList}
|
2017-05-13 00:50:51 +02:00
|
|
|
</main>
|
|
|
|
}
|
2017-05-04 05:44:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default ChannelPage;
|