Loading bar for layout
This commit is contained in:
@ -27,7 +27,6 @@ type Props = {
|
|||||||
children?: ?React.Element<any>,
|
children?: ?React.Element<any>,
|
||||||
actions?: ?React.Element<any>,
|
actions?: ?React.Element<any>,
|
||||||
title?: ?React.Element<any>,
|
title?: ?React.Element<any>,
|
||||||
loading?: boolean,
|
|
||||||
user: UserStore,
|
user: UserStore,
|
||||||
auth: AuthStore,
|
auth: AuthStore,
|
||||||
ui: UiStore,
|
ui: UiStore,
|
||||||
@ -73,7 +72,7 @@ type Props = {
|
|||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{this.props.loading && <LoadingIndicator />}
|
{this.props.ui.progressBarVisible && <LoadingIndicator />}
|
||||||
|
|
||||||
{this.props.notifications}
|
{this.props.notifications}
|
||||||
|
|
||||||
|
@ -79,7 +79,9 @@ type Props = {
|
|||||||
const document = this.document;
|
const document = this.document;
|
||||||
|
|
||||||
if (!document) return;
|
if (!document) return;
|
||||||
|
this.props.ui.enableProgressBar();
|
||||||
await document.save();
|
await document.save();
|
||||||
|
this.props.ui.disableProgressBar();
|
||||||
this.props.ui.disableEditMode();
|
this.props.ui.disableEditMode();
|
||||||
|
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
@ -88,11 +90,11 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onImageUploadStart() {
|
onImageUploadStart() {
|
||||||
// TODO: How to set loading bar on layout?
|
this.props.ui.enableProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
onImageUploadStop() {
|
onImageUploadStop() {
|
||||||
// TODO: How to set loading bar on layout?
|
this.props.ui.disableProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange = text => {
|
onChange = text => {
|
||||||
|
@ -5,6 +5,7 @@ import Collection from 'models/Collection';
|
|||||||
|
|
||||||
class UiStore {
|
class UiStore {
|
||||||
@observable activeDocument: ?Document;
|
@observable activeDocument: ?Document;
|
||||||
|
@observable progressBarVisible: boolean = true;
|
||||||
@observable editMode: boolean = false;
|
@observable editMode: boolean = false;
|
||||||
|
|
||||||
/* Computed */
|
/* Computed */
|
||||||
@ -30,6 +31,14 @@ class UiStore {
|
|||||||
@action disableEditMode() {
|
@action disableEditMode() {
|
||||||
this.editMode = false;
|
this.editMode = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action enableProgressBar() {
|
||||||
|
this.progressBarVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@action disableProgressBar() {
|
||||||
|
this.progressBarVisible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default UiStore;
|
export default UiStore;
|
||||||
|
Reference in New Issue
Block a user