mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 13:02:45 +00:00
Create autosave toggle dropdown menu
This commit is contained in:
@@ -55,6 +55,13 @@
|
|||||||
text-align : center;
|
text-align : center;
|
||||||
text-transform : initial;
|
text-transform : initial;
|
||||||
}
|
}
|
||||||
|
.save-menu .navItem i.fa-power-off {
|
||||||
|
color : red;
|
||||||
|
&.active {
|
||||||
|
color : rgb(0, 182, 52);
|
||||||
|
filter : drop-shadow(0 0 2px rgba(0, 182, 52, 0.765))
|
||||||
|
}
|
||||||
|
}
|
||||||
.patreon.navItem{
|
.patreon.navItem{
|
||||||
border-left : 1px solid #666;
|
border-left : 1px solid #666;
|
||||||
border-right : 1px solid #666;
|
border-right : 1px solid #666;
|
||||||
|
|||||||
@@ -143,12 +143,8 @@ const EditPage = createClass({
|
|||||||
return !_.isEqual(this.state.brew, this.savedBrew);
|
return !_.isEqual(this.state.brew, this.savedBrew);
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleAutoSave : function(){
|
|
||||||
this.setState((prevState)=>({ autoSave: !prevState.autoSave }));
|
|
||||||
},
|
|
||||||
|
|
||||||
trySave : function(){
|
trySave : function(){
|
||||||
if(!this.state.autoSave){ console.log('Auto-save is off.'); return };
|
if(!this.state.autoSave){return;};
|
||||||
if(!this.debounceSave) this.debounceSave = _.debounce(this.save, SAVE_TIMEOUT);
|
if(!this.debounceSave) this.debounceSave = _.debounce(this.save, SAVE_TIMEOUT);
|
||||||
if(this.hasChanges()){
|
if(this.hasChanges()){
|
||||||
this.debounceSave();
|
this.debounceSave();
|
||||||
@@ -342,7 +338,7 @@ const EditPage = createClass({
|
|||||||
return <Nav.item className='save' onClick={this.save} color='blue' icon='fas fa-save'>Save Now</Nav.item>;
|
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){
|
if(!this.state.isPending && !this.state.isSaving){
|
||||||
return <Nav.item className='save saved' onClick={this.toggleAutoSave}>{this.state.autoSave ? `saved.` : `auto-save off`}</Nav.item>;
|
return <Nav.item className='save saved'>saved.</Nav.item>;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -384,7 +380,13 @@ const EditPage = createClass({
|
|||||||
|
|
||||||
<Nav.section>
|
<Nav.section>
|
||||||
{this.renderGoogleDriveIcon()}
|
{this.renderGoogleDriveIcon()}
|
||||||
{this.renderSaveButton()}
|
<Nav.dropdown className='save-menu'>
|
||||||
|
{this.renderSaveButton()}
|
||||||
|
<Nav.item onClick={()=>{ this.setState((prevState)=>({ autoSave: !prevState.autoSave }));}}>
|
||||||
|
Autosave <i className={this.state.autoSave ? 'fas fa-power-off active' : 'fas fa-power-off'}></i>
|
||||||
|
|
||||||
|
</Nav.item>
|
||||||
|
</Nav.dropdown>
|
||||||
<NewBrew />
|
<NewBrew />
|
||||||
<HelpNavItem/>
|
<HelpNavItem/>
|
||||||
<Nav.dropdown>
|
<Nav.dropdown>
|
||||||
|
|||||||
Reference in New Issue
Block a user