Skip to content

Commit

Permalink
Update loopback, ThunderCats and RxJS.
Browse files Browse the repository at this point in the history
  • Loading branch information
Berkeley Martinez authored and Berkeley Martinez committed Oct 12, 2015
1 parent 02ed450 commit 7b444b1
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 30 deletions.
12 changes: 8 additions & 4 deletions common/app/flux/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
});
6 changes: 3 additions & 3 deletions common/app/routes/Hikes/components/Lecture.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
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';

const debug = debugFactory('freecc:hikes');

export default React.createClass({
displayName: 'Lecture',
mixins: [Navigation],
mixins: [History],

propTypes: {
currentHike: PropTypes.object,
Expand All @@ -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) {
Expand Down
13 changes: 7 additions & 6 deletions common/app/routes/Hikes/components/Question.jsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -19,8 +19,8 @@ export default React.createClass({
displayName: 'Question',

mixins: [
Navigation,
TransitionHook
History,
Lifecycle
],

propTypes: {
Expand Down Expand Up @@ -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 }`
);
}
Expand All @@ -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');
});
},

Expand Down
2 changes: 1 addition & 1 deletion common/app/routes/Hikes/flux/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
12 changes: 8 additions & 4 deletions common/app/routes/Hikes/flux/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}
});
12 changes: 8 additions & 4 deletions common/app/routes/Jobs/flux/Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -27,4 +30,5 @@ export default Store({ showModal: false })

register(transformer(findJob));
register(handleForm);
});
}
});
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions server/boot/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ module.exports = function(app) {
);
}
const firstChallengeOfNextBlock$ = blocks$
.elementAtOrDefault(blockIndex + 1, {})
.elementAt(blockIndex + 1, {})
.map(({ challenges = [] }) => challenges[0]);

return blocks$
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7b444b1

Please sign in to comment.