import React, { PureComponent } from 'react'; import classnames from 'classnames'; 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 tabs = []; const className = classnames('tablist', { 'off-canvas': showTabList }); channels.forEach(server => { const { address } = server; const srv = servers[address]; tabs.push( ); server.channels.forEach(name => tabs.push( ) ); if (privateChats[address] && privateChats[address].length > 0) { tabs.push(
Private messages
); privateChats[address].forEach(nick => tabs.push( ) ); } }); return (
{tabs}
); } }