0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-13 06:32:39 +00:00

Creating a brand new admin page

This commit is contained in:
Scott Tolksdorf
2017-01-09 20:11:01 -05:00
parent 1aa79b32d9
commit 37de888f03
10 changed files with 159 additions and 46 deletions

View File

@@ -1,38 +1,42 @@
var React = require('react'); const React = require('react');
var _ = require('lodash'); const _ = require('lodash');
var cx = require('classnames');
var HomebrewAdmin = require('./homebrewAdmin/homebrewAdmin.jsx'); const Nav = require('naturalcrit/nav/nav.jsx');
var Admin = React.createClass({ //const HomebrewAdmin = require('./homebrewAdmin/homebrewAdmin.jsx');
const BrewLookup = require('./brewLookup/brewLookup.jsx');
const Admin = React.createClass({
getDefaultProps: function() { getDefaultProps: function() {
return { return {
url : "", admin_key : '',
admin_key : "",
homebrews : [],
}; };
}, },
renderNavbar : function(){
return <Nav.base>
<Nav.section>
<Nav.item icon='fa-magic' className='homebreweryLogo'>
Homebrewery Admin
</Nav.item>
</Nav.section>
</Nav.base>
},
render : function(){ render : function(){
var self = this; return <div className='admin'>
return( {this.renderNavbar()}
<div className='admin'> <main className='content'>
<BrewLookup adminKey={this.props.admin_key} />
<header> Test
<div className='container'>
<i className='fa fa-rocket' />
naturalcrit admin
</div>
</header>
<div className='container'>
<HomebrewAdmin homebrews={this.props.homebrews} admin_key={this.props.admin_key} />
</div>
</div> </main>
); </div>
} }
}); });

View File

@@ -1,19 +1,11 @@
@import 'naturalcrit/styles/reset.less'; @import 'naturalcrit/styles/core.less';
@import 'naturalcrit/styles/elements.less';
@import 'naturalcrit/styles/animations.less';
@import 'naturalcrit/styles/colors.less';
@import 'naturalcrit/styles/tooltip.less';
@import 'font-awesome/css/font-awesome.css'; html,body, #reactRoot{
html,body, #reactContainer, .naturalCrit{
min-height : 100%; min-height : 100%;
} }
@sidebarWidth : 250px;
body{ body{
background-color : #eee; background-color : #ddd;
font-family : 'Open Sans', sans-serif; font-family : 'Open Sans', sans-serif;
color : #4b5055; color : #4b5055;
font-weight : 100; font-weight : 100;
@@ -23,17 +15,35 @@ body{
height : 100%; height : 100%;
} }
.admin{ .admin {
nav {
header{ background-color: @red;
background-color : @red; .navItem{
font-size: 2em; background-color: @red;
padding : 20px 0px; }
color : white; .homebreweryLogo{
margin-bottom: 30px; font-family : CodeBold;
i{ font-size : 12px;
margin-right: 30px; color : white;
div{
margin-top : 2px;
margin-bottom : -2px;
}
} }
} }
} h1{
font-size: 2em;
font-weight: 800;
border-bottom: 1px solid #ddd;
margin-bottom: 10px;
}
main.content{
background-color: white;
padding: 50px 20px;
width : 1000px;
margin: 0 auto;
}
}

View File

@@ -0,0 +1,19 @@
const React = require('react');
const _ = require('lodash');
const cx = require('classnames');
const AdminSearch = React.createClass({
getDefaultProps: function() {
return {
};
},
render: function(){
return <div className='adminSearch'>
AdminSearch Component Ready.
</div>
}
});
module.exports = AdminSearch;

View File

@@ -0,0 +1,3 @@
.adminSearch{
}

View File

@@ -0,0 +1,45 @@
const React = require('react');
const _ = require('lodash');
const cx = require('classnames');
const request = require('superagent');
const BrewLookup = React.createClass({
getDefaultProps: function() {
return {
adminKey : '',
};
},
getInitialState: function() {
return {
query:'',
resultBrew : null
};
},
handleChange : function(e){
this.setState({
query : e.target.value
})
},
lookup : function(){
},
renderFoundBrew : function(){
if(!this.state.resultBrew) return null;
},
render: function(){
return <div className='brewLookup'>
<h1>Brew Lookup</h1>
<input type='text' value={this.state.query} onChange={this.handleChange} placeholder='edit or share id...' />
<button onClick={this.lookup}><i className='fa fa-search'/></button>
{this.renderFoundBrew()}
</div>
}
});
module.exports = BrewLookup;

View File

@@ -0,0 +1,8 @@
.brewLookup{
height : 200px;
input{
height : 33px;
padding : 0px 10px;
}
}

View File

@@ -0,0 +1,19 @@
const React = require('react');
const _ = require('lodash');
const cx = require('classnames');
const InvalidBrew = React.createClass({
getDefaultProps: function() {
return {
};
},
render: function(){
return <div className='invalidBrew'>
InvalidBrew Component Ready.
</div>
}
});
module.exports = InvalidBrew;

View File

@@ -0,0 +1,3 @@
.invalidBrew{
}

View File

@@ -52,6 +52,7 @@ const UserPage = React.createClass({
render : function(){ render : function(){
const brews = this.getSortedBrews(); const brews = this.getSortedBrews();
console.log('user brews', brews);
return <div className='userPage page'> return <div className='userPage page'>
<Navbar> <Navbar>

View File

@@ -8,6 +8,7 @@ const mw = require('./middleware.js');
const BrewData = require('./brew.data.js'); const BrewData = require('./brew.data.js');
router.get('/admin', mw.adminLogin, (req, res, next) => { router.get('/admin', mw.adminLogin, (req, res, next) => {
console.log('yo');
return vitreumRender('admin', templateFn, { return vitreumRender('admin', templateFn, {
url : req.originalUrl, url : req.originalUrl,
admin_key : config.get('admin:key') admin_key : config.get('admin:key')