diff --git a/app/soapbox/actions/chats.js b/app/soapbox/actions/chats.js index 732e8f34f..419608e2c 100644 --- a/app/soapbox/actions/chats.js +++ b/app/soapbox/actions/chats.js @@ -59,3 +59,11 @@ export function toggleChat(chatId) { } }; } + +export function toggleMainWindow() { + return (dispatch, getState) => { + const main = getSettings(getState()).getIn(['chats', 'mainWindow']); + const state = main === 'minimized' ? 'open' : 'minimized'; + return dispatch(changeSetting(['chats', 'mainWindow'], state)); + }; +} diff --git a/app/soapbox/features/chats/components/chat_panes.js b/app/soapbox/features/chats/components/chat_panes.js index d93de925f..5786f768f 100644 --- a/app/soapbox/features/chats/components/chat_panes.js +++ b/app/soapbox/features/chats/components/chat_panes.js @@ -10,7 +10,12 @@ import { FormattedMessage } from 'react-intl'; import { makeGetChat } from 'soapbox/selectors'; import Avatar from 'soapbox/components/avatar'; import { acctFull } from 'soapbox/utils/accounts'; -import { openChat, closeChat, toggleChat } from 'soapbox/actions/chats'; +import { + openChat, + closeChat, + toggleChat, + toggleMainWindow, +} from 'soapbox/actions/chats'; import IconButton from 'soapbox/components/icon_button'; const addChatsToPanes = (state, panesData) => { @@ -59,6 +64,10 @@ class ChatPanes extends ImmutablePureComponent { }; } + handleMainWindowToggle = () => { + this.props.dispatch(toggleMainWindow()); + } + renderChatPane = (pane, i) => { const chat = pane.get('chat'); const account = pane.getIn(['chat', 'account']); @@ -96,13 +105,17 @@ class ChatPanes extends ImmutablePureComponent { ) render() { - const panes = this.props.panesData.get('panes'); + const { panesData } = this.props; + const panes = panesData.get('panes'); + const mainWindow = panesData.get('mainWindow'); return (