0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-13 23:52:42 +00:00

Added a bunch of random generators

This commit is contained in:
Scott Tolksdorf
2016-01-05 16:41:19 -05:00
parent fb8ddfe9fa
commit 25b53a7c24
12 changed files with 590 additions and 127 deletions

View File

@@ -5,26 +5,32 @@ var Moment = require('moment');
var Logo = require('naturalCrit/logo/logo.jsx');
var Statusbar = React.createClass({
getDefaultProps: function() {
return {
editId: null,
//editId: null,
shareId : null,
isPending : false,
lastUpdated : null,
info : null
};
},
selectInputText : function(refName){
this.refs[refName].select();
componentDidMount: function() {
//Updates the last updated text every 10 seconds
if(this.props.lastUpdated){
this.refreshTimer = setInterval(()=>{
this.forceUpdate();
}, 10000)
}
},
componentWillUnmount: function() {
clearInterval(this.refreshTimer);
},
renderInfo : function(){
if(!this.props.lastUpdated) return null;
@@ -41,17 +47,6 @@ var Statusbar = React.createClass({
</a>
},
renderEdit : function(){
return null;
if(!this.props.editId) return null;
return <div className='editField' key='edit' onClick={this.selectInputText.bind(this, 'edit')}>
<span>Edit Link</span>
<input type='text' readOnly value={'/homebrew/edit/' + this.props.editId} ref='edit' />
</div>
},
renderShare : function(){
if(!this.props.shareId) return null;
@@ -74,16 +69,12 @@ var Statusbar = React.createClass({
render : function(){
return <div className='statusbar'>
<Logo />
<div className='left'>
<a href='/homebrew' className='toolName'>
The Home<i className='fa fa-beer fa-flip-horizontal' /><small>rewery</small>
</a>
</div>
<div className='controls right'>
{this.renderStatus()}
{this.renderInfo()}