// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import * as Utils from 'utils/utils.jsx'; import {FormattedMessage} from 'react-intl'; import {Modal} from 'react-bootstrap'; import TeamStore from 'stores/team_store.jsx'; import * as TextFormatting from 'utils/text_formatting.jsx'; import React from 'react'; export default class ChannelInfoModal extends React.Component { shouldComponentUpdate(nextProps) { if (nextProps.show !== this.props.show) { return true; } if (!Utils.areObjectsEqual(nextProps.channel, this.props.channel)) { return true; } return false; } render() { let channel = this.props.channel; let channelIcon; if (!channel) { const notFound = Utils.localizeMessage('channel_info.notFound', 'No Channel Found'); channel = { display_name: notFound, name: notFound, purpose: notFound, header: notFound, id: notFound }; } if (channel.type === 'O') { channelIcon = (); } else if (channel.type === 'P') { channelIcon = (); } const channelURL = TeamStore.getCurrentTeamUrl() + '/channels/' + channel.name; let channelPurpose = null; if (channel.purpose) { channelPurpose = (
{channel.purpose}
); } let channelHeader = null; if (channel.header) { channelHeader = (
); } return ( {channelIcon}{channel.display_name} {channelPurpose} {channelHeader}
{channelURL}

{channel.id}

); } } ChannelInfoModal.propTypes = { show: React.PropTypes.bool.isRequired, onHide: React.PropTypes.func.isRequired, channel: React.PropTypes.object.isRequired };