0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-06 14:22:52 +00:00

Remove metadata on the Homepage (#1121)

* Remove the metadata button on home page

1) Hopefully make it more clear that the Homepage is meant as a sandbox to test out the site, not a real brew that will be saved.

2) Also, avoid errors resulting from trying to modify the metadata of a brew that doesn't really exist yet.

* Lint
This commit is contained in:
Trevor Buckner
2020-11-27 21:14:15 -05:00
committed by GitHub
parent 3fbddd2e41
commit 8ffea70b2f
3 changed files with 18 additions and 12 deletions

View File

@@ -23,6 +23,7 @@ const Editor = createClass({
metadata : {}, metadata : {},
onMetadataChange : ()=>{}, onMetadataChange : ()=>{},
showMetaButton : true
}; };
}, },
getInitialState : function() { getInitialState : function() {
@@ -118,7 +119,8 @@ const Editor = createClass({
brew={this.props.value} brew={this.props.value}
onInject={this.handleInject} onInject={this.handleInject}
onToggle={this.handgleToggle} onToggle={this.handgleToggle}
showmeta={this.state.showMetadataEditor} /> showmeta={this.state.showMetadataEditor}
showMetaButton={this.props.showMetaButton} />
{this.renderMetadataEditor()} {this.renderMetadataEditor()}
<CodeEditor <CodeEditor
ref='codeEditor' ref='codeEditor'

View File

@@ -12,15 +12,14 @@ const execute = function(val, brew){
return val; return val;
}; };
const Snippetbar = createClass({ const Snippetbar = createClass({
getDefaultProps : function() { getDefaultProps : function() {
return { return {
brew : '', brew : '',
onInject : ()=>{}, onInject : ()=>{},
onToggle : ()=>{}, onToggle : ()=>{},
showmeta : false showmeta : false,
showMetaButton : true
}; };
}, },
@@ -41,13 +40,18 @@ const Snippetbar = createClass({
}); });
}, },
renderMetadataButton : function(){
if(!this.props.showMetaButton) return;
return <div className={cx('toggleMeta', { selected: this.props.showmeta })}
onClick={this.props.onToggle}>
<i className='fa fa-bars' />
</div>;
},
render : function(){ render : function(){
return <div className='snippetBar'> return <div className='snippetBar'>
{this.renderSnippetGroups()} {this.renderSnippetGroups()}
<div className={cx('toggleMeta', { selected: this.props.showmeta })} {this.renderMetadataButton()}
onClick={this.props.onToggle}>
<i className='fa fa-bars' />
</div>
</div>; </div>;
} }
}); });

View File

@@ -77,7 +77,7 @@ const HomePage = createClass({
<div className='content'> <div className='content'>
<SplitPane onDragFinish={this.handleSplitMove} ref='pane'> <SplitPane onDragFinish={this.handleSplitMove} ref='pane'>
<Editor value={this.state.text} onChange={this.handleTextChange} ref='editor'/> <Editor value={this.state.text} onChange={this.handleTextChange} showMetaButton={false} ref='editor'/>
<BrewRenderer text={this.state.text} /> <BrewRenderer text={this.state.text} />
</SplitPane> </SplitPane>
</div> </div>