Update loopback, ThunderCats and RxJS.

closes #2929
This commit is contained in:
Berkeley Martinez
2015-10-11 15:57:49 -07:00
parent 02ed450b96
commit 7b444b15dc
8 changed files with 43 additions and 30 deletions

View File

@ -8,13 +8,17 @@ const initValue = {
points: 0 points: 0
}; };
export default Store(initValue) export default Store({
.refs({ displayName: 'AppStore' }) refs: {
.init(({ instance: appStore, args: [cat] }) => { displayName: 'AppStore',
value: initValue
},
init({ instance: appStore, args: [cat] }) {
const { setUser, setTitle } = cat.getActions('appActions'); const { setUser, setTitle } = cat.getActions('appActions');
const register = createRegistrar(appStore); const register = createRegistrar(appStore);
register(setter(fromMany(setUser, setTitle))); register(setter(fromMany(setUser, setTitle)));
return appStore; return appStore;
}); }
});

View File

@ -1,6 +1,6 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { Button, Col, Row, Panel } from 'react-bootstrap'; import { Button, Col, Row, Panel } from 'react-bootstrap';
import { Navigation } from 'react-router'; import { History } from 'react-router';
import Vimeo from 'react-vimeo'; import Vimeo from 'react-vimeo';
import debugFactory from 'debug'; import debugFactory from 'debug';
@ -8,7 +8,7 @@ const debug = debugFactory('freecc:hikes');
export default React.createClass({ export default React.createClass({
displayName: 'Lecture', displayName: 'Lecture',
mixins: [Navigation], mixins: [History],
propTypes: { propTypes: {
currentHike: PropTypes.object, currentHike: PropTypes.object,
@ -20,7 +20,7 @@ export default React.createClass({
handleFinish() { handleFinish() {
debug('loading questions'); debug('loading questions');
const { dashedName } = this.props.params; const { dashedName } = this.props.params;
this.transitionTo(`/hikes/${dashedName}/questions/1`); this.history.pushState(null, `/hikes/${dashedName}/questions/1`);
}, },
renderTranscript(transcript, dashedName) { renderTranscript(transcript, dashedName) {

View File

@ -1,6 +1,6 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { Spring } from 'react-motion'; import { Spring } from 'react-motion';
import { Navigation, TransitionHook } from 'react-router'; import { History, Lifecycle } from 'react-router';
import debugFactory from 'debug'; import debugFactory from 'debug';
import { import {
Button, Button,
@ -19,8 +19,8 @@ export default React.createClass({
displayName: 'Question', displayName: 'Question',
mixins: [ mixins: [
Navigation, History,
TransitionHook Lifecycle
], ],
propTypes: { propTypes: {
@ -150,7 +150,8 @@ export default React.createClass({
postJSON$('/completed-challenge', { id, name }).subscribeOnCompleted(() => { postJSON$('/completed-challenge', { id, name }).subscribeOnCompleted(() => {
if (tests[nextQuestionIndex]) { if (tests[nextQuestionIndex]) {
return this.transitionTo( return this.history.pushState(
null,
`/hikes/${ dashedName }/questions/${ nextQuestionIndex + 1 }` `/hikes/${ dashedName }/questions/${ nextQuestionIndex + 1 }`
); );
} }
@ -168,13 +169,13 @@ export default React.createClass({
}, null); }, null);
if (nextHike) { if (nextHike) {
return this.transitionTo(`/hikes/${ nextHike.dashedName }`); return this.history.pushState(null, `/hikes/${ nextHike.dashedName }`);
} }
debug( debug(
'next Hike was not found, currentHike %s', 'next Hike was not found, currentHike %s',
currentHike.dashedName currentHike.dashedName
); );
this.transitionTo('/hikes'); this.history.pushState(null, '/hikes');
}); });
}, },

View File

@ -3,7 +3,7 @@ import debugFactory from 'debug';
const debug = debugFactory('freecc:hikes:actions'); const debug = debugFactory('freecc:hikes:actions');
function getCurrentHike(hikes =[{}], dashedName, currentHike) { function getCurrentHike(hikes = [{}], dashedName, currentHike) {
if (!dashedName) { if (!dashedName) {
debug('no dashedName'); debug('no dashedName');
return hikes[0]; return hikes[0];

View File

@ -5,12 +5,16 @@ const initialValue = {
currentHike: {} currentHike: {}
}; };
export default Store(initialValue) export default Store({
.refs({ displayName: 'HikesStore'}) refs: {
.init(({ instance: hikeStore, args: [cat] }) => { displayName: 'HikesStore',
value: initialValue
},
init({ instance: hikeStore, args: [cat] }) {
let { setHikes } = cat.getActions('hikesActions'); let { setHikes } = cat.getActions('hikesActions');
hikeStore.register(setHikes); hikeStore.register(setHikes);
return hikeStore; return hikeStore;
}); }
});

View File

@ -6,9 +6,12 @@ const {
transformer transformer
} = Store; } = Store;
export default Store({ showModal: false }) export default Store({
.refs({ displayName: 'JobsStore' }) refs: {
.init(({ instance: jobsStore, args: [cat] }) => { displayName: 'JobsStore',
value: { showModal: false }
},
init({ instance: jobsStore, args: [cat] }) {
const { const {
setJobs, setJobs,
findJob, findJob,
@ -27,4 +30,5 @@ export default Store({ showModal: false })
register(transformer(findJob)); register(transformer(findJob));
register(handleForm); register(handleForm);
}); }
});

View File

@ -63,8 +63,8 @@
"json-loader": "^0.5.2", "json-loader": "^0.5.2",
"less": "~2.5.1", "less": "~2.5.1",
"lodash": "^3.9.3", "lodash": "^3.9.3",
"loopback": "https://github.com/FreeCodeCamp/loopback.git#fix/no-password", "loopback": "^2.22.0",
"loopback-boot": "2.8.2", "loopback-boot": "^2.13.0",
"loopback-component-passport": "https://github.com/FreeCodeCamp/loopback-component-passport.git#feature/flashfailure", "loopback-component-passport": "https://github.com/FreeCodeCamp/loopback-component-passport.git#feature/flashfailure",
"loopback-connector-mongodb": "^1.10.0", "loopback-connector-mongodb": "^1.10.0",
"lusca": "~1.0.2", "lusca": "~1.0.2",
@ -89,17 +89,17 @@
"react": "^0.13.3", "react": "^0.13.3",
"react-bootstrap": "~0.23.7", "react-bootstrap": "~0.23.7",
"react-motion": "~0.1.0", "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", "react-vimeo": "^0.0.3",
"request": "~2.53.0", "request": "~2.53.0",
"rev-del": "^1.0.5", "rev-del": "^1.0.5",
"rx": "^2.5.3", "rx": "^4.0.0",
"sanitize-html": "~1.6.1", "sanitize-html": "~1.6.1",
"sort-keys": "^1.1.1", "sort-keys": "^1.1.1",
"source-map-support": "^0.3.2", "source-map-support": "^0.3.2",
"store": "https://github.com/berkeleytrue/store.js.git#feature/noop-server", "store": "https://github.com/berkeleytrue/store.js.git#feature/noop-server",
"thundercats": "^2.1.0", "thundercats": "^3.0.0",
"thundercats-react": "^0.1.0", "thundercats-react": "^0.3.0",
"twit": "~1.1.20", "twit": "~1.1.20",
"uglify-js": "~2.4.15", "uglify-js": "~2.4.15",
"validator": "^3.22.1", "validator": "^3.22.1",

View File

@ -186,7 +186,7 @@ module.exports = function(app) {
); );
} }
const firstChallengeOfNextBlock$ = blocks$ const firstChallengeOfNextBlock$ = blocks$
.elementAtOrDefault(blockIndex + 1, {}) .elementAt(blockIndex + 1, {})
.map(({ challenges = [] }) => challenges[0]); .map(({ challenges = [] }) => challenges[0]);
return blocks$ return blocks$
@ -259,7 +259,7 @@ module.exports = function(app) {
.filter((challenge) => { .filter((challenge) => {
return testChallengeName.test(challenge.name); return testChallengeName.test(challenge.name);
}) })
.lastOrDefault(null) .last({ defaultValue: null })
.flatMap(challenge => { .flatMap(challenge => {
// Handle not found // Handle not found