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

64 lines
1.4 KiB
React
Raw Normal View History

import React from 'react';
import {
BusyMessage,
} from 'component/common';
import FilePage from 'page/filePage'
2017-05-10 05:06:48 +02:00
class ShowPage extends React.Component{
componentWillMount() {
2017-05-12 01:28:43 +02:00
this.resolve(this.props)
}
componentWillReceiveProps(nextProps) {
this.resolve(nextProps)
}
resolve(props) {
2017-05-10 05:06:48 +02:00
const {
isResolvingUri,
resolveUri,
claim,
uri,
2017-05-12 01:28:43 +02:00
} = props
2017-05-10 05:06:48 +02:00
if(!isResolvingUri && claim === undefined && uri) {
2017-05-10 05:06:48 +02:00
resolveUri(uri)
}
}
render() {
const {
2017-05-12 01:28:43 +02:00
claim,
2017-05-10 05:06:48 +02:00
uri,
isResolvingUri,
} = this.props
let innerContent = "";
if (isResolvingUri || claim === null) {
innerContent = <section className="card">
2017-05-10 05:06:48 +02:00
<div className="card__inner">
2017-05-12 01:28:43 +02:00
<div className="card__title-identity"><h1>{uri}</h1></div>
2017-05-10 05:06:48 +02:00
</div>
<div className="card__content">
{ isResolvingUri && <BusyMessage message="Loading magic decentralized data..." /> }
{ claim === null && <span className="empty">There's nothing at this location.</span> }
2017-05-10 05:06:48 +02:00
</div>
</section>
2017-05-10 05:06:48 +02:00
}
2017-05-12 01:28:43 +02:00
else if (claim && claim.whatever) {
innerContent = "channel"
// innerContent = <ChannelPage title={uri} />
2017-05-10 05:06:48 +02:00
}
2017-05-12 01:28:43 +02:00
else if (claim) {
innerContent = <FilePage />
}
return (
<main className="main--single-column">{innerContent}</main>
)
2017-05-10 05:06:48 +02:00
}
}
export default ShowPage