mirror of
https://github.com/naturalcrit/naturalcrit.git
synced 2025-10-27 07:29:54 +00:00
Add environment context info
This commit is contained in:
parent
b20d20d9ab
commit
89625fa1cf
@ -17,6 +17,7 @@ const Naturalcrit = React.createClass({
|
||||
url: '',
|
||||
domain: '',
|
||||
authToken: '',
|
||||
environment: '',
|
||||
};
|
||||
},
|
||||
|
||||
@ -52,14 +53,19 @@ const Naturalcrit = React.createClass({
|
||||
return accountLink;
|
||||
},
|
||||
|
||||
renderEnviroment: function () {
|
||||
const env = this.props.environment;
|
||||
if (env[0] === 'production' && !env[1]) return; // Live site
|
||||
if (env[0] === 'production' && env[1]) return <div className="environment">PR - {env[1]}</div>; // PR
|
||||
return <div className="environment">Local</div>; // Local
|
||||
},
|
||||
|
||||
render: function () {
|
||||
console.log(this.props);
|
||||
const isLocal = this.props.domain === ".local.naturalcrit.com";
|
||||
return (
|
||||
<div className="naturalcrit">
|
||||
<Router initialUrl={this.props.url} />
|
||||
<div className={`accountButton ${this.props.user ? '' : 'login'}`}>{this.renderAccount()}</div>
|
||||
<div class="environment"></div>
|
||||
{this.renderEnviroment()}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
|
||||
@ -90,4 +90,17 @@ button {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
.environment {
|
||||
font-family: 'CodeBold';
|
||||
letter-spacing: 2px;
|
||||
position: fixed;
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
background-color: #840000;
|
||||
padding: 12px 20px;
|
||||
color: white;
|
||||
text-transform: uppercase;
|
||||
text-align: center;
|
||||
}
|
||||
@ -55,7 +55,6 @@ app.all('/homebrew*', (req, res) => {
|
||||
return res.redirect(302, 'https://homebrewery.naturalcrit.com' + req.url.replace('/homebrew', ''));
|
||||
});
|
||||
|
||||
|
||||
const render = require('./scripts/steps/render.js');
|
||||
const templateFn = require('./client/template.js');
|
||||
|
||||
@ -71,7 +70,8 @@ app.get('*', (req, res) => {
|
||||
url : req.url,
|
||||
user : req.user,
|
||||
//authToken : authToken,
|
||||
domain : config.get('domain')
|
||||
domain : config.get('domain'),
|
||||
environment: [process.env.NODE_ENV,process.env.HEROKU_PR_NUMBER]
|
||||
})
|
||||
.then((page) => res.send(page))
|
||||
.catch((err) => console.log(err));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user