Converted TeamMembers (now called TeamMembersModal) to React-Bootstrap

Этот коммит содержится в:
hmhealey
2015-11-21 08:53:45 -05:00
родитель 6ab7df3335
Коммит afdef124c8
6 изменённых файлов: 119 добавлений и 154 удалений

Просмотреть файл

@@ -2,17 +2,56 @@
// See License.txt for license information.
import MemberListTeamItem from './member_list_team_item.jsx';
import UserStore from '../stores/user_store.jsx';
export default class MemberListTeam extends React.Component {
constructor(props) {
super(props);
this.getUsers = this.getUsers.bind(this);
this.onChange = this.onChange.bind(this);
this.state = {
users: this.getUsers()
};
}
componentDidMount() {
UserStore.addChangeListener(this.onChange);
}
componentWillUnmount() {
UserStore.removeChangeListener(this.onChange);
}
getUsers() {
const profiles = UserStore.getProfiles();
const users = [];
for (const id of Object.keys(profiles)) {
users.push(profiles[id]);
}
users.sort((a, b) => a.username.localeCompare(b.username));
return users;
}
onChange() {
this.setState({
users: this.getUsers()
});
}
render() {
const memberList = this.props.users.map(function makeListItem(user) {
const memberList = this.state.users.map((user) => {
return (
<MemberListTeamItem
key={user.id}
user={user}
/>
);
}, this);
});
return (
<table className='table more-table member-list-holder'>
@@ -23,7 +62,3 @@ export default class MemberListTeam extends React.Component {
);
}
}
MemberListTeam.propTypes = {
users: React.PropTypes.arrayOf(React.PropTypes.object).isRequired
};