import React from 'react'; import {ipcRenderer} from 'electron'; import {Flexbox} from 'nylas-component-kit'; import PackageSet from './package-set'; import PackagesStore from './packages-store'; import PluginsActions from './plugins-actions'; class TabInstalled extends React.Component { static displayName = 'TabInstalled'; constructor() { super(); this.state = this._getStateFromStores(); } componentDidMount() { this._unsubscribers = []; this._unsubscribers.push(PackagesStore.listen(this._onChange)); PluginsActions.refreshInstalledPackages(); } componentWillUnmount() { this._unsubscribers.forEach(unsubscribe => unsubscribe()); } _getStateFromStores() { return { packages: PackagesStore.installed(), search: PackagesStore.installedSearchValue(), }; } _onChange = () => { this.setState(this._getStateFromStores()); } _onInstallPackage() { PluginsActions.installNewPackage(); } _onCreatePackage() { PluginsActions.createPackage(); } _onSearchChange = (event) => { PluginsActions.setInstalledSearchValue(event.target.value); } _onEnableDevMode() { ipcRenderer.send('command', 'application:toggle-dev'); } render() { let searchEmpty = null; if (this.state.search.length > 0) { searchEmpty = "No matching packages."; } let devPackages = [] let devEmpty = (Run with debug flags enabled to load ~/.nylas-mail/dev/packages.); let devCTA = (