0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-17 01:32:45 +00:00

Fixed the User page

This commit is contained in:
Scott Tolksdorf
2016-11-27 13:45:38 -05:00
parent 21d3c5bfc8
commit 30942785d1
6 changed files with 48 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ const RecentNavItem = require('../../navbar/recent.navitem.jsx');
const Account = require('../../navbar/account.navitem.jsx');
const BrewItem = require('./brewItem/brewItem.jsx');
const UserPage = React.createClass({
getDefaultProps: function() {
return {
@@ -18,6 +19,8 @@ const UserPage = React.createClass({
},
renderBrews : function(brews){
if(!brews || !brews.length) return <div className='noBrews'>No Brews.</div>
return _.map(brews, (brew, idx) => {
return <BrewItem brew={brew} key={idx}/>
});
@@ -29,10 +32,18 @@ const UserPage = React.createClass({
});
},
renderPrivateBrews : function(privateBrews){
if(!privateBrews || !privateBrews.length) return;
return [
<h1>{this.props.username}'s unpublished brews</h1>,
this.renderBrews(privateBrews)
];
},
render : function(){
const brews = this.getSortedBrews();
return <div className='userPage page'>
<Navbar>
<Nav.section>
@@ -45,8 +56,7 @@ const UserPage = React.createClass({
<div className='phb'>
<h1>{this.props.username}'s brews</h1>
{this.renderBrews(brews.published)}
{brews.private ? <h1>{this.props.username}'s unpublished brews</h1> : null}
{this.renderBrews(brews.private)}
{this.renderPrivateBrews(brews.private)}
</div>
</div>
</div>