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

View File

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