2016-04-01 06:52:03 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import TabsStore from './tabs-store';
|
|
|
|
import Tabs from './tabs';
|
|
|
|
|
|
|
|
|
|
|
|
class PluginsView extends React.Component {
|
|
|
|
|
|
|
|
static displayName = 'PluginsView';
|
|
|
|
|
2016-05-07 07:06:16 +08:00
|
|
|
static containerStyles = {
|
|
|
|
minWidth: 500,
|
|
|
|
maxWidth: 99999,
|
|
|
|
}
|
|
|
|
|
2016-04-01 06:52:03 +08:00
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.state = this._getStateFromStores();
|
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
this._unsubscribers = [];
|
|
|
|
this._unsubscribers.push(TabsStore.listen(this._onChange));
|
|
|
|
}
|
|
|
|
|
|
|
|
componentWillUnmount() {
|
|
|
|
this._unsubscribers.forEach(unsubscribe => unsubscribe());
|
|
|
|
}
|
|
|
|
|
|
|
|
_getStateFromStores() {
|
|
|
|
return {tabIndex: TabsStore.tabIndex()};
|
|
|
|
}
|
|
|
|
|
|
|
|
_onChange = () => {
|
|
|
|
this.setState(this._getStateFromStores());
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const PluginsTabComponent = Tabs[this.state.tabIndex].component;
|
|
|
|
return (
|
|
|
|
<div className="plugins-view">
|
|
|
|
<PluginsTabComponent />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export default PluginsView;
|