dispatch/client/src/js/components/ChatTitle.js

43 lines
1.3 KiB
JavaScript
Raw Normal View History

import React, { PureComponent } from 'react';
2015-12-28 23:34:32 +00:00
import { List } from 'immutable';
import Navicon from '../components/Navicon';
import { linkify } from '../util';
2015-12-28 23:34:32 +00:00
export default class ChatTitle extends PureComponent {
2015-12-28 23:34:32 +00:00
render() {
const { title, tab, channel, onToggleSearch, onToggleUserList, onCloseClick } = this.props;
2015-12-28 23:34:32 +00:00
let closeTitle;
if (tab.isChannel()) {
closeTitle = 'Leave';
} else if (tab.name) {
closeTitle = 'Close';
2015-12-28 23:34:32 +00:00
} else {
closeTitle = 'Disconnect';
2015-12-28 23:34:32 +00:00
}
return (
<div>
<div className="chat-title-bar">
<Navicon />
<span className="chat-title">{title}</span>
<div className="chat-topic-wrap">
<span className="chat-topic">{linkify(channel.get('topic')) || null}</span>
2015-12-28 23:34:32 +00:00
</div>
<i className="icon-search" title="Search" onClick={onToggleSearch} />
2015-12-28 23:34:32 +00:00
<i
2017-05-16 06:38:43 +00:00
className="icon-cancel button-leave"
title={closeTitle}
onClick={onCloseClick}
2015-12-28 23:34:32 +00:00
/>
<i className="icon-user button-userlist" onClick={onToggleUserList} />
2015-12-28 23:34:32 +00:00
</div>
<div className="userlist-bar">
<i className="icon-user" />
<span className="chat-usercount">{channel.get('users', List()).size}</span>
2015-12-28 23:34:32 +00:00
</div>
</div>
);
}
}