mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-09 05:02:42 +00:00
Added ability to hide render wanring notification
This commit is contained in:
@@ -3,6 +3,8 @@ const React = require('react');
|
||||
const _ = require('lodash');
|
||||
const cx = require('classnames');
|
||||
|
||||
const DISMISS_KEY = 'dismiss_render_warning';
|
||||
|
||||
const RenderWarnings = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
@@ -40,6 +42,9 @@ const RenderWarnings = React.createClass({
|
||||
}
|
||||
},
|
||||
checkWarnings : function(){
|
||||
const hideDismiss = localStorage.getItem(DISMISS_KEY);
|
||||
if(hideDismiss) return this.setState({warnings : {}});
|
||||
|
||||
this.setState({
|
||||
warnings : _.reduce(this.warnings, (r, fn, type) => {
|
||||
const element = fn();
|
||||
@@ -48,11 +53,16 @@ const RenderWarnings = React.createClass({
|
||||
}, {})
|
||||
})
|
||||
},
|
||||
dismiss : function(){
|
||||
localStorage.setItem(DISMISS_KEY, true);
|
||||
this.checkWarnings();
|
||||
},
|
||||
render: function(){
|
||||
if(_.isEmpty(this.state.warnings)) return null;
|
||||
|
||||
return <div className='renderWarnings'>
|
||||
<i className='fa fa-exclamation-triangle' />
|
||||
<i className='fa fa-times dismiss' onClick={this.dismiss}/>
|
||||
<i className='fa fa-exclamation-triangle ohno' />
|
||||
<h3>Render Warnings</h3>
|
||||
<small>If this homebrew is rendering badly if might be because of the following:</small>
|
||||
<ul>{_.values(this.state.warnings)}</ul>
|
||||
|
||||
Reference in New Issue
Block a user