Introduce uiSettings DB

This commit is contained in:
John Furrow
2016-01-30 20:21:42 -08:00
parent 750850584f
commit 86e8becde3
24 changed files with 353 additions and 117 deletions

View File

@@ -2,8 +2,10 @@ import _ from 'lodash';
import classnames from 'classnames';
import React from 'react';
import EventTypes from '../../constants/EventTypes';
import TextboxRepeater from '../forms/TextboxRepeater';
import TorrentActions from '../../actions/TorrentActions';
import UIStore from '../../stores/UIStore';
const METHODS_TO_BIND = [
'getContent',
@@ -11,7 +13,8 @@ const METHODS_TO_BIND = [
'handleUrlAdd',
'handleUrlChange',
'handleUrlRemove',
'handleAddTorrents'
'handleAddTorrents',
'onLatestTorrentLocationChange'
];
export default class AddTorrents extends React.Component {
@@ -29,6 +32,23 @@ export default class AddTorrents extends React.Component {
});
}
componentWillMount() {
this.setState({destination: UIStore.getLatestTorrentLocation()});
}
componentDidMount() {
UIStore.listen(EventTypes.UI_LATEST_TORRENT_LOCATION_CHANGE, this.onLatestTorrentLocationChange);
}
componentWillUnmount() {
UIStore.unlisten(EventTypes.UI_LATEST_TORRENT_LOCATION_CHANGE, this.onLatestTorrentLocationChange);
UIStore.fetchLatestTorrentLocation();
}
onLatestTorrentLocationChange() {
this.setState({destination: UIStore.getLatestTorrentLocation()});
}
getContent() {
return (
<div className="modal__content" onClick={this.handleMenuWrapperClick}>