import React, { memo } from 'react'; import { FiUsers, FiSearch, FiX } from 'react-icons/fi'; import Navicon from 'containers/Navicon'; import Button from 'components/ui/Button'; import Editable from 'components/ui/Editable'; import { isValidServerName } from 'state/servers'; import { isChannel } from 'utils'; const ChatTitle = ({ status, title, tab, channel, openModal, onTitleChange, onToggleSearch, onToggleUserList, onCloseClick }) => { let closeTitle; if (isChannel(tab)) { closeTitle = 'Leave'; } else if (tab.name) { closeTitle = 'Close'; } else { closeTitle = 'Disconnect'; } let serverError = null; if (!tab.name && status.error) { serverError = ( Error: {status.error} ); } return (
{title}
{channel && channel.topic && ( openModal('topic', { topic: channel.topic, channel: channel.name }) } > {channel.topic} )} {serverError}
{tab.name && (
{channel && channel.users.length}
); }; export default memo(ChatTitle);