0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-27 22:22:42 +00:00
Files
homebrewery/client/homebrew/brewRenderer/notificationPopup/notificationPopup.jsx
Trevor Buckner 06d970e61a Notification about the Grey Shadow issue
First Reported 7/24/2019. Think it's a mobile Chrome issue.
2019-07-24 09:35:13 -04:00

68 lines
2.3 KiB
JavaScript

const React = require('react');
const createClass = require('create-react-class');
const _ = require('lodash');
const cx = require('classnames'); //Unused variable
const DISMISS_KEY = 'dismiss_notification7-24-19';
const NotificationPopup = createClass({
getInitialState : function() {
return {
notifications : {}
};
},
componentDidMount : function() {
this.checkNotifications();
window.addEventListener('resize', this.checkNotifications);
},
componentWillUnmount : function() {
window.removeEventListener('resize', this.checkNotifications);
},
notifications : {
psa : function(){
return <li key='psa'>
<em>Known bug: Grey Shadow Boxes </em> <br />
The shadows around certain brew elements such as notes and statblocks might appear as a solid grey box when generating a PDF. &nbsp;
<a target='_blank' href='https://old.reddit.com/r/homebrewery/comments/ch3v0d/psa_grey_boxesshadows_around_notes_stat_blocks_etc/'>
See this Reddit post
</a> for updates and possible workarounds.
</li>;
},
faq : function(){
return <li key='faq'>
<em>Protect your work! </em> <br />
At the moment we do not save a history of your projects, so please make frequent backups of your brews! &nbsp;
<a target='_blank' href='https://www.reddit.com/r/homebrewery/comments/adh6lh/faqs_psas_announcements/'>
See the FAQ
</a> to learn how to avoid losing your work!
</li>;
},
},
checkNotifications : function(){
const hideDismiss = localStorage.getItem(DISMISS_KEY);
if(hideDismiss) return this.setState({ notifications: {} });
this.setState({
notifications : _.mapValues(this.notifications, (fn)=>{ return fn(); }) //Convert notification functions into their return text value
});
},
dismiss : function(){
localStorage.setItem(DISMISS_KEY, true);
this.checkNotifications();
},
render : function(){
if(_.isEmpty(this.state.notifications)) return null;
return <div className='notificationPopup'>
<i className='fa fa-times dismiss' onClick={this.dismiss}/>
<i className='fa fa-info-circle info' />
<h3>Notice</h3>
<small>This website is always improving and we are still adding new features and squashing bugs. Keep the following in mind:</small>
<ul>{_.values(this.state.notifications)}</ul>
</div>;
}
});
module.exports = NotificationPopup;