diff --git a/app/soapbox/actions/settings.js b/app/soapbox/actions/settings.js index 677556dee..4432fa6e0 100644 --- a/app/soapbox/actions/settings.js +++ b/app/soapbox/actions/settings.js @@ -1,7 +1,7 @@ import { debounce } from 'lodash'; import { showAlertForError } from './alerts'; import { patchMe } from 'soapbox/actions/me'; -import { Map as ImmutableMap } from 'immutable'; +import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; export const SETTING_CHANGE = 'SETTING_CHANGE'; export const SETTING_SAVE = 'SETTING_SAVE'; @@ -29,6 +29,11 @@ const defaultSettings = ImmutableMap({ dyslexicFont: false, demetricator: false, + chats: ImmutableMap({ + panes: ImmutableList(), + mainWindow: 'minimized', + }), + home: ImmutableMap({ shows: ImmutableMap({ reblog: true, diff --git a/app/soapbox/features/chats/components/chat_list.js b/app/soapbox/features/chats/components/chat_list.js index fa741f96e..a11617d19 100644 --- a/app/soapbox/features/chats/components/chat_list.js +++ b/app/soapbox/features/chats/components/chat_list.js @@ -36,9 +36,6 @@ class ChatList extends ImmutablePureComponent { return (
-
- -
{chats.toList().map(chat => (
diff --git a/app/soapbox/features/chats/components/chat_panes.js b/app/soapbox/features/chats/components/chat_panes.js new file mode 100644 index 000000000..cf1515152 --- /dev/null +++ b/app/soapbox/features/chats/components/chat_panes.js @@ -0,0 +1,66 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; +import { injectIntl } from 'react-intl'; +import ImmutablePureComponent from 'react-immutable-pure-component'; +import { getSettings } from 'soapbox/actions/settings'; +import ChatList from './chat_list'; +import { FormattedMessage } from 'react-intl'; + +const mapStateToProps = state => ({ + panesData: getSettings(state).get('chats'), +}); + +export default @connect(mapStateToProps) +@injectIntl +class ChatPanes extends ImmutablePureComponent { + + static propTypes = { + dispatch: PropTypes.func.isRequired, + intl: PropTypes.object.isRequired, + panesData: ImmutablePropTypes.map, + } + + renderChatPane = (pane, i) => { + // const chat = getChat(pane.get('chat_id')) + return ( +
+
+ // {chat.getIn(['account', 'acct'])} +
+
+ // TODO: Show the chat messages +
+ +
+
+
+ ); + } + + renderChatPanes = (panes) => ( + panes.map((pane, i) => + this.renderChatPane(pane, i) + ) + ) + + render() { + const panes = this.props.panesData.get('panes'); + + return ( +
+
+
+ +
+
+ +
+
+ {this.renderChatPanes(panes)} +
+ ); + } + +} diff --git a/app/soapbox/features/ui/index.js b/app/soapbox/features/ui/index.js index 15b9ced5f..266d6f4e2 100644 --- a/app/soapbox/features/ui/index.js +++ b/app/soapbox/features/ui/index.js @@ -36,7 +36,7 @@ import { connectUserStream } from '../../actions/streaming'; import { Redirect } from 'react-router-dom'; import Icon from 'soapbox/components/icon'; import { isStaff } from 'soapbox/utils/accounts'; -import ChatList from 'soapbox/features/chats/components/chat_list'; +import ChatPanes from 'soapbox/features/chats/components/chat_panes'; import { Status, @@ -605,7 +605,7 @@ class UI extends React.PureComponent { {me && } - {me && } + {me && }
); diff --git a/app/styles/chats.scss b/app/styles/chats.scss index ae95038a4..8994bfe27 100644 --- a/app/styles/chats.scss +++ b/app/styles/chats.scss @@ -1,4 +1,4 @@ -.chat-list { +.pane { position: fixed; bottom: 0; right: 20px;