2015-12-28 23:34:32 +00:00
|
|
|
import { bindActionCreators } from 'redux';
|
2017-05-26 06:20:00 +00:00
|
|
|
import { createStructuredSelector } from 'reselect';
|
2017-06-21 06:40:28 +00:00
|
|
|
import Chat from 'components/pages/Chat';
|
|
|
|
import { getSelectedTabTitle } from 'state';
|
2018-04-05 23:46:22 +00:00
|
|
|
import {
|
|
|
|
getSelectedChannel,
|
|
|
|
getSelectedChannelUsers,
|
|
|
|
part
|
|
|
|
} from 'state/channels';
|
|
|
|
import {
|
|
|
|
getCurrentInputHistoryEntry,
|
|
|
|
addInputHistory,
|
|
|
|
resetInputHistory,
|
|
|
|
incrementInputHistory,
|
|
|
|
decrementInputHistory
|
|
|
|
} from 'state/input';
|
|
|
|
import {
|
|
|
|
getSelectedMessages,
|
|
|
|
getHasMoreMessages,
|
|
|
|
runCommand,
|
|
|
|
sendMessage,
|
|
|
|
fetchMessages,
|
|
|
|
addFetchedMessages
|
|
|
|
} from 'state/messages';
|
2019-01-25 02:57:58 +00:00
|
|
|
import { openModal } from 'state/modals';
|
2017-06-21 06:40:28 +00:00
|
|
|
import { openPrivateChat, closePrivateChat } from 'state/privateChats';
|
|
|
|
import { getSearch, searchMessages, toggleSearch } from 'state/search';
|
2018-04-05 23:46:22 +00:00
|
|
|
import {
|
|
|
|
getCurrentNick,
|
2020-06-15 08:58:51 +00:00
|
|
|
getCurrentNetworkError,
|
2018-04-05 23:46:22 +00:00
|
|
|
disconnect,
|
|
|
|
setNick,
|
2020-06-15 08:58:51 +00:00
|
|
|
setNetworkName
|
|
|
|
} from 'state/networks';
|
2018-10-15 06:56:17 +00:00
|
|
|
import { getSettings } from 'state/settings';
|
2017-06-21 06:40:28 +00:00
|
|
|
import { getSelectedTab, select } from 'state/tab';
|
|
|
|
import { getShowUserList, toggleUserList } from 'state/ui';
|
2018-11-09 07:11:01 +00:00
|
|
|
import connect from 'utils/connect';
|
2015-12-28 23:34:32 +00:00
|
|
|
|
2017-05-26 06:20:00 +00:00
|
|
|
const mapState = createStructuredSelector({
|
|
|
|
channel: getSelectedChannel,
|
|
|
|
currentInputHistoryEntry: getCurrentInputHistoryEntry,
|
2017-05-02 21:21:25 +00:00
|
|
|
hasMoreMessages: getHasMoreMessages,
|
2017-05-26 06:20:00 +00:00
|
|
|
messages: getSelectedMessages,
|
|
|
|
nick: getCurrentNick,
|
|
|
|
search: getSearch,
|
|
|
|
showUserList: getShowUserList,
|
2020-06-15 08:58:51 +00:00
|
|
|
error: getCurrentNetworkError,
|
2017-05-26 06:20:00 +00:00
|
|
|
tab: getSelectedTab,
|
|
|
|
title: getSelectedTabTitle,
|
2018-10-15 06:56:17 +00:00
|
|
|
users: getSelectedChannelUsers,
|
|
|
|
coloredNicks: state => getSettings(state).coloredNicks
|
2016-02-16 21:43:25 +00:00
|
|
|
});
|
2015-12-28 23:34:32 +00:00
|
|
|
|
2017-05-27 05:30:22 +00:00
|
|
|
const mapDispatch = dispatch => ({
|
2018-04-05 23:46:22 +00:00
|
|
|
...bindActionCreators(
|
|
|
|
{
|
|
|
|
addFetchedMessages,
|
|
|
|
closePrivateChat,
|
|
|
|
disconnect,
|
|
|
|
fetchMessages,
|
2019-01-25 02:57:58 +00:00
|
|
|
openModal,
|
2018-04-05 23:46:22 +00:00
|
|
|
openPrivateChat,
|
|
|
|
part,
|
|
|
|
runCommand,
|
|
|
|
searchMessages,
|
|
|
|
select,
|
|
|
|
sendMessage,
|
|
|
|
setNick,
|
2020-06-15 08:58:51 +00:00
|
|
|
setNetworkName,
|
2018-04-05 23:46:22 +00:00
|
|
|
toggleSearch,
|
|
|
|
toggleUserList
|
|
|
|
},
|
|
|
|
dispatch
|
|
|
|
),
|
2017-05-27 05:30:22 +00:00
|
|
|
|
2018-04-05 23:46:22 +00:00
|
|
|
inputActions: bindActionCreators(
|
|
|
|
{
|
|
|
|
add: addInputHistory,
|
|
|
|
reset: resetInputHistory,
|
|
|
|
increment: incrementInputHistory,
|
|
|
|
decrement: decrementInputHistory
|
|
|
|
},
|
|
|
|
dispatch
|
|
|
|
)
|
2017-05-27 05:30:22 +00:00
|
|
|
});
|
2015-12-28 23:34:32 +00:00
|
|
|
|
2020-04-30 05:54:30 +00:00
|
|
|
export default connect(mapState, mapDispatch)(Chat);
|