var React = require('react'); var Reflux = require('reflux'); var TabListItem = require('./TabListItem.jsx'); var channelStore = require('../stores/channel'); var privateChatStore = require('../stores/privateChat'); var serverStore = require('../stores/server'); var routeActions = require('../actions/route'); var tabActions = require('../actions/tab'); var PureMixin = require('../mixins/pure'); var TabList = React.createClass({ mixins: [ PureMixin, Reflux.connect(serverStore, 'servers'), Reflux.connect(channelStore, 'channels'), Reflux.connect(privateChatStore, 'privateChats') ], handleConnectClick() { routeActions.navigate('connect'); tabActions.hideMenu(); }, handleSettingsClick() { routeActions.navigate('settings'); tabActions.hideMenu(); }, render() { var className = this.props.menuToggled ? 'tablist off-canvas' : 'tablist'; var tabs = []; this.state.channels.forEach((server, address) => { tabs.push( ); server.forEach((channel, name) => { tabs.push( ); }); if (this.state.privateChats.has(address)) { this.state.privateChats.get(address).forEach(nick => { tabs.push( ); }); } }); return (
{tabs}
); } }); module.exports = TabList;