minor cleanup for channelSection

This commit is contained in:
btzr-io 2017-10-15 16:28:06 -06:00 committed by Jeremy Kauffman
parent ee08f38cd8
commit f529d29a77

View file

@ -89,8 +89,7 @@ class ChannelSection extends React.PureComponent {
const channel = this.state.addingChannel ? "new" : this.props.channel; const channel = this.state.addingChannel ? "new" : this.props.channel;
const { fetchingChannels, channels = [] } = this.props; const { fetchingChannels, channels = [] } = this.props;
let channelContent = []; const channelSelector = (
channelContent.push(
<FormRow <FormRow
key="channel" key="channel"
type="select" type="select"
@ -101,7 +100,7 @@ class ChannelSection extends React.PureComponent {
<option key="anonymous" value="anonymous"> <option key="anonymous" value="anonymous">
{__("Anonymous")} {__("Anonymous")}
</option> </option>
{this.props.channels.map(({ name }) => {channels.map(({ name }) =>
<option key={name} value={name}>{name}</option> <option key={name} value={name}>{name}</option>
)} )}
<option key="new" value="new"> <option key="new" value="new">
@ -109,11 +108,6 @@ class ChannelSection extends React.PureComponent {
</option> </option>
</FormRow> </FormRow>
); );
if (fetchingChannels) {
channelContent = (
<BusyMessage message="Updating channels" key="loading" />
);
}
return ( return (
<section className="card"> <section className="card">
@ -128,7 +122,9 @@ class ChannelSection extends React.PureComponent {
</div> </div>
</div> </div>
<div className="card__content"> <div className="card__content">
{channelContent} {fetchingChannels
? <BusyMessage message="Updating channels" key="loading" />
: channelSelector}
</div> </div>
{this.state.addingChannel && {this.state.addingChannel &&
<div className="card__content"> <div className="card__content">