import React from 'react';
import fs from 'fs'
import Immutable from 'immutable';
import classNames from 'classnames';
import {Flexbox, RetinaImg} from 'nylas-component-kit';
import {Actions, PreferencesUIStore, Utils} from 'nylas-exports';
class PreferencesTabItem extends React.Component {
static displayName = 'PreferencesTabItem';
static propTypes = {
selection: React.PropTypes.instanceOf(Immutable.Map).isRequired,
tabItem: React.PropTypes.instanceOf(PreferencesUIStore.TabItem).isRequired,
}
_onClick = () => {
Actions.switchPreferencesTab(this.props.tabItem.tabId);
}
_onClickAccount = (event, accountId) => {
Actions.switchPreferencesTab(this.props.tabItem.tabId, {accountId});
event.stopPropagation();
}
render() {
const {selection, tabItem} = this.props
const {tabId, displayName} = tabItem;
const classes = classNames({
item: true,
active: tabId === selection.get('tabId'),
});
let path = `icon-preferences-${displayName.toLowerCase().replace(" ", "-")}.png`
if (!fs.existsSync(Utils.imageNamed(path))) {
path = "icon-preferences-general.png";
}
const icon = (