Update client dependencies

This commit is contained in:
Ken-Håvard Lieng 2016-01-15 20:56:03 +01:00
parent 383ca39354
commit d023f63a7c
9 changed files with 48 additions and 41 deletions

File diff suppressed because one or more lines are too long

View File

@ -13,9 +13,9 @@
"babel-preset-react": "^6.3.13", "babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13", "babel-preset-stage-0": "^6.3.13",
"eslint": "^1.10.3", "eslint": "^1.10.3",
"eslint-config-airbnb": "^3.0.1", "eslint-config-airbnb": "^3.1.0",
"eslint-loader": "^1.2.0", "eslint-loader": "^1.2.0",
"eslint-plugin-react": "^3.14.0", "eslint-plugin-react": "^3.15.0",
"express": "^4.13.3", "express": "^4.13.3",
"gulp": "^3.9.0", "gulp": "^3.9.0",
"gulp-autoprefixer": "3.1.0", "gulp-autoprefixer": "3.1.0",
@ -30,8 +30,8 @@
"redbox-react": "^1.2.0", "redbox-react": "^1.2.0",
"redux-devtools": "^3.0.1", "redux-devtools": "^3.0.1",
"redux-devtools-dock-monitor": "^1.0.1", "redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.1", "redux-devtools-log-monitor": "^1.0.2",
"webpack": "^1.12.10", "webpack": "^1.12.11",
"webpack-dev-middleware": "^1.4.0", "webpack-dev-middleware": "^1.4.0",
"webpack-hot-middleware": "^2.6.0" "webpack-hot-middleware": "^2.6.0"
}, },
@ -40,18 +40,18 @@
"backo": "^1.1.0", "backo": "^1.1.0",
"base64-arraybuffer": "^0.1.5", "base64-arraybuffer": "^0.1.5",
"eventemitter2": "^0.4.14", "eventemitter2": "^0.4.14",
"history": "^1.17.0", "history": "^2.0.0-rc2",
"immutable": "^3.7.6", "immutable": "^3.7.6",
"lodash": "^3.10.1", "lodash": "^4.0.0",
"pure-render-decorator": "^0.2.0", "pure-render-decorator": "^0.2.0",
"react": "^0.14.5", "react": "^0.14.6",
"react-dom": "^0.14.5", "react-dom": "^0.14.6",
"react-infinite": "0.7.3", "react-infinite": "0.7.3",
"react-redux": "^4.0.6", "react-redux": "^4.0.6",
"react-router": "^1.0.3", "react-router": "^2.0.0-rc5",
"redux": "^3.0.5", "redux": "^3.0.5",
"redux-simple-router": "^1.0.2", "redux-simple-router": "^2.0.2",
"redux-thunk": "^1.0.3", "redux-thunk": "^1.0.3",
"reselect": "^2.0.1" "reselect": "^2.0.2"
} }
} }

View File

@ -1,14 +1,14 @@
import { pushPath } from 'redux-simple-router'; import { routeActions } from 'redux-simple-router';
import * as actions from '../actions'; import * as actions from '../actions';
export function select(server, channel, pm) { export function select(server, channel, pm) {
if (pm) { if (pm) {
return pushPath(`/${server}/pm/${channel}`); return routeActions.push(`/${server}/pm/${channel}`);
} else if (channel) { } else if (channel) {
return pushPath(`/${server}/${encodeURIComponent(channel)}`); return routeActions.push(`/${server}/${encodeURIComponent(channel)}`);
} }
return pushPath(`/${server}`); return routeActions.push(`/${server}`);
} }
export function updateSelection() { export function updateSelection() {
@ -19,14 +19,14 @@ export function updateSelection() {
const { server } = state.tab.selected; const { server } = state.tab.selected;
if (servers.size === 0) { if (servers.size === 0) {
dispatch(pushPath('/connect')); dispatch(routeActions.replace('/connect'));
} else if (history.size > 0) { } else if (history.size > 0) {
const tab = history.last(); const tab = history.last();
dispatch(select(tab.server, tab.channel || tab.user, tab.user)); dispatch(select(tab.server, tab.channel || tab.user, tab.user));
} else if (servers.has(server)) { } else if (servers.has(server)) {
dispatch(select(server)); dispatch(select(server));
} else { } else {
dispatch(pushPath('/')); dispatch(routeActions.replace('/'));
} }
}; };
} }

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { pushPath } from 'redux-simple-router'; import { routeActions } from 'redux-simple-router';
import pure from 'pure-render-decorator'; import pure from 'pure-render-decorator';
import TabList from '../components/TabList'; import TabList from '../components/TabList';
import { select } from '../actions/tab'; import { select } from '../actions/tab';
@ -32,4 +32,4 @@ function mapStateToProps(state) {
}; };
} }
export default connect(mapStateToProps, { pushPath, select, hideMenu })(App); export default connect(mapStateToProps, { pushPath: routeActions.push, select, hideMenu })(App);

