From ec31ea2a6bdf173c044fb707f491b7406f12c98f Mon Sep 17 00:00:00 2001 From: Jerko Steiner Date: Sun, 7 Jul 2019 18:37:08 +0800 Subject: [PATCH] Fix broken chat button, remove refs --- src/client/components/App.js | 47 ++++++++++++------- src/client/components/Chat.js | 25 ++++++---- src/client/components/Toolbar.js | 32 ++++--------- .../components/__tests__/Toolbar-test.js | 17 +++---- 4 files changed, 63 insertions(+), 58 deletions(-) diff --git a/src/client/components/App.js b/src/client/components/App.js index 2f9b7fe..955f003 100644 --- a/src/client/components/App.js +++ b/src/client/components/App.js @@ -1,10 +1,10 @@ -import Alerts, { AlertPropType } from './Alerts.js' import * as constants from '../constants.js' -import Toolbar from './Toolbar.js' -import Notifications, { NotificationPropTypes } from './Notifications.js' +import Alerts, { AlertPropType } from './Alerts.js' import Chat, { MessagePropTypes } from './Chat.js' +import Notifications, { NotificationPropTypes } from './Notifications.js' import PropTypes from 'prop-types' import React from 'react' +import Toolbar from './Toolbar.js' import Video, { StreamPropType } from './Video.js' import _ from 'underscore' @@ -25,10 +25,24 @@ export default class App extends React.PureComponent { constructor () { super() this.state = { - videos: {} + videos: {}, + chatVisible: false } - this.chatRef = React.createRef() - this.toolbarRef = React.createRef() + } + handleShowChat = () => { + this.setState({ + chatVisible: true + }) + } + handleHideChat = () => { + this.setState({ + chatVisible: false + }) + } + handleToggleChat = () => { + return this.state.chatVisible + ? this.handleHideChat() + : this.handleShowChat() } componentDidMount () { const { init } = this.props @@ -53,22 +67,21 @@ export default class App extends React.PureComponent { return (
-
- -
+