Fixed max height for all modals using FilteredUserLists
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
c2eab07be0
Коммит
62c0920943
@@ -25,7 +25,9 @@ export default class ChannelInviteModal extends React.Component {
|
|||||||
this.createInviteButton = this.createInviteButton.bind(this);
|
this.createInviteButton = this.createInviteButton.bind(this);
|
||||||
|
|
||||||
// the state gets populated when the modal is shown
|
// the state gets populated when the modal is shown
|
||||||
this.state = {};
|
this.state = {
|
||||||
|
loading: true
|
||||||
|
};
|
||||||
}
|
}
|
||||||
shouldComponentUpdate(nextProps, nextState) {
|
shouldComponentUpdate(nextProps, nextState) {
|
||||||
if (!this.props.show && !nextProps.show) {
|
if (!this.props.show && !nextProps.show) {
|
||||||
@@ -79,20 +81,6 @@ export default class ChannelInviteModal extends React.Component {
|
|||||||
loading: false
|
loading: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
onShow() {
|
|
||||||
// TODO ugh
|
|
||||||
/*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);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (this.props.show && !prevProps.show) {
|
|
||||||
this.onShow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (!this.props.show && nextProps.show) {
|
if (!this.props.show && nextProps.show) {
|
||||||
ChannelStore.addExtraInfoChangeListener(this.onListenerChange);
|
ChannelStore.addExtraInfoChangeListener(this.onListenerChange);
|
||||||
@@ -152,8 +140,14 @@ export default class ChannelInviteModal extends React.Component {
|
|||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
content = (<LoadingScreen/>);
|
content = (<LoadingScreen/>);
|
||||||
} else {
|
} else {
|
||||||
|
let maxHeight = 1000;
|
||||||
|
if (Utils.windowHeight() <= 1200) {
|
||||||
|
maxHeight = Utils.windowHeight() - 300;
|
||||||
|
}
|
||||||
|
|
||||||
content = (
|
content = (
|
||||||
<FilteredUserList
|
<FilteredUserList
|
||||||
|
style={{maxHeight}}
|
||||||
users={this.state.nonmembers}
|
users={this.state.nonmembers}
|
||||||
actions={[this.createInviteButton]}
|
actions={[this.createInviteButton]}
|
||||||
/>
|
/>
|
||||||
@@ -175,9 +169,7 @@ export default class ChannelInviteModal extends React.Component {
|
|||||||
<span className='name'>{this.props.channel.display_name}</span>
|
<span className='name'>{this.props.channel.display_name}</span>
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body
|
<Modal.Body>
|
||||||
ref='modalBody'
|
|
||||||
>
|
|
||||||
{inviteError}
|
{inviteError}
|
||||||
{content}
|
{content}
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
|
|||||||
@@ -75,17 +75,6 @@ export default class ChannelMembersModal extends React.Component {
|
|||||||
loading: false
|
loading: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
onShow() {
|
|
||||||
// TODO ugh
|
|
||||||
if ($(window).width() > 768) {
|
|
||||||
$(ReactDOM.findDOMNode(this.refs.modalBody)).perfectScrollbar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (this.props.show && !prevProps.show) {
|
|
||||||
this.onShow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (!this.props.show && nextProps.show) {
|
if (!this.props.show && nextProps.show) {
|
||||||
ChannelStore.addExtraInfoChangeListener(this.onChange);
|
ChannelStore.addExtraInfoChangeListener(this.onChange);
|
||||||
@@ -148,17 +137,18 @@ export default class ChannelMembersModal extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
var maxHeight = 1000;
|
|
||||||
if (Utils.windowHeight() <= 1200) {
|
|
||||||
maxHeight = Utils.windowHeight() - 300;
|
|
||||||
}
|
|
||||||
|
|
||||||
let content;
|
let content;
|
||||||
if (this.state.loading) {
|
if (this.state.loading) {
|
||||||
content = (<LoadingScreen/>);
|
content = (<LoadingScreen/>);
|
||||||
} else {
|
} else {
|
||||||
|
let maxHeight = 1000;
|
||||||
|
if (Utils.windowHeight() <= 1200) {
|
||||||
|
maxHeight = Utils.windowHeight() - 300;
|
||||||
|
}
|
||||||
|
|
||||||
content = (
|
content = (
|
||||||
<FilteredUserList
|
<FilteredUserList
|
||||||
|
style={{maxHeight}}
|
||||||
users={this.state.memberList}
|
users={this.state.memberList}
|
||||||
actions={[this.createRemoveMemberButton]}
|
actions={[this.createRemoveMemberButton]}
|
||||||
/>
|
/>
|
||||||
@@ -197,7 +187,6 @@ export default class ChannelMembersModal extends React.Component {
|
|||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body
|
<Modal.Body
|
||||||
ref='modalBody'
|
ref='modalBody'
|
||||||
style={{maxHeight}}
|
|
||||||
>
|
>
|
||||||
{content}
|
{content}
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
|
|||||||
@@ -27,6 +27,10 @@ class FilteredUserList extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
$(ReactDOM.findDOMNode(this.refs.userList)).perfectScrollbar();
|
||||||
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
if (prevState.filter !== this.state.filter) {
|
if (prevState.filter !== this.state.filter) {
|
||||||
$(ReactDOM.findDOMNode(this.refs.userList)).scrollTop(0);
|
$(ReactDOM.findDOMNode(this.refs.userList)).scrollTop(0);
|
||||||
@@ -86,7 +90,10 @@ class FilteredUserList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div
|
||||||
|
className='filtered-user-list'
|
||||||
|
style={this.props.style}
|
||||||
|
>
|
||||||
<div className='filter-row'>
|
<div className='filter-row'>
|
||||||
<div className='col-sm-6'>
|
<div className='col-sm-6'>
|
||||||
<input
|
<input
|
||||||
@@ -122,7 +129,8 @@ FilteredUserList.defaultProps = {
|
|||||||
FilteredUserList.propTypes = {
|
FilteredUserList.propTypes = {
|
||||||
intl: intlShape.isRequired,
|
intl: intlShape.isRequired,
|
||||||
users: React.PropTypes.arrayOf(React.PropTypes.object),
|
users: React.PropTypes.arrayOf(React.PropTypes.object),
|
||||||
actions: React.PropTypes.arrayOf(React.PropTypes.func)
|
actions: React.PropTypes.arrayOf(React.PropTypes.func),
|
||||||
|
style: React.PropTypes.object
|
||||||
};
|
};
|
||||||
|
|
||||||
export default injectIntl(FilteredUserList);
|
export default injectIntl(FilteredUserList);
|
||||||
|
|||||||
@@ -47,9 +47,14 @@ export default class MemberListTeam extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<FilteredUserList
|
<FilteredUserList
|
||||||
|
style={this.props.style}
|
||||||
users={this.state.users}
|
users={this.state.users}
|
||||||
actions={[TeamMembersDropdown]}
|
actions={[TeamMembersDropdown]}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MemberListTeam.propTypes = {
|
||||||
|
style: React.PropTypes.object
|
||||||
|
};
|
||||||
|
|||||||
@@ -48,23 +48,6 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
UserStore.removeChangeListener(this.handleUserChange);
|
UserStore.removeChangeListener(this.handleUserChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
|
||||||
if (!prevProps.show && this.props.show) {
|
|
||||||
this.onShow();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onShow() {
|
|
||||||
// TODO ugh
|
|
||||||
/*if (Utils.isMobile()) {
|
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).css('max-height', $(window).height() - 250);
|
|
||||||
} else {
|
|
||||||
console.log(ReactDOM.findDOMNode(this.refs.modal));
|
|
||||||
console.log($(ReactDOM.findDOMNode(this.refs.modal)));
|
|
||||||
$(ReactDOM.findDOMNode(this.refs.modal)).css('max-height', $(window).height() - 300);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
handleHide() {
|
handleHide() {
|
||||||
if (this.props.onModalDismissed) {
|
if (this.props.onModalDismissed) {
|
||||||
this.props.onModalDismissed();
|
this.props.onModalDismissed();
|
||||||
@@ -121,6 +104,11 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
let maxHeight = 1000;
|
||||||
|
if (Utils.windowHeight() <= 1200) {
|
||||||
|
maxHeight = Utils.windowHeight() - 300;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
dialogClassName='more-modal more-direct-channels'
|
dialogClassName='more-modal more-direct-channels'
|
||||||
@@ -137,6 +125,7 @@ export default class MoreDirectChannels extends React.Component {
|
|||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<FilteredUserList
|
<FilteredUserList
|
||||||
|
style={{maxHeight}}
|
||||||
users={this.state.users}
|
users={this.state.users}
|
||||||
actions={[this.createJoinDirectChannelButton]}
|
actions={[this.createJoinDirectChannelButton]}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -3,43 +3,21 @@
|
|||||||
|
|
||||||
import MemberListTeam from './member_list_team.jsx';
|
import MemberListTeam from './member_list_team.jsx';
|
||||||
import TeamStore from '../stores/team_store.jsx';
|
import TeamStore from '../stores/team_store.jsx';
|
||||||
|
import * as Utils from '../utils/utils.jsx';
|
||||||
|
|
||||||
import {FormattedMessage} from 'mm-intl';
|
import {FormattedMessage} from 'mm-intl';
|
||||||
|
|
||||||
const Modal = ReactBootstrap.Modal;
|
const Modal = ReactBootstrap.Modal;
|
||||||
|
|
||||||
export default class TeamMembersModal extends React.Component {
|
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() {
|
|
||||||
// TODO ugh
|
|
||||||
/*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() {
|
render() {
|
||||||
const team = TeamStore.getCurrent();
|
const team = TeamStore.getCurrent();
|
||||||
|
|
||||||
|
let maxHeight = 1000;
|
||||||
|
if (Utils.windowHeight() <= 1200) {
|
||||||
|
maxHeight = Utils.windowHeight() - 300;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
dialogClassName='more-modal'
|
dialogClassName='more-modal'
|
||||||
@@ -56,7 +34,7 @@ export default class TeamMembersModal extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</Modal.Header>
|
</Modal.Header>
|
||||||
<Modal.Body>
|
<Modal.Body>
|
||||||
<MemberListTeam/>
|
<MemberListTeam style={{maxHeight}}/>
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -403,7 +403,6 @@
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
max-height: 500px;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +450,6 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.user-list-item__details {
|
.user-list-item__details {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
flex-shrink: 1;
|
flex-shrink: 1;
|
||||||
@@ -472,3 +470,18 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filtered-user-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
.filter-row {
|
||||||
|
flex-grow: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-list {
|
||||||
|
flex-grow: 1;
|
||||||
|
flex-shrink: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user