Update client deps: react 16.3, babel 7
This commit is contained in:
parent
1ae7d867a9
commit
0cbbc1b8ff
46 changed files with 1125 additions and 808 deletions
|
@ -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 = [
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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'));
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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})` : '');
|
||||
|
|
|
@ -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 }),
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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' },
|
||||
|
|
|
@ -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';
|
||||
[
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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) {
|
Loading…
Add table
Add a link
Reference in a new issue