Fix(map): prevent map drawer from opening on map route

This commit is contained in:
Berkeley Martinez
2016-06-27 20:11:52 -07:00
parent f736042bfc
commit 4314cebb06
2 changed files with 11 additions and 8 deletions

View File

@@ -60,7 +60,9 @@ const bindableActions = {
// export plain class for testing
export class FreeCodeCamp extends React.Component {
static displayName = 'FreeCodeCamp';
static contextTypes = {
router: PropTypes.object
};
static propTypes = {
children: PropTypes.node,
username: PropTypes.string,
@@ -77,7 +79,8 @@ export class FreeCodeCamp extends React.Component {
toggleMapDrawer: PropTypes.func,
toggleMainChat: PropTypes.func,
fetchUser: PropTypes.func,
shouldShowSignIn: PropTypes.bool
shouldShowSignIn: PropTypes.bool,
params: PropTypes.object
};
componentWillReceiveProps({
@@ -135,6 +138,7 @@ export class FreeCodeCamp extends React.Component {
}
render() {
const { router } = this.context;
const {
username,
points,
@@ -144,9 +148,11 @@ export class FreeCodeCamp extends React.Component {
isMapAlreadyLoaded,
toggleMapDrawer,
toggleMainChat,
shouldShowSignIn
shouldShowSignIn,
params: { lang }
} = this.props;
const navProps = {
isOnMap: router.isActive(`/${lang}/map`),
username,
points,
picture,

View File

@@ -32,14 +32,12 @@ const toggleButtonChild = (
export default class extends React.Component {
static displayName = 'Nav';
static contextTypes = {
router: PropTypes.object
};
static propTypes = {
points: PropTypes.number,
picture: PropTypes.string,
signedIn: PropTypes.bool,
username: PropTypes.string,
isOnMap: PropTypes.bool,
updateNavHeight: PropTypes.func,
toggleMapDrawer: PropTypes.func,
toggleMainChat: PropTypes.func,
@@ -184,12 +182,11 @@ export default class extends React.Component {
username,
points,
picture,
isOnMap,
toggleMapDrawer,
toggleMainChat,
shouldShowSignIn
} = this.props;
const { router } = this.context;
const isOnMap = router.isActive('/map');
return (
<Navbar