1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-12 22:15:55 +00:00

Added ability to hide render wanring notification

This commit is contained in:
Scott Tolksdorf
2017-04-22 12:09:18 -04:00
parent 6e0f042b42
commit b68c6a4ad2
4 changed files with 34 additions and 10 deletions

View File

@@ -1,5 +1,9 @@
# changelog # changelog
### Saturday, 22/04/217 - v2.7.4
- Give ability to hide the render warning notification
### Friday, 03/03/2017 - v2.7.3 ### Friday, 03/03/2017 - v2.7.3
- Increasing the range on the Partial Page Rendering for a quick-fix for it getting out of sync on long brews. - Increasing the range on the Partial Page Rendering for a quick-fix for it getting out of sync on long brews.

View File

@@ -1,7 +1,7 @@
{ {
"name": "homebrewery", "name": "homebrewery",
"description": "Create authentic looking D&D homebrews using only markdown", "description": "Create authentic looking D&D homebrews using only markdown",
"version": "2.7.3", "version": "2.7.4",
"scripts": { "scripts": {
"dev": "node scripts/dev.js", "dev": "node scripts/dev.js",
"quick": "node scripts/quick.js", "quick": "node scripts/quick.js",

View File

@@ -3,6 +3,8 @@ const React = require('react');
const _ = require('lodash'); const _ = require('lodash');
const cx = require('classnames'); const cx = require('classnames');
const DISMISS_KEY = 'dismiss_render_warning';
const RenderWarnings = React.createClass({ const RenderWarnings = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
@@ -40,6 +42,9 @@ const RenderWarnings = React.createClass({
} }
}, },
checkWarnings : function(){ checkWarnings : function(){
const hideDismiss = localStorage.getItem(DISMISS_KEY);
if(hideDismiss) return this.setState({warnings : {}});
this.setState({ this.setState({
warnings : _.reduce(this.warnings, (r, fn, type) => { warnings : _.reduce(this.warnings, (r, fn, type) => {
const element = fn(); const element = fn();
@@ -48,11 +53,16 @@ const RenderWarnings = React.createClass({
}, {}) }, {})
}) })
}, },
dismiss : function(){
localStorage.setItem(DISMISS_KEY, true);
this.checkWarnings();
},
render: function(){ render: function(){
if(_.isEmpty(this.state.warnings)) return null; if(_.isEmpty(this.state.warnings)) return null;
return <div className='renderWarnings'> 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> <h3>Render Warnings</h3>
<small>If this homebrew is rendering badly if might be because of the following:</small> <small>If this homebrew is rendering badly if might be because of the following:</small>
<ul>{_.values(this.state.warnings)}</ul> <ul>{_.values(this.state.warnings)}</ul>

View File

@@ -11,12 +11,22 @@
padding-left : 85px; padding-left : 85px;
background-color : @yellow; background-color : @yellow;
color : white; color : white;
i{ i.ohno{
position: absolute; position : absolute;
left: 24px; top : 24px;
opacity: 0.8; left : 24px;
font-size: 2.5em; opacity : 0.8;
top: 24px; font-size : 2.5em;
}
i.dismiss{
position : absolute;
top : 10px;
right : 10px;
cursor : pointer;
opacity : 0.6;
&:hover{
opacity : 1;
}
} }
small{ small{
opacity : 0.7; opacity : 0.7;
@@ -32,10 +42,10 @@
list-style-position : outside; list-style-position : outside;
list-style-type : disc; list-style-type : disc;
li{ li{
font-size : 0.8em;
line-height : 1.6em; line-height : 1.6em;
font-size: 0.8em;
em{ em{
font-weight: 800; font-weight : 800;
} }
} }
} }