Skip to content

Commit

Permalink
Merge branch 'master' into addLockRoutes-naturalcrit#3326
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Ambatte authored May 8, 2024
2 parents 20d48d7 + dd82a1b commit bf88f63
Show file tree
Hide file tree
Showing 9 changed files with 483 additions and 365 deletions.
42 changes: 13 additions & 29 deletions client/homebrew/pages/errorPage/errorPage.jsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,25 @@
require('./errorPage.less');
const React = require('react');
const createClass = require('create-react-class');
const _ = require('lodash');
const cx = require('classnames');

const UIPage = require('../basePages/uiPage/uiPage.jsx');

const Markdown = require('../../../../shared/naturalcrit/markdown.js');

const React = require('react');
const UIPage = require('../basePages/uiPage/uiPage.jsx');
const Markdown = require('../../../../shared/naturalcrit/markdown.js');
const ErrorIndex = require('./errors/errorIndex.js');

const ErrorPage = createClass({
displayName : 'ErrorPage',

getDefaultProps : function() {
return {
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()] || '';
const ErrorPage = ({ brew })=>{
// Retrieving the error text based on the brew's error code from ErrorIndex
const errorText = ErrorIndex({ brew })[brew.HBErrorCode.toString()] || '';

return <UIPage brew={{ title: 'Crit Fail!' }}>
return (
<UIPage brew={{ title: 'Crit Fail!' }}>
<div className='dataGroup'>
<div className='errorTitle'>
<h1>{`Error ${this.props.brew.status || '000'}`}</h1>
<h4>{this.props.brew.text || 'No error text'}</h4>
<h1>{`Error ${brew?.status || '000'}`}</h1>
<h4>{brew?.text || 'No error text'}</h4>
</div>
<hr />
<div dangerouslySetInnerHTML={{ __html: Markdown.render(errorText) }} />
</div>
</UIPage>;
}
});
</UIPage>
);
};

module.exports = ErrorPage;
20 changes: 17 additions & 3 deletions client/homebrew/pages/sharePage/sharePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ const SharePage = createClass({
this.props.brew.shareId;
},

renderEditLink : function(){
if(!this.props.brew.editId) return;

let editLink = this.props.brew.editId;
if(this.props.brew.googleId && !this.props.brew.stubbed) {
editLink = this.props.brew.googleId + editLink;
}

return <Nav.item color='orange' icon='fas fa-pencil-alt' href={`/edit/${editLink}`}>
edit
</Nav.item>;
},

render : function(){
return <div className='sharePage sitePage'>
<Meta name='robots' content='noindex, nofollow' />
Expand All @@ -64,13 +77,14 @@ const SharePage = createClass({
<Nav.item color='red' icon='fas fa-code'>
source
</Nav.item>
<Nav.item color='blue' href={`/source/${this.processShareId()}`}>
<Nav.item color='blue' icon='fas fa-eye' href={`/source/${this.processShareId()}`}>
view
</Nav.item>
<Nav.item color='blue' href={`/download/${this.processShareId()}`}>
{this.renderEditLink()}
<Nav.item color='blue' icon='fas fa-download' href={`/download/${this.processShareId()}`}>
download
</Nav.item>
<Nav.item color='blue' href={`/new/${this.processShareId()}`}>
<Nav.item color='blue' icon='fas fa-clone' href={`/new/${this.processShareId()}`}>
clone to new
</Nav.item>
</Nav.dropdown>
Expand Down
Loading

0 comments on commit bf88f63

Please sign in to comment.