Files
freeCodeCamp/common/app/routes/challenges/index.js
Berkeley Martinez c547c26bba Fix: map should redirect to current challenge (#15723)
* fix(routes): /map redirects to current challenge

* fix(map): Normalize server map building

Localize all server code dealing with the map

* refactor(server): Remove unused services

* feat(Nav): Show Map button when no panes

This gives user the ability to quickly return to their challenge using a
known feature

* fix(server.map): Add caching to nameIdMap

Add caching to nameIdMap on the server

* fix(services.map): Fix map service

Move map building utils to map util. Fix bad import. Normalize challenge
lookup
2017-08-03 22:45:36 -05:00

31 lines
813 B
JavaScript

import Show from './Show.jsx';
import { panesMap as backendPanesMap } from './views/backend';
import { panesMap as classicPanesMap } from './views/classic';
import { panesMap as stepPanesMap } from './views/step';
import { panesMap as projectPanesMap } from './views/project';
export function createPanesMap() {
return {
...backendPanesMap,
...classicPanesMap,
...stepPanesMap,
...projectPanesMap
};
}
export default function challengesRoutes() {
return [{
path: 'challenges(/:dashedName)',
component: Show,
onEnter(nextState, replace) {
// redirect /challenges to /map
if (nextState.location.pathname === '/challenges') {
replace('/challenges/current-challenge');
}
}
}, {
path: 'challenges/:block/:dashedName',
component: Show
}];
}