Update client deps: react 16.3, babel 7

This commit is contained in:
Ken-Håvard Lieng 2018-04-05 21:13:32 +02:00
parent 1ae7d867a9
commit 0cbbc1b8ff
46 changed files with 1125 additions and 808 deletions

View file

@ -3,7 +3,7 @@ import { join, part, invite, kick, setTopic } from 'state/channels';
import { sendMessage, raw } from 'state/messages';
import { setNick, disconnect, whois, away } from 'state/servers';
import { select } from 'state/tab';
import { find } from 'util';
import { find } from 'utils';
import createCommandMiddleware, { beforeHandler, notFoundHandler } from './middleware/command';
const help = [

View file

@ -1,5 +1,6 @@
import React from 'react';
import { Provider } from 'react-redux';
import { hot } from 'react-hot-loader';
import App from 'containers/App';
const Root = ({ store }) => (
@ -8,4 +9,4 @@ const Root = ({ store }) => (
</Provider>
);
export default Root;
export default hot(module)(Root);

View file

@ -3,7 +3,7 @@ import { List } from 'immutable';
import Navicon from 'containers/Navicon';
import Editable from 'components/ui/Editable';
import { isValidServerName } from 'state/servers';
import { linkify } from 'util';
import { linkify } from 'utils';
export default class ChatTitle extends PureComponent {
render() {

View file

@ -2,7 +2,7 @@ import React, { PureComponent } from 'react';
import { List } from 'react-virtualized/dist/commonjs/List';
import { AutoSizer } from 'react-virtualized/dist/commonjs/AutoSizer';
import debounce from 'lodash/debounce';
import { getScrollPos, saveScrollPos } from 'util/scrollPosition';
import { getScrollPos, saveScrollPos } from 'utils/scrollPosition';
import Message from './Message';
const fetchThreshold = 600;

View file

@ -1,5 +1,5 @@
import React, { PureComponent } from 'react';
import { timestamp, linkify } from 'util';
import { timestamp, linkify } from 'utils';
export default class SearchResult extends PureComponent {
render() {

View file

@ -1,5 +1,5 @@
import React, { PureComponent } from 'react';
import { stringWidth } from 'util';
import { stringWidth } from 'utils';
export default class Editable extends PureComponent {
static defaultProps = {

View file

@ -7,7 +7,7 @@ import { getSortedPrivateChats } from 'state/privateChats';
import { getServers } from 'state/servers';
import { getSelectedTab, select } from 'state/tab';
import { getShowTabList, hideMenu } from 'state/ui';
import { push } from 'util/router';
import { push } from 'utils/router';
const mapState = createStructuredSelector({
channels: getSortedChannels,

View file

@ -1,31 +1,20 @@
import React from 'react';
import { render } from 'react-dom';
import { AppContainer } from 'react-hot-loader';
import 'react-virtualized/styles.css';
import Root from 'components/Root';
import initRouter from 'util/router';
import Socket from 'util/Socket';
import initRouter from 'utils/router';
import Socket from 'utils/Socket';
import configureStore from './store';
import routes from './routes';
import runModules from './modules';
const host = DEV ? `${window.location.hostname}:1337` : window.location.host;
const production = process.env.NODE_ENV === 'production';
const host = production ? window.location.host : `${window.location.hostname}:1337`;
const socket = new Socket(host);
const store = configureStore(socket);
initRouter(routes, store);
runModules({ store, socket });
const renderRoot = () => render(
<AppContainer>
<Root store={store} />
</AppContainer>,
document.getElementById('root')
);
renderRoot();
if (module.hot) {
module.hot.accept('./components/Root', () => renderRoot());
}
render(<Root store={store} />, document.getElementById('root'));

View file

@ -1,5 +1,5 @@
import { addMessages, inform, print } from 'state/messages';
import { isChannel } from 'util';
import { isChannel } from 'utils';
export const beforeHandler = '_before';
export const notFoundHandler = 'commandNotFound';

View file

@ -1,7 +1,7 @@
import capitalize from 'lodash/capitalize';
import { getRouter } from 'state';
import { getCurrentServerName } from 'state/servers';
import { observe } from 'util/observe';
import { observe } from 'utils/observe';
export default function documentTitle({ store }) {
observe(store, [getRouter, getCurrentServerName], (router, serverName) => {

View file

@ -1,6 +1,6 @@
import FontFaceObserver from 'fontfaceobserver';
import { setCharWidth } from 'state/app';
import { stringWidth } from 'util';
import { stringWidth } from 'utils';
export default function fonts({ store }) {
let { charWidth } = localStorage;

View file

@ -3,9 +3,9 @@ import { socket as socketActions } from 'state/actions';
import { getWrapWidth, setConnectDefaults } from 'state/app';
import { addMessages } from 'state/messages';
import { select, updateSelection } from 'state/tab';
import { find } from 'util';
import { when } from 'util/observe';
import { replace } from 'util/router';
import { find } from 'utils';
import { when } from 'utils/observe';
import { replace } from 'utils/router';
export default function initialState({ store }) {
const env = JSON.parse(document.getElementById('env').innerHTML);

View file

@ -3,7 +3,7 @@ import { setConnected } from 'state/app';
import { broadcast, inform, print, addMessage, addMessages } from 'state/messages';
import { reconnect } from 'state/servers';
import { select } from 'state/tab';
import { normalizeChannel } from 'util';
import { normalizeChannel } from 'utils';
function withReason(message, reason) {
return message + (reason ? ` (${reason})` : '');

View file

@ -1,7 +1,7 @@
import Cookie from 'js-cookie';
import debounce from 'lodash/debounce';
import { getSelectedTab } from 'state/tab';
import { observe } from 'util/observe';
import { observe } from 'utils/observe';
const saveTab = debounce(
tab => Cookie.set('tab', tab.toString(), { expires: 30 }),

View file

@ -1,7 +1,7 @@
import { getCharWidth } from 'state/app';
import { updateMessageHeight } from 'state/messages';
import { when } from 'util/observe';
import { measureScrollBarWidth } from 'util';
import { when } from 'utils/observe';
import { measureScrollBarWidth } from 'utils';
const menuWidth = 200;
const messagePadding = 30;

View file

@ -1,5 +1,5 @@
import Immutable from 'immutable';
import reducer from '../channels';
import reducer, { compareUsers } from '../channels';
import { connect } from '../servers';
import * as actions from '../actions';
@ -294,7 +294,6 @@ function socket_mode(server, channel, user, add, remove) {
describe('compareUsers()', () => {
it('compares users correctly', () => {
const compareUsers = reducer.__get__('compareUsers');
expect([
{ renderName: 'user5' },
{ renderName: '@user2' },

View file

@ -1,5 +1,5 @@
import { Map, fromJS } from 'immutable';
import reducer, { broadcast } from '../messages';
import reducer, { broadcast, getMessageTab } from '../messages';
import * as actions from '../actions';
import appReducer from '../app';
@ -178,8 +178,6 @@ describe('message reducer', () => {
});
describe('getMessageTab()', () => {
const getMessageTab = reducer.__get__('getMessageTab');
it('returns the correct tab', () => {
const srv = 'chat.freenode.net';
[

View file

@ -1,6 +1,6 @@
import reducer, { setSelectedTab } from '../tab';
import * as actions from '../actions';
import { locationChanged } from '../../util/router';
import { locationChanged } from 'utils/router';
describe('tab reducer', () => {
it('selects the tab and adds it to history', () => {

View file

@ -1,5 +1,5 @@
import { Record } from 'immutable';
import createReducer from 'util/createReducer';
import createReducer from 'utils/createReducer';
import * as actions from './actions';
export const getApp = state => state.app;

View file

@ -1,6 +1,6 @@
import { Map, List, Record } from 'immutable';
import { createSelector } from 'reselect';
import createReducer from 'util/createReducer';
import createReducer from 'utils/createReducer';
import { getSelectedTab, updateSelection } from './tab';
import * as actions from './actions';
@ -52,7 +52,7 @@ function loadUser(nick) {
return createUser(nick);
}
function compareUsers(a, b) {
export function compareUsers(a, b) {
a = a.renderName.toLowerCase();
b = b.renderName.toLowerCase();

View file

@ -1,5 +1,5 @@
import { List, Record } from 'immutable';
import createReducer from 'util/createReducer';
import createReducer from 'utils/createReducer';
import * as actions from './actions';
const HISTORY_MAX_LENGTH = 128;

View file

@ -1,7 +1,7 @@
import { List, Map, Record } from 'immutable';
import { createSelector } from 'reselect';
import { findBreakpoints, messageHeight, linkify, timestamp, isChannel } from 'util';
import createReducer from 'util/createReducer';
import { findBreakpoints, messageHeight, linkify, timestamp, isChannel } from 'utils';
import createReducer from 'utils/createReducer';
import { getApp } from './app';
import { getSelectedTab } from './tab';
import * as actions from './actions';
@ -117,7 +117,7 @@ function initMessage(message, tab, state) {
return message;
}
function getMessageTab(server, to) {
export function getMessageTab(server, to) {
if (!to || to === '*' || (!isChannel(to) && to.indexOf('.') !== -1)) {
return server;
}

View file

@ -1,6 +1,6 @@
import { Set, Map } from 'immutable';
import { createSelector } from 'reselect';
import createReducer from 'util/createReducer';
import createReducer from 'utils/createReducer';
import { updateSelection } from './tab';
import * as actions from './actions';

View file

@ -1,5 +1,5 @@
import { List, Record } from 'immutable';
import createReducer from 'util/createReducer';
import createReducer from 'utils/createReducer';
import * as actions from './actions';
const State = Record({

View file

@ -1,6 +1,6 @@
import { Map, Record } from 'immutable';
import { createSelector } from 'reselect';
import createReducer from 'util/createReducer';
import createReducer from 'utils/createReducer';
import { getSelectedTab, updateSelection } from './tab';
import * as actions from './actions';

View file

@ -1,6 +1,6 @@
import { Map } from 'immutable';
import base64 from 'base64-arraybuffer';
import createReducer from 'util/createReducer';
import createReducer from 'utils/createReducer';
import * as actions from './actions';
export const getSettings = state => state.settings;

View file

@ -1,6 +1,6 @@
import { Record, List } from 'immutable';
import createReducer from 'util/createReducer';
import { push, replace, LOCATION_CHANGED } from 'util/router';
import createReducer from 'utils/createReducer';
import { push, replace, LOCATION_CHANGED } from 'utils/router';
import * as actions from './actions';
const TabRecord = Record({

View file

@ -1,6 +1,6 @@
import { Record } from 'immutable';
import createReducer from 'util/createReducer';
import { LOCATION_CHANGED } from 'util/router';
import createReducer from 'utils/createReducer';
import { LOCATION_CHANGED } from 'utils/router';
import * as actions from './actions';
const State = Record({

View file

@ -1,7 +1,7 @@
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import createReducer from 'state';
import { routeReducer, routeMiddleware } from 'util/router';
import { routeReducer, routeMiddleware } from 'utils/router';
import message from './middleware/message';
import createSocketMiddleware from './middleware/socket';
import commands from './commands';

View file

@ -1,7 +1,7 @@
import padStart from 'lodash/padStart';
export { findBreakpoints, messageHeight } from './messageHeight';
export linkify from './linkify';
export { default as linkify } from './linkify';
export function normalizeChannel(channel) {
if (channel.indexOf('#') !== 0) {