diff --git a/app/soapbox/components/hover_ref_wrapper.tsx b/app/soapbox/components/hover_ref_wrapper.tsx index bf4e253f2..2090543cc 100644 --- a/app/soapbox/components/hover_ref_wrapper.tsx +++ b/app/soapbox/components/hover_ref_wrapper.tsx @@ -15,7 +15,7 @@ const showProfileHoverCard = debounce((dispatch, ref, accountId) => { interface IHoverRefWrapper { accountId: string, - inline: boolean, + inline?: boolean, className?: string, } diff --git a/app/soapbox/features/chats/components/chat_window.js b/app/soapbox/features/chats/components/chat_window.js deleted file mode 100644 index e525e3432..000000000 --- a/app/soapbox/features/chats/components/chat_window.js +++ /dev/null @@ -1,135 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import ImmutablePropTypes from 'react-immutable-proptypes'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { injectIntl } from 'react-intl'; -import { connect } from 'react-redux'; -import { Link } from 'react-router-dom'; - -import { - closeChat, - toggleChat, -} from 'soapbox/actions/chats'; -import Avatar from 'soapbox/components/avatar'; -import HoverRefWrapper from 'soapbox/components/hover_ref_wrapper'; -import IconButton from 'soapbox/components/icon_button'; -import { Counter } from 'soapbox/components/ui'; -import { makeGetChat } from 'soapbox/selectors'; -import { getAcct } from 'soapbox/utils/accounts'; -import { displayFqn } from 'soapbox/utils/state'; - -import ChatBox from './chat_box'; - -const makeMapStateToProps = () => { - const getChat = makeGetChat(); - - const mapStateToProps = (state, { chatId }) => { - const chat = state.getIn(['chats', 'items', chatId]); - - return { - me: state.get('me'), - chat: chat ? getChat(state, chat.toJS()) : undefined, - displayFqn: displayFqn(state), - }; - }; - - return mapStateToProps; -}; - -export default @connect(makeMapStateToProps) -@injectIntl -class ChatWindow extends ImmutablePureComponent { - - static propTypes = { - dispatch: PropTypes.func.isRequired, - intl: PropTypes.object.isRequired, - chatId: PropTypes.string.isRequired, - windowState: PropTypes.string.isRequired, - idx: PropTypes.number, - chat: ImmutablePropTypes.record, - me: PropTypes.node, - displayFqn: PropTypes.bool, - } - - state = { - content: '', - } - - handleChatClose = (chatId) => { - return (e) => { - this.props.dispatch(closeChat(chatId)); - }; - } - - handleChatToggle = (chatId) => { - return (e) => { - this.props.dispatch(toggleChat(chatId)); - }; - } - - handleContentChange = (e) => { - this.setState({ content: e.target.value }); - } - - handleInputRef = (el) => { - this.inputElem = el; - this.focusInput(); - }; - - focusInput = () => { - if (!this.inputElem) return; - this.inputElem.focus(); - } - - componentDidUpdate(prevProps) { - const oldState = prevProps.windowState; - const newState = this.props.windowState; - - if (oldState !== newState && newState === 'open') - this.focusInput(); - } - - render() { - const { windowState, idx, chat, displayFqn } = this.props; - if (!chat) return null; - const account = chat.get('account'); - - const right = (285 * (idx + 1)) + 20; - const unreadCount = chat.get('unread'); - - const unreadIcon = ( -