const React = require('react');
const createClass = require('create-react-class');
const _ = require('lodash');
const cx = require('classnames'); //Unused variable
const DISMISS_KEY = 'dismiss_notification2-7-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
Known bug: Missing letters in PDF
With the latest Chrome update, certain characters appear as blank spaces when generating a PDF.
See this Reddit post
for updates and possible workarounds.
;
},
faq : function(){
return
Protect your work!
At the moment we do not save a history of your projects, so please make frequent backups of your brews!
See the FAQ
to learn how to avoid losing your work!
;
},
},
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
Notice
This website is always improving and we are still adding new features and squashing bugs. Keep the following in mind:
{_.values(this.state.notifications)}
;
}
});
module.exports = NotificationPopup;