mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-29 06:52:41 +00:00
renamed render warnings and now built into the brewrenderer
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
- Fixed realtime renderer not functioning if loaded with malformed html on load (thanks u/RattiganIV re:247)
|
||||
- Removed a lot of unused files in shared
|
||||
- vitreum v4 now lets me use codemirror as a pure node dependacy
|
||||
- Added a new Render Warning overlay. It detects situations where the brew may not be rendering correctly (wrong browser, browser is zoomed in...) and let's the user know
|
||||
|
||||
|
||||
### Saturday, 03/12/2016 - v2.6.0
|
||||
|
||||
@@ -5,6 +5,9 @@ const cx = require('classnames');
|
||||
const Markdown = require('naturalcrit/markdown.js');
|
||||
const ErrorBar = require('./errorBar/errorBar.jsx');
|
||||
|
||||
//TODO: move to the brew renderer
|
||||
const RenderWarnings = require('homebrewery/renderWarnings/renderWarnings.jsx')
|
||||
|
||||
const PAGE_HEIGHT = 1056;
|
||||
const PPR_THRESHOLD = 50;
|
||||
|
||||
@@ -132,6 +135,7 @@ const BrewRenderer = React.createClass({
|
||||
style={{height : this.state.height}}>
|
||||
|
||||
<ErrorBar errors={this.props.errors} />
|
||||
<RenderWarnings />
|
||||
|
||||
<div className='pages' ref='pages'>
|
||||
{this.renderPages()}
|
||||
|
||||
@@ -17,8 +17,6 @@ const BrewRenderer = require('../../brewRenderer/brewRenderer.jsx');
|
||||
|
||||
const Markdown = require('naturalcrit/markdown.js');
|
||||
|
||||
const Warnings = require('homebrewery/warnings/warnings.jsx')
|
||||
|
||||
const SAVE_TIMEOUT = 3000;
|
||||
|
||||
|
||||
@@ -213,8 +211,6 @@ const EditPage = React.createClass({
|
||||
return <div className='editPage page'>
|
||||
{this.renderNavbar()}
|
||||
|
||||
<Warnings />
|
||||
|
||||
<div className='content'>
|
||||
<SplitPane onDragFinish={this.handleSplitMove} ref='pane'>
|
||||
<Editor
|
||||
|
||||
@@ -3,7 +3,7 @@ const React = require('react');
|
||||
const _ = require('lodash');
|
||||
const cx = require('classnames');
|
||||
|
||||
const Warnings = React.createClass({
|
||||
const RenderWarnings = React.createClass({
|
||||
getInitialState: function() {
|
||||
return {
|
||||
warnings: {}
|
||||
@@ -18,21 +18,27 @@ const Warnings = React.createClass({
|
||||
warnings : {
|
||||
chrome : function(){
|
||||
const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
|
||||
if(isChrome){
|
||||
return 'OPtimized for Chrome';
|
||||
if(!isChrome){
|
||||
return <li key='chrome'>
|
||||
<em>Built for Chrome </em> <br />
|
||||
Other browsers do not support key features this site uses.
|
||||
</li>;
|
||||
}
|
||||
},
|
||||
zoom : function(){
|
||||
if(window.devicePixelRatio !== 1){
|
||||
return 'You are zoomed';
|
||||
return <li key='zoom'>
|
||||
<em>Your browser is zoomed. </em> <br />
|
||||
This can cause content to jump columns.
|
||||
</li>;
|
||||
}
|
||||
}
|
||||
},
|
||||
checkWarnings : function(){
|
||||
this.setState({
|
||||
warnings : _.reduce(this.warnings, (r, fn, type) => {
|
||||
const text = fn();
|
||||
if(text) r[type] = text;
|
||||
const element = fn();
|
||||
if(element) r[type] = element;
|
||||
return r;
|
||||
}, {})
|
||||
})
|
||||
@@ -40,17 +46,13 @@ const Warnings = React.createClass({
|
||||
render: function(){
|
||||
if(_.isEmpty(this.state.warnings)) return null;
|
||||
|
||||
const errors = _.map(this.state.warnings, (text, idx) => {
|
||||
return <li key={idx}>{text}</li>
|
||||
});
|
||||
|
||||
return <div className='warnings'>
|
||||
return <div className='renderWarnings'>
|
||||
<i className='fa fa-exclamation-triangle' />
|
||||
<h3>Rendering Warnings</h3>
|
||||
<h3>Render Warnings</h3>
|
||||
<small>If this homebrew is rendering badly if might be because of the following:</small>
|
||||
<ul>{errors}</ul>
|
||||
<ul>{_.values(this.state.warnings)}</ul>
|
||||
</div>
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Warnings;
|
||||
module.exports = RenderWarnings;
|
||||
@@ -2,19 +2,21 @@
|
||||
.warnings{
|
||||
position : fixed;
|
||||
display : inline-block;
|
||||
top : @navbarHeight;
|
||||
right : 15px;
|
||||
z-index : 10001;
|
||||
width : 350px;
|
||||
padding : 20px;
|
||||
padding-bottom : 10px;
|
||||
padding-left : 100px;
|
||||
right : 0px;
|
||||
top : @navbarHeight;
|
||||
background-color : @orange;
|
||||
padding-left : 85px;
|
||||
background-color : @yellow;
|
||||
color : white;
|
||||
i{
|
||||
position : absolute;
|
||||
left : 30px;
|
||||
opacity : 0.8;
|
||||
font-size : 3em;
|
||||
position: absolute;
|
||||
left: 24px;
|
||||
opacity: 0.8;
|
||||
font-size: 2.5em;
|
||||
top: 24px;
|
||||
}
|
||||
small{
|
||||
opacity : 0.7;
|
||||
@@ -27,10 +29,14 @@
|
||||
ul{
|
||||
margin-top : 15px;
|
||||
font-size : 0.8em;
|
||||
list-style-position : inside;
|
||||
list-style-position : outside;
|
||||
list-style-type : disc;
|
||||
li{
|
||||
line-height : 1.6em;
|
||||
font-size: 0.8em;
|
||||
em{
|
||||
font-weight: 800;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user