import React, { memo } from 'react'; import { FiUsers, FiSearch, FiX } from 'react-icons/fi'; import Navicon from 'components/ui/Navicon'; import Button from 'components/ui/Button'; import Editable from 'components/ui/Editable'; import { isValidNetworkName } from 'state/networks'; import { isChannel } from 'utils'; const ChatTitle = ({ error, 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 networkError = null; if (!tab.name && error) { networkError = Error: {error}; } return (
{title}
{channel?.topic && ( openModal('topic', channel.name)} > {channel.topic} )} {networkError}
{tab.name && (
{channel?.users.length}
); }; export default memo(ChatTitle);