mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-07 16:22:42 +00:00
Merge branch 'master' into dependabot/npm_and_yarn/babel/preset-env-7.24.5
This commit is contained in:
@@ -1,41 +1,25 @@
|
|||||||
require('./errorPage.less');
|
require('./errorPage.less');
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const createClass = require('create-react-class');
|
const UIPage = require('../basePages/uiPage/uiPage.jsx');
|
||||||
const _ = require('lodash');
|
const Markdown = require('../../../../shared/naturalcrit/markdown.js');
|
||||||
const cx = require('classnames');
|
|
||||||
|
|
||||||
const UIPage = require('../basePages/uiPage/uiPage.jsx');
|
|
||||||
|
|
||||||
const Markdown = require('../../../../shared/naturalcrit/markdown.js');
|
|
||||||
|
|
||||||
const ErrorIndex = require('./errors/errorIndex.js');
|
const ErrorIndex = require('./errors/errorIndex.js');
|
||||||
|
|
||||||
const ErrorPage = createClass({
|
const ErrorPage = ({ brew })=>{
|
||||||
displayName : 'ErrorPage',
|
// Retrieving the error text based on the brew's error code from ErrorIndex
|
||||||
|
const errorText = ErrorIndex({ brew })[brew.HBErrorCode.toString()] || '';
|
||||||
|
|
||||||
getDefaultProps : function() {
|
return (
|
||||||
return {
|
<UIPage brew={{ title: 'Crit Fail!' }}>
|
||||||
ver : '0.0.0',
|
|
||||||
errorId : '',
|
|
||||||
text : '# Oops \n We could not find a brew with that id. **Sorry!**',
|
|
||||||
error : {}
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
render : function(){
|
|
||||||
const errorText = ErrorIndex(this.props)[this.props.brew.HBErrorCode.toString()] || '';
|
|
||||||
|
|
||||||
return <UIPage brew={{ title: 'Crit Fail!' }}>
|
|
||||||
<div className='dataGroup'>
|
<div className='dataGroup'>
|
||||||
<div className='errorTitle'>
|
<div className='errorTitle'>
|
||||||
<h1>{`Error ${this.props.brew.status || '000'}`}</h1>
|
<h1>{`Error ${brew?.status || '000'}`}</h1>
|
||||||
<h4>{this.props.brew.text || 'No error text'}</h4>
|
<h4>{brew?.text || 'No error text'}</h4>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
<div dangerouslySetInnerHTML={{ __html: Markdown.render(errorText) }} />
|
<div dangerouslySetInnerHTML={{ __html: Markdown.render(errorText) }} />
|
||||||
</div>
|
</div>
|
||||||
</UIPage>;
|
</UIPage>
|
||||||
}
|
);
|
||||||
});
|
};
|
||||||
|
|
||||||
module.exports = ErrorPage;
|
module.exports = ErrorPage;
|
||||||
|
|||||||
Reference in New Issue
Block a user