mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-01 19:32:42 +00:00
refactor into handle... and render... methods
This commit is contained in:
@@ -344,6 +344,19 @@ const EditPage = createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleAutoSave : function(){
|
||||||
|
this.setState((prevState)=>({
|
||||||
|
autoSave : !prevState.autoSave
|
||||||
|
}));
|
||||||
|
localStorage.setItem('AUTOSAVE_ON', JSON.stringify(!this.state.autoSave));
|
||||||
|
},
|
||||||
|
|
||||||
|
renderAutoSaveButton : function(){
|
||||||
|
return <Nav.item onClick={this.handleAutoSave}>
|
||||||
|
Autosave <i className={this.state.autoSave ? 'fas fa-power-off active' : 'fas fa-power-off'}></i>
|
||||||
|
</Nav.item>;
|
||||||
|
},
|
||||||
|
|
||||||
processShareId : function() {
|
processShareId : function() {
|
||||||
return this.state.brew.googleId && !this.state.brew.stubbed ?
|
return this.state.brew.googleId && !this.state.brew.stubbed ?
|
||||||
this.state.brew.googleId + this.state.brew.shareId :
|
this.state.brew.googleId + this.state.brew.shareId :
|
||||||
@@ -384,15 +397,7 @@ const EditPage = createClass({
|
|||||||
{this.renderGoogleDriveIcon()}
|
{this.renderGoogleDriveIcon()}
|
||||||
<Nav.dropdown className='save-menu'>
|
<Nav.dropdown className='save-menu'>
|
||||||
{this.renderSaveButton()}
|
{this.renderSaveButton()}
|
||||||
<Nav.item onClick={()=>{
|
{this.renderAutoSaveButton()}
|
||||||
this.setState((prevState)=>({
|
|
||||||
autoSave : !prevState.autoSave
|
|
||||||
}));
|
|
||||||
localStorage.setItem('AUTOSAVE_ON', JSON.stringify(!this.state.autoSave));
|
|
||||||
}}>
|
|
||||||
Autosave <i className={this.state.autoSave ? 'fas fa-power-off active' : 'fas fa-power-off'}></i>
|
|
||||||
|
|
||||||
</Nav.item>
|
|
||||||
</Nav.dropdown>
|
</Nav.dropdown>
|
||||||
<NewBrew />
|
<NewBrew />
|
||||||
<HelpNavItem/>
|
<HelpNavItem/>
|
||||||
|
|||||||
Reference in New Issue
Block a user