import React from 'react'; import ErrorPage from 'components/ErrorPage'; import NavBar from 'containers/NavBar'; import ChannelClaimsDisplay from 'containers/ChannelClaimsDisplay'; import { CHANNEL } from 'constants/show_request_types'; function requestIsAChannelRequest ({ requestType }) { return requestType === CHANNEL; } class ShowChannel extends React.Component { componentDidMount () { const { previousRequest, channel, requestId, requestChannelName, requestChannelId } = this.props; if (!previousRequest) { return this.props.onNewChannelRequest(requestId, requestChannelName, requestChannelId); } if (!channel) { const { name, shortId, longId } = previousRequest; return this.props.onShowNewChannel(name, shortId, longId); } } componentWillReceiveProps (nextProps) { if (requestIsAChannelRequest(nextProps)) { const { previousRequest, channel, requestId, requestChannelName, requestChannelId } = nextProps; if (!previousRequest) { return this.props.onNewChannelRequest(requestId, requestChannelName, requestChannelId); } if (!channel) { const { name, shortId, longId } = previousRequest; return this.props.onShowNewChannel(name, shortId, longId); } } } render () { const { channel } = this.props; if (channel) { const { name, longId, shortId } = channel; return (
full channel id: {longId ? longId : 'loading...'}
short channel id: {shortId ? shortId : 'loading...'}