import React, { PropTypes } from 'react';
import { LinkContainer } from 'react-router-bootstrap';
import {
Col,
Nav,
NavbarBrand,
Navbar,
NavItem
} from 'react-bootstrap';
import navLinks from './links.json';
import FCCNavItem from './NavItem.jsx';
const win = typeof window !== 'undefined' ? window : {};
const fCClogo = 'https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg';
const logoElement = (
);
const toggleButtonChild = (
Menu
);
function getDashedName() {
let challengeDashedName;
if (typeof win.localStorage !== 'undefined') {
challengeDashedName = win.localStorage.getItem('currentDashedName');
}
return challengeDashedName && challengeDashedName !== 'undefined' ?
challengeDashedName :
'';
}
export default React.createClass({
displayName: 'Nav',
propTypes: {
points: PropTypes.number,
picture: PropTypes.string,
signedIn: PropTypes.bool,
username: PropTypes.string
},
renderLinks() {
return navLinks.map(({ content, link, react, target }, index) => {
if (react) {
return (
{ content }
);
}
return (
{ content }
);
});
},
renderLearnBtn() {
return (
{
const challengeDashedName = getDashedName();
const goTo = challengeDashedName ?
'/challenges/' + challengeDashedName :
'/map';
win.location = goTo;
}}>
Learn
);
},
renderPoints(username, points) {
if (!username) {
return null;
}
return (
[ { points } ]
);
},
renderSignin(username, picture) {
if (username) {
return (
);
} else {
return (
Sign In
);
}
},
render() {
const { username, points, picture } = this.props;
return (
{ logoElement }
);
}
});