View File

@ -1,7 +1,6 @@
import React from 'react'; import React from 'react';
import { render } from 'react-dom'; import { render } from 'react-dom';
import { syncReduxAndRouter } from 'redux-simple-router'; import { browserHistory } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';
import configureStore from './store'; import configureStore from './store';
import createRoutes from './routes'; import createRoutes from './routes';
import Socket from './util/Socket'; import Socket from './util/Socket';
@ -9,14 +8,14 @@ import handleSocket from './socket';
import Root from './containers/Root'; import Root from './containers/Root';
const host = __DEV__ ? `${window.location.hostname}:1337` : window.location.host; const host = __DEV__ ? `${window.location.hostname}:1337` : window.location.host;
const socket = new Socket(host); const socket = new Socket(host);
const store = configureStore(socket);
handleSocket(socket, store);
const history = createBrowserHistory(); const store = configureStore(socket, browserHistory);
syncReduxAndRouter(history, store); handleSocket(socket, store);
const routes = createRoutes(); const routes = createRoutes();
render(<Root store={store} routes={routes} history={history} />, document.getElementById('root')); render(
<Root store={store} routes={routes} history={browserHistory} />,
document.getElementById('root')
);

View File

@ -1,7 +1,7 @@
import { Map, Record } from 'immutable'; import { Map, Record } from 'immutable';
import createReducer from '../util/createReducer'; import createReducer from '../util/createReducer';
import * as actions from '../actions'; import * as actions from '../actions';
import forEach from 'lodash/collection/forEach'; import forEach from 'lodash/forEach';
const Server = Record({ const Server = Record({
nick: null, nick: null,

View File

@ -1,4 +1,4 @@
import { replacePath } from 'redux-simple-router'; import { routeActions } from 'redux-simple-router';
import { broadcast, inform, addMessage, addMessages } from './actions/message'; import { broadcast, inform, addMessage, addMessages } from './actions/message';
import { select } from './actions/tab'; import { select } from './actions/tab';
import { normalizeChannel } from './util'; import { normalizeChannel } from './util';
@ -37,7 +37,7 @@ export default function handleSocket(socket, { dispatch, getState }) {
socket.on('servers', data => { socket.on('servers', data => {
if (!data) { if (!data) {
dispatch(replacePath('/connect')); dispatch(routeActions.replace('/connect'));
} }
}); });

View File

@ -1,13 +1,17 @@
import { createStore, applyMiddleware, compose } from 'redux'; import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import { syncHistory } from 'redux-simple-router';
import reducer from '../reducers'; import reducer from '../reducers';
import createSocketMiddleware from '../middleware/socket'; import createSocketMiddleware from '../middleware/socket';
import commands from '../commands'; import commands from '../commands';
import DevTools from '../containers/DevTools'; import DevTools from '../containers/DevTools';
export default function configureStore(socket, initialState) { export default function configureStore(socket, history, initialState) {
const reduxRouterMiddleware = syncHistory(history);
const finalCreateStore = compose( const finalCreateStore = compose(
applyMiddleware( applyMiddleware(
reduxRouterMiddleware,
thunk, thunk,
createSocketMiddleware(socket), createSocketMiddleware(socket),
commands commands
@ -17,6 +21,8 @@ export default function configureStore(socket, initialState) {
const store = finalCreateStore(reducer, initialState); const store = finalCreateStore(reducer, initialState);
reduxRouterMiddleware.listenForReplays(store);
if (module.hot) { if (module.hot) {
module.hot.accept('../reducers', () => { module.hot.accept('../reducers', () => {
store.replaceReducer(require('../reducers').default); store.replaceReducer(require('../reducers').default);

View File

@ -1,11 +1,13 @@
import { createStore, applyMiddleware } from 'redux'; import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk'; import thunk from 'redux-thunk';
import { syncHistory } from 'redux-simple-router';
import reducer from '../reducers'; import reducer from '../reducers';
import createSocketMiddleware from '../middleware/socket'; import createSocketMiddleware from '../middleware/socket';
import commands from '../commands'; import commands from '../commands';
export default function configureStore(socket, initialState) { export default function configureStore(socket, history, initialState) {
const finalCreateStore = applyMiddleware( const finalCreateStore = applyMiddleware(
syncHistory(history),
thunk, thunk,
createSocketMiddleware(socket), createSocketMiddleware(socket),
commands commands