From d8bd57901e33a7057e26e782e295099ffcc0da89 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Sep 2017 23:04:13 -0700 Subject: Removing webapp --- webapp/components/status_dropdown/index.jsx | 33 ----- .../components/status_dropdown/status_dropdown.jsx | 158 --------------------- 2 files changed, 191 deletions(-) delete mode 100644 webapp/components/status_dropdown/index.jsx delete mode 100644 webapp/components/status_dropdown/status_dropdown.jsx (limited to 'webapp/components/status_dropdown') diff --git a/webapp/components/status_dropdown/index.jsx b/webapp/components/status_dropdown/index.jsx deleted file mode 100644 index e200b2e34..000000000 --- a/webapp/components/status_dropdown/index.jsx +++ /dev/null @@ -1,33 +0,0 @@ -import {setStatus} from 'mattermost-redux/actions/users'; -import {connect} from 'react-redux'; -import {bindActionCreators} from 'redux'; -import { - getCurrentUser, - getStatusForUserId -} from 'mattermost-redux/selectors/entities/users'; -import {Client4} from 'mattermost-redux/client'; - -import StatusDropdown from 'components/status_dropdown/status_dropdown.jsx'; - -function mapStateToProps(state) { - const currentUser = getCurrentUser(state); - const userId = currentUser.id; - const lastPicUpdate = currentUser.last_picture_update; - const profilePicture = Client4.getProfilePictureUrl(userId, lastPicUpdate); - const status = getStatusForUserId(state, currentUser.id); - return { - userId, - profilePicture, - status - }; -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators({ - setStatus - }, dispatch) - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(StatusDropdown); diff --git a/webapp/components/status_dropdown/status_dropdown.jsx b/webapp/components/status_dropdown/status_dropdown.jsx deleted file mode 100644 index 4b173a0ea..000000000 --- a/webapp/components/status_dropdown/status_dropdown.jsx +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import React from 'react'; -import {Dropdown} from 'react-bootstrap'; -import StatusIcon from 'components/status_icon.jsx'; -import PropTypes from 'prop-types'; -import {FormattedMessage} from 'react-intl'; -import {UserStatuses} from 'utils/constants.jsx'; -import BootstrapSpan from 'components/bootstrap_span.jsx'; - -export default class StatusDropdown extends React.Component { - - static propTypes = { - style: PropTypes.object, - status: PropTypes.string, - userId: PropTypes.string.isRequired, - profilePicture: PropTypes.string, - actions: PropTypes.shape({ - setStatus: PropTypes.func.isRequired - }).isRequired - } - - state = { - showDropdown: false, - mouseOver: false - } - - onMouseEnter = () => { - this.setState({mouseOver: true}); - } - - onMouseLeave = () => { - this.setState({mouseOver: false}); - } - - onToggle = (showDropdown) => { - this.setState({showDropdown}); - } - - closeDropdown = () => { - this.setState({showDropdown: false}); - } - - setStatus = (status) => { - this.props.actions.setStatus({ - user_id: this.props.userId, - status - }); - this.closeDropdown(); - } - - setOnline = (event) => { - event.preventDefault(); - this.setStatus(UserStatuses.ONLINE); - } - - setOffline = (event) => { - event.preventDefault(); - this.setStatus(UserStatuses.OFFLINE); - } - - setAway = (event) => { - event.preventDefault(); - this.setStatus(UserStatuses.AWAY); - } - - renderStatusOnlineAction = () => { - return this.renderStatusAction(UserStatuses.ONLINE, this.setOnline); - } - - renderStatusAwayAction = () => { - return this.renderStatusAction(UserStatuses.AWAY, this.setAway); - } - - renderStatusOfflineAction = () => { - return this.renderStatusAction(UserStatuses.OFFLINE, this.setOffline); - } - - renderProfilePicture = () => { - if (!this.props.profilePicture) { - return null; - } - return ( - - ); - } - - renderStatusAction = (status, onClick) => { - return ( -
  • - - - -
  • - ); - } - - renderStatusIcon = () => { - if (this.state.mouseOver) { - return ( - - - - ); - } - return ( - - ); - } - - render() { - const statusIcon = this.renderStatusIcon(); - const profilePicture = this.renderProfilePicture(); - const actions = [ - this.renderStatusOnlineAction(), - this.renderStatusAwayAction(), - this.renderStatusOfflineAction() - ]; - return ( - - -
    - {profilePicture} -
    - {statusIcon} -
    -
    -
    - - {actions} - -
    - ); - } -} -- cgit v1.2.3-1-g7c22