import React, { Component } from 'react'; import pure from 'pure-render-decorator'; import TabListItem from './TabListItem'; @pure export default class TabList extends Component { handleTabClick = (server, target) => { this.props.select(server, target, target && target.charAt(0) !== '#'); this.props.hideMenu(); }; handleConnectClick = () => { this.props.pushPath('/connect'); this.props.hideMenu(); }; handleSettingsClick = () => { this.props.pushPath('/settings'); this.props.hideMenu(); }; render() { const { channels, servers, privateChats, showTabList, selected } = this.props; const className = showTabList ? 'tablist off-canvas' : 'tablist'; const tabs = []; channels.forEach((server, address) => { tabs.push( ); server.forEach((channel, name) => tabs.push( )); if (privateChats.has(address)) { privateChats.get(address).forEach(nick => tabs.push( )); } }); return (
{tabs}
); } }