mirror of
https://github.com/zoriya/flood.git
synced 2025-12-23 07:35:27 +00:00
Introduce uiSettings DB
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user