* Collection edit modal * Add icon * 💚 * Oh look, some specs * Delete collection * Remove from collection * Handle error responses Protect against deleting last collection * Fix key * 💚 * Keyboard navigate documents list * Add missing database constraints
41 lines
894 B
JavaScript
41 lines
894 B
JavaScript
// @flow
|
|
import { observable, action } from 'mobx';
|
|
import Document from 'models/Document';
|
|
|
|
class UiStore {
|
|
@observable activeDocumentId: ?string;
|
|
@observable activeCollectionId: ?string;
|
|
@observable progressBarVisible: boolean = false;
|
|
@observable editMode: boolean = false;
|
|
|
|
/* Actions */
|
|
|
|
@action setActiveDocument = (document: Document): void => {
|
|
this.activeDocumentId = document.id;
|
|
this.activeCollectionId = document.collection.id;
|
|
};
|
|
|
|
@action clearActiveDocument = (): void => {
|
|
this.activeDocumentId = undefined;
|
|
this.activeCollectionId = undefined;
|
|
};
|
|
|
|
@action enableEditMode() {
|
|
this.editMode = true;
|
|
}
|
|
|
|
@action disableEditMode() {
|
|
this.editMode = false;
|
|
}
|
|
|
|
@action enableProgressBar() {
|
|
this.progressBarVisible = true;
|
|
}
|
|
|
|
@action disableProgressBar() {
|
|
this.progressBarVisible = false;
|
|
}
|
|
}
|
|
|
|
export default UiStore;
|