mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 20:42:43 +00:00
tweak behavior per calculuschild notes
Default to autosave = true. trySave() when autosave toggled on. Display "auto-saved." when save is a result of autosave.
This commit is contained in:
@@ -63,7 +63,7 @@ const EditPage = createClass({
|
||||
errors : null,
|
||||
htmlErrors : Markdown.validate(this.props.brew.text),
|
||||
url : '',
|
||||
autoSave : null
|
||||
autoSave : true
|
||||
};
|
||||
},
|
||||
savedBrew : null,
|
||||
@@ -339,6 +339,9 @@ const EditPage = createClass({
|
||||
if(this.state.isPending && this.hasChanges()){
|
||||
return <Nav.item className='save' onClick={this.save} color='blue' icon='fas fa-save'>Save Now</Nav.item>;
|
||||
}
|
||||
if(!this.state.isPending && !this.state.isSaving && this.state.autoSave){
|
||||
return <Nav.item className='save saved'>auto-saved.</Nav.item>;
|
||||
}
|
||||
if(!this.state.isPending && !this.state.isSaving){
|
||||
return <Nav.item className='save saved'>saved.</Nav.item>;
|
||||
}
|
||||
@@ -347,8 +350,10 @@ const EditPage = createClass({
|
||||
handleAutoSave : function(){
|
||||
this.setState((prevState)=>({
|
||||
autoSave : !prevState.autoSave
|
||||
}));
|
||||
localStorage.setItem('AUTOSAVE_ON', JSON.stringify(!this.state.autoSave));
|
||||
}), ()=>{
|
||||
this.trySave();
|
||||
localStorage.setItem('AUTOSAVE_ON', JSON.stringify(this.state.autoSave));
|
||||
});
|
||||
},
|
||||
|
||||
renderAutoSaveButton : function(){
|
||||
|
||||
Reference in New Issue
Block a user