import React, { PureComponent } from 'react'; import TabListItem from './TabListItem'; export default class TabList extends PureComponent { handleTabClick = (server, target) => this.props.select(server, target); handleConnectClick = () => this.props.push('/connect'); handleSettingsClick = () => this.props.push('/settings'); render() { const { tab, channels, servers, privateChats, showTabList } = this.props; const className = showTabList ? 'tablist off-canvas' : 'tablist'; const tabs = []; channels.forEach((server, address) => { const srv = servers.get(address); tabs.push( ); server.forEach((channel, name) => tabs.push( ) ); if (privateChats.has(address) && privateChats.get(address).size > 0) { tabs.push(
Private messages
); privateChats .get(address) .forEach(nick => tabs.push( ) ); } }); return (
{tabs}
); } }