aboutsummaryrefslogtreecommitdiff
path: root/src/client/react/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/react/components')
-rw-r--r--src/client/react/components/container/Menu.js14
-rw-r--r--src/client/react/components/presentational/Menu.js14
2 files changed, 5 insertions, 23 deletions
diff --git a/src/client/react/components/container/Menu.js b/src/client/react/components/container/Menu.js
index 0e81fde..c9e6ba3 100644
--- a/src/client/react/components/container/Menu.js
+++ b/src/client/react/components/container/Menu.js
@@ -19,18 +19,12 @@
*/
import { connect } from 'react-redux';
-import { withRouter } from 'react-router-dom';
-import { makeSetUser, userFromMatch } from '../../lib/url';
+import { showRoomFinder } from '../../store/actions';
import Menu from '../presentational/Menu';
-const mapStateToProps = (state, { match }) => ({
- user: userFromMatch(match),
+const mapDispatchToProps = dispatch => ({
+ showRoomFinder: () => dispatch(showRoomFinder()),
});
-const mapDispatchToProps = (dispatch, { history }) => ({
- setUser: makeSetUser(history),
- showRoomFinder: () => dispatch({ type: 'ROOM_FINDER/SHOW' }),
-});
-
-export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Menu));
+export default connect(null, mapDispatchToProps)(Menu);
diff --git a/src/client/react/components/presentational/Menu.js b/src/client/react/components/presentational/Menu.js
index d43c1d3..077a2e4 100644
--- a/src/client/react/components/presentational/Menu.js
+++ b/src/client/react/components/presentational/Menu.js
@@ -23,30 +23,18 @@ import { PropTypes } from 'prop-types';
import { Button, ButtonIcon } from 'rmwc/Button';
import { SimpleMenu, MenuItem } from 'rmwc/Menu';
import { Icon } from 'rmwc/Icon';
-import users from '../../users';
import './Menu.scss';
class Menu extends React.Component {
static propTypes = {
- user: PropTypes.string,
- setUser: PropTypes.func.isRequired,
showRoomFinder: PropTypes.func.isRequired,
}
- static defaultProps = {
- user: null,
- }
-
onItemSelected(index) {
switch (index) {
case 'room_finder': {
- const { setUser, user, showRoomFinder } = this.props;
-
- if (user == null || users.byId[user].type !== 'r') {
- // We are not currently viewing a room, correct the situation.
- setUser(users.allRoomIds[0]);
- }
+ const { showRoomFinder } = this.props;
showRoomFinder();
break;