diff --git a/common/app/flux/Store.js b/common/app/flux/Store.js index c745e16ac0751b..30ee4e7ff324eb 100644 --- a/common/app/flux/Store.js +++ b/common/app/flux/Store.js @@ -8,13 +8,17 @@ const initValue = { points: 0 }; -export default Store(initValue) - .refs({ displayName: 'AppStore' }) - .init(({ instance: appStore, args: [cat] }) => { +export default Store({ + refs: { + displayName: 'AppStore', + value: initValue + }, + init({ instance: appStore, args: [cat] }) { const { setUser, setTitle } = cat.getActions('appActions'); const register = createRegistrar(appStore); register(setter(fromMany(setUser, setTitle))); return appStore; - }); + } +}); diff --git a/common/app/routes/Hikes/components/Lecture.jsx b/common/app/routes/Hikes/components/Lecture.jsx index ea3c85191da5ab..e47dc0fc982776 100644 --- a/common/app/routes/Hikes/components/Lecture.jsx +++ b/common/app/routes/Hikes/components/Lecture.jsx @@ -1,6 +1,6 @@ import React, { PropTypes } from 'react'; import { Button, Col, Row, Panel } from 'react-bootstrap'; -import { Navigation } from 'react-router'; +import { History } from 'react-router'; import Vimeo from 'react-vimeo'; import debugFactory from 'debug'; @@ -8,7 +8,7 @@ const debug = debugFactory('freecc:hikes'); export default React.createClass({ displayName: 'Lecture', - mixins: [Navigation], + mixins: [History], propTypes: { currentHike: PropTypes.object, @@ -20,7 +20,7 @@ export default React.createClass({ handleFinish() { debug('loading questions'); const { dashedName } = this.props.params; - this.transitionTo(`/hikes/${dashedName}/questions/1`); + this.history.pushState(null, `/hikes/${dashedName}/questions/1`); }, renderTranscript(transcript, dashedName) { diff --git a/common/app/routes/Hikes/components/Question.jsx b/common/app/routes/Hikes/components/Question.jsx index e7fe7662d9be40..4f7e97f1492da6 100644 --- a/common/app/routes/Hikes/components/Question.jsx +++ b/common/app/routes/Hikes/components/Question.jsx @@ -1,6 +1,6 @@ import React, { PropTypes } from 'react'; import { Spring } from 'react-motion'; -import { Navigation, TransitionHook } from 'react-router'; +import { History, Lifecycle } from 'react-router'; import debugFactory from 'debug'; import { Button, @@ -19,8 +19,8 @@ export default React.createClass({ displayName: 'Question', mixins: [ - Navigation, - TransitionHook + History, + Lifecycle ], propTypes: { @@ -150,7 +150,8 @@ export default React.createClass({ postJSON$('/completed-challenge', { id, name }).subscribeOnCompleted(() => { if (tests[nextQuestionIndex]) { - return this.transitionTo( + return this.history.pushState( + null, `/hikes/${ dashedName }/questions/${ nextQuestionIndex + 1 }` ); } @@ -168,13 +169,13 @@ export default React.createClass({ }, null); if (nextHike) { - return this.transitionTo(`/hikes/${ nextHike.dashedName }`); + return this.history.pushState(null, `/hikes/${ nextHike.dashedName }`); } debug( 'next Hike was not found, currentHike %s', currentHike.dashedName ); - this.transitionTo('/hikes'); + this.history.pushState(null, '/hikes'); }); }, diff --git a/common/app/routes/Hikes/flux/Actions.js b/common/app/routes/Hikes/flux/Actions.js index 2d9d44a4fd29c9..f6ed407fae9dfe 100644 --- a/common/app/routes/Hikes/flux/Actions.js +++ b/common/app/routes/Hikes/flux/Actions.js @@ -3,7 +3,7 @@ import debugFactory from 'debug'; const debug = debugFactory('freecc:hikes:actions'); -function getCurrentHike(hikes =[{}], dashedName, currentHike) { +function getCurrentHike(hikes = [{}], dashedName, currentHike) { if (!dashedName) { debug('no dashedName'); return hikes[0]; diff --git a/common/app/routes/Hikes/flux/Store.js b/common/app/routes/Hikes/flux/Store.js index 4c7080b1c24f35..9755ed679ad8a2 100644 --- a/common/app/routes/Hikes/flux/Store.js +++ b/common/app/routes/Hikes/flux/Store.js @@ -5,12 +5,16 @@ const initialValue = { currentHike: {} }; -export default Store(initialValue) - .refs({ displayName: 'HikesStore'}) - .init(({ instance: hikeStore, args: [cat] }) => { +export default Store({ + refs: { + displayName: 'HikesStore', + value: initialValue + }, + init({ instance: hikeStore, args: [cat] }) { let { setHikes } = cat.getActions('hikesActions'); hikeStore.register(setHikes); return hikeStore; - }); + } +}); diff --git a/common/app/routes/Jobs/flux/Store.js b/common/app/routes/Jobs/flux/Store.js index b2f51320132496..8f3acd29497aef 100644 --- a/common/app/routes/Jobs/flux/Store.js +++ b/common/app/routes/Jobs/flux/Store.js @@ -6,9 +6,12 @@ const { transformer } = Store; -export default Store({ showModal: false }) - .refs({ displayName: 'JobsStore' }) - .init(({ instance: jobsStore, args: [cat] }) => { +export default Store({ + refs: { + displayName: 'JobsStore', + value: { showModal: false } + }, + init({ instance: jobsStore, args: [cat] }) { const { setJobs, findJob, @@ -27,4 +30,5 @@ export default Store({ showModal: false }) register(transformer(findJob)); register(handleForm); - }); + } +}); diff --git a/package.json b/package.json index c3f7c0bebbd271..06d6a933ce0479 100644 --- a/package.json +++ b/package.json @@ -63,8 +63,8 @@ "json-loader": "^0.5.2", "less": "~2.5.1", "lodash": "^3.9.3", - "loopback": "https://github.com/FreeCodeCamp/loopback.git#fix/no-password", - "loopback-boot": "2.8.2", + "loopback": "^2.22.0", + "loopback-boot": "^2.13.0", "loopback-component-passport": "https://github.com/FreeCodeCamp/loopback-component-passport.git#feature/flashfailure", "loopback-connector-mongodb": "^1.10.0", "lusca": "~1.0.2", @@ -89,17 +89,17 @@ "react": "^0.13.3", "react-bootstrap": "~0.23.7", "react-motion": "~0.1.0", - "react-router": "^1.0.0-rc1", + "react-router": "https://github.com/BerkeleyTrue/react-router.git#freecodecamp", "react-vimeo": "^0.0.3", "request": "~2.53.0", "rev-del": "^1.0.5", - "rx": "^2.5.3", + "rx": "^4.0.0", "sanitize-html": "~1.6.1", "sort-keys": "^1.1.1", "source-map-support": "^0.3.2", "store": "https://github.com/berkeleytrue/store.js.git#feature/noop-server", - "thundercats": "^2.1.0", - "thundercats-react": "^0.1.0", + "thundercats": "^3.0.0", + "thundercats-react": "^0.3.0", "twit": "~1.1.20", "uglify-js": "~2.4.15", "validator": "^3.22.1", diff --git a/server/boot/challenge.js b/server/boot/challenge.js index 3b973cc0ac7ed2..400c32db33c5d3 100644 --- a/server/boot/challenge.js +++ b/server/boot/challenge.js @@ -186,7 +186,7 @@ module.exports = function(app) { ); } const firstChallengeOfNextBlock$ = blocks$ - .elementAtOrDefault(blockIndex + 1, {}) + .elementAt(blockIndex + 1, {}) .map(({ challenges = [] }) => challenges[0]); return blocks$ @@ -259,7 +259,7 @@ module.exports = function(app) { .filter((challenge) => { return testChallengeName.test(challenge.name); }) - .lastOrDefault(null) + .last({ defaultValue: null }) .flatMap(challenge => { // Handle not found