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

@@ -10,6 +10,7 @@ class UIStoreClass extends BaseStore {
super();
this.activeModal = null;
this.latestTorrentLocation = null;
this.torrentDetailsHash = null;
this.torrentDetailsOpen = false;
}
@@ -21,19 +22,31 @@ class UIStoreClass extends BaseStore {
}
}
fetchLatestTorrentLocation() {
TorrentActions.fetchLatestTorrentLocation();
}
getActiveModal() {
return this.activeModal;
}
setActiveModal(modal) {
this.activeModal = modal;
this.emit(EventTypes.UI_MODAL_CHANGE);
getLatestTorrentLocation() {
return this.latestTorrentLocation;
}
getTorrentDetailsHash() {
return this.torrentDetailsHash;
}
handleLatestTorrentLocationRequestSuccess(location) {
this.latestTorrentLocation = location;
this.emit(EventTypes.UI_LATEST_TORRENT_LOCATION_CHANGE);
}
handleLatestTorrentLocationRequestError(error) {
console.log(error);
}
handleTorrentClick(hash) {
this.torrentDetailsHash = hash;
this.emit(EventTypes.UI_TORRENT_DETAILS_HASH_CHANGE);
@@ -47,6 +60,11 @@ class UIStoreClass extends BaseStore {
isTorrentDetailsOpen() {
return this.torrentDetailsOpen;
}
setActiveModal(modal) {
this.activeModal = modal;
this.emit(EventTypes.UI_MODAL_CHANGE);
}
}
const UIStore = new UIStoreClass();
@@ -64,6 +82,12 @@ AppDispatcher.register((payload) => {
case ActionTypes.UI_DISPLAY_MODAL:
UIStore.setActiveModal(action.data);
break;
case ActionTypes.UI_LATEST_TORRENT_LOCATION_REQUEST_SUCCESS:
UIStore.handleLatestTorrentLocationRequestSuccess(action.data.path);
break;
case ActionTypes.UI_LATEST_TORRENT_LOCATION_REQUEST_ERROR:
UIStore.handleLatestTorrentLocationRequestError(action.error);
break;
}
});