mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
83 lines
2.4 KiB
JavaScript
83 lines
2.4 KiB
JavaScript
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import MemberListTeam from './member_list_team.jsx';
|
|
import TeamStore from '../stores/team_store.jsx';
|
|
|
|
import {FormattedMessage} from 'mm-intl';
|
|
|
|
const Modal = ReactBootstrap.Modal;
|
|
|
|
export default class TeamMembersModal extends React.Component {
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.onShow = this.onShow.bind(this);
|
|
}
|
|
|
|
componentDidMount() {
|
|
if (this.props.show) {
|
|
this.onShow();
|
|
}
|
|
}
|
|
|
|
componentDidUpdate(prevProps) {
|
|
if (this.props.show && !prevProps.show) {
|
|
this.onShow();
|
|
}
|
|
}
|
|
|
|
onShow() {
|
|
if ($(window).width() > 768) {
|
|
$(ReactDOM.findDOMNode(this.refs.modalBody)).perfectScrollbar();
|
|
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 200);
|
|
} else {
|
|
$(ReactDOM.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 150);
|
|
}
|
|
}
|
|
|
|
render() {
|
|
const team = TeamStore.getCurrent();
|
|
|
|
return (
|
|
<Modal
|
|
dialogClassName='team-members-modal'
|
|
show={this.props.show}
|
|
onHide={this.props.onHide}
|
|
>
|
|
<Modal.Header closeButton={true}>
|
|
<FormattedMessage
|
|
id='team_member_modal.members'
|
|
defaultMessage='{team} Members'
|
|
values={{
|
|
team: team.display_name
|
|
}}
|
|
/>
|
|
</Modal.Header>
|
|
<Modal.Body ref='modalBody'>
|
|
<div className='team-member-list'>
|
|
<MemberListTeam />
|
|
</div>
|
|
</Modal.Body>
|
|
<Modal.Footer>
|
|
<button
|
|
type='button'
|
|
className='btn btn-default'
|
|
onClick={this.props.onHide}
|
|
>
|
|
<FormattedMessage
|
|
id='team_member_modal.close'
|
|
defaultMessage='Close'
|
|
/>
|
|
</button>
|
|
</Modal.Footer>
|
|
</Modal>
|
|
);
|
|
}
|
|
}
|
|
|
|
TeamMembersModal.propTypes = {
|
|
show: React.PropTypes.bool.isRequired,
|
|
onHide: React.PropTypes.func.isRequired
|
|
};
|