From 315adeb5e2012b7f7bcfcd1478f9d6dd2cc1092d Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Tue, 26 Jun 2018 21:46:41 +0200 Subject: Update code to comply with new styling --- .../react/components/container/RoomFinder.js | 34 ++++++++++++++-------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'src/client/react/components/container/RoomFinder.js') diff --git a/src/client/react/components/container/RoomFinder.js b/src/client/react/components/container/RoomFinder.js index b729ee3..0d296a2 100644 --- a/src/client/react/components/container/RoomFinder.js +++ b/src/client/react/components/container/RoomFinder.js @@ -41,24 +41,29 @@ class RoomFinder extends React.Component { } componentWillMount() { - const user = userFromMatch(this.props.match); - if (this.props.isVisible && users.byId[user].type !== 'r') { + const { isVisible, match, dispatch } = this.props; + const user = userFromMatch(match); + + if (isVisible && users.byId[user].type !== 'r') { // We are not currently viewing a room, so just hide. - this.props.dispatch({ type: 'ROOM_FINDER/HIDE' }); + dispatch({ type: 'ROOM_FINDER/HIDE' }); } } componentWillReceiveProps(nextProps) { - const user = userFromMatch(nextProps.match); - if (nextProps.isVisible && users.byId[user].type !== 'r') { + const { isVisible, match, dispatch } = nextProps; + + const user = userFromMatch(match); + if (isVisible && users.byId[user].type !== 'r') { // We are not currently viewing a room, so just hide. - this.props.dispatch({ type: 'ROOM_FINDER/HIDE' }); + dispatch({ type: 'ROOM_FINDER/HIDE' }); } } changeRoom(change) { + const { match, location, history } = this.props; const { allRoomIds } = users; - const currentRoom = userFromMatch(this.props.match); + const currentRoom = userFromMatch(match); const currentRoomIndex = allRoomIds.indexOf(currentRoom); let nextRoomIndex = currentRoomIndex + change; if (nextRoomIndex < 0) { @@ -68,22 +73,27 @@ class RoomFinder extends React.Component { } const nextRoom = allRoomIds[nextRoomIndex]; - setUser(nextRoom, this.props.location, this.props.history); + setUser(nextRoom, location, history); } render() { - if (!this.props.isVisible) { + const { isVisible, dispatch } = this.props; + if (!isVisible) { return
; } return (
- - + +
-- cgit v1.1