From d8bd57901e33a7057e26e782e295099ffcc0da89 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Sep 2017 23:04:13 -0700 Subject: Removing webapp --- .../team_sidebar/components/team_button.jsx | 127 -------------- webapp/components/team_sidebar/index.js | 24 --- .../team_sidebar/team_sidebar_controller.jsx | 189 --------------------- 3 files changed, 340 deletions(-) delete mode 100644 webapp/components/team_sidebar/components/team_button.jsx delete mode 100644 webapp/components/team_sidebar/index.js delete mode 100644 webapp/components/team_sidebar/team_sidebar_controller.jsx (limited to 'webapp/components/team_sidebar') diff --git a/webapp/components/team_sidebar/components/team_button.jsx b/webapp/components/team_sidebar/components/team_button.jsx deleted file mode 100644 index 57f436eb2..000000000 --- a/webapp/components/team_sidebar/components/team_button.jsx +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import Constants from 'utils/constants.jsx'; - -import {trackEvent} from 'actions/diagnostics_actions.jsx'; -import {switchTeams} from 'actions/team_actions.jsx'; - -import PropTypes from 'prop-types'; - -import React from 'react'; -import {Link} from 'react-router/es6'; -import {Tooltip, OverlayTrigger} from 'react-bootstrap'; - -export default class TeamButton extends React.Component { - constructor(props) { - super(props); - - this.handleSwitch = this.handleSwitch.bind(this); - this.handleDisabled = this.handleDisabled.bind(this); - } - - handleSwitch(e) { - e.preventDefault(); - trackEvent('ui', 'ui_team_sidebar_switch_team'); - switchTeams(this.props.url); - } - - handleDisabled(e) { - e.preventDefault(); - } - - render() { - let teamClass = this.props.active ? 'active' : ''; - const btnClass = this.props.btnClass; - const disabled = this.props.disabled ? 'team-disabled' : ''; - const handleClick = (this.props.active || this.props.disabled) ? this.handleDisabled : this.handleSwitch; - let badge; - - if (!teamClass) { - teamClass = this.props.unread ? 'unread' : ''; - - if (this.props.mentions) { - badge = ( - {this.props.mentions} - ); - } - } - - let btn; - let content = this.props.content; - if (!content) { - content = ( -
- {this.props.displayName.substring(0, 2)} -
- {this.props.displayName} -
-
- ); - } - if (this.props.isMobile) { - btn = ( -
- {badge} - {content} -
- ); - } else { - btn = ( - - {this.props.tip} - - } - > -
- {badge} - {content} -
-
- ); - } - - return ( -
- - {btn} - -
- ); - } -} - -TeamButton.defaultProps = { - btnClass: '', - tip: '', - placement: 'right', - active: false, - disabled: false, - unread: false, - mentions: 0 -}; - -TeamButton.propTypes = { - btnClass: PropTypes.string, - url: PropTypes.string.isRequired, - displayName: PropTypes.string, - content: PropTypes.node, - tip: PropTypes.node.isRequired, - active: PropTypes.bool, - disabled: PropTypes.bool, - isMobile: PropTypes.bool, - unread: PropTypes.bool, - mentions: PropTypes.number, - placement: PropTypes.oneOf(['left', 'right', 'top', 'bottom']) -}; diff --git a/webapp/components/team_sidebar/index.js b/webapp/components/team_sidebar/index.js deleted file mode 100644 index d130555fd..000000000 --- a/webapp/components/team_sidebar/index.js +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import {connect} from 'react-redux'; -import {bindActionCreators} from 'redux'; -import {getTeams} from 'mattermost-redux/actions/teams'; - -import TeamSidebar from './team_sidebar_controller.jsx'; - -function mapStateToProps(state, ownProps) { - return { - ...ownProps - }; -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators({ - getTeams - }, dispatch) - }; -} - -export default connect(mapStateToProps, mapDispatchToProps)(TeamSidebar); diff --git a/webapp/components/team_sidebar/team_sidebar_controller.jsx b/webapp/components/team_sidebar/team_sidebar_controller.jsx deleted file mode 100644 index 3cd30219f..000000000 --- a/webapp/components/team_sidebar/team_sidebar_controller.jsx +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -import TeamButton from './components/team_button.jsx'; - -import TeamStore from 'stores/team_store.jsx'; -import UserStore from 'stores/user_store.jsx'; - -import {sortTeamsByDisplayName} from 'utils/team_utils.jsx'; -import * as Utils from 'utils/utils.jsx'; - -import $ from 'jquery'; -import PropTypes from 'prop-types'; -import React from 'react'; -import {FormattedMessage} from 'react-intl'; - -export default class TeamSidebar extends React.Component { - static propTypes = { - actions: PropTypes.shape({ - getTeams: PropTypes.func.isRequired - }).isRequired - } - - constructor(props) { - super(props); - - this.getStateFromStores = this.getStateFromStores.bind(this); - this.onChange = this.onChange.bind(this); - this.handleResize = this.handleResize.bind(this); - this.setStyles = this.setStyles.bind(this); - - this.state = this.getStateFromStores(); - } - - getStateFromStores() { - const teamMembers = TeamStore.getMyTeamMembers(); - const currentTeamId = TeamStore.getCurrentId(); - - return { - teams: TeamStore.getAll(), - teamListings: TeamStore.getTeamListings(), - teamMembers, - currentTeamId, - show: teamMembers && teamMembers.length > 1, - isMobile: Utils.isMobile() - }; - } - - componentDidMount() { - window.addEventListener('resize', this.handleResize); - TeamStore.addChangeListener(this.onChange); - TeamStore.addUnreadChangeListener(this.onChange); - this.props.actions.getTeams(0, 200); - this.setStyles(); - } - - componentWillUnmount() { - window.removeEventListener('resize', this.handleResize); - TeamStore.removeChangeListener(this.onChange); - TeamStore.removeUnreadChangeListener(this.onChange); - } - - componentDidUpdate(prevProps, prevState) { - if (!this.state.isMobile) { - $('.team-wrapper').perfectScrollbar(); - } - - // reset the scrollbar upon switching teams - if (this.state.currentTeam !== prevState.currentTeam) { - this.refs.container.scrollTop = 0; - if (!this.state.isMobile) { - $('.team-wrapper').perfectScrollbar('update'); - } - } - } - - onChange() { - this.setState(this.getStateFromStores()); - this.setStyles(); - } - - handleResize() { - const teamMembers = this.state.teamMembers; - this.setState({show: teamMembers && teamMembers.length > 1}); - this.setStyles(); - } - - setStyles() { - const root = document.querySelector('#root'); - - if (this.state.show) { - root.classList.add('multi-teams'); - } else { - root.classList.remove('multi-teams'); - } - } - - render() { - if (!this.state.show) { - return null; - } - - const myTeams = []; - const isSystemAdmin = Utils.isSystemAdmin(UserStore.getCurrentUser().roles); - const isAlreadyMember = new Map(); - let moreTeams = false; - - for (const index in this.state.teamMembers) { - if (this.state.teamMembers.hasOwnProperty(index)) { - const teamMember = this.state.teamMembers[index]; - if (teamMember.delete_at > 0) { - continue; - } - const teamId = teamMember.team_id; - myTeams.push(Object.assign({ - unread: teamMember.msg_count > 0, - mentions: teamMember.mention_count - }, this.state.teams[teamId])); - isAlreadyMember[teamId] = true; - } - } - - for (const id in this.state.teamListings) { - if (this.state.teamListings.hasOwnProperty(id) && !isAlreadyMember[id]) { - moreTeams = true; - break; - } - } - - const teams = myTeams. - sort(sortTeamsByDisplayName). - map((team) => { - return ( - - ); - }); - - if (moreTeams) { - teams.push( - - } - content={} - /> - ); - } else if (global.window.mm_config.EnableTeamCreation === 'true' || isSystemAdmin) { - teams.push( - - } - content={} - /> - ); - } - - return ( -
-
- {teams} -
-
- ); - } -} -- cgit v1.2.3-1-g7c22