element-web/src/components/views/groups/GroupMemberTile.js

63 lines
1.8 KiB
JavaScript
Raw Normal View History

2017-07-25 17:56:16 +03:00
/*
Copyright 2017 Vector Creations Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import React from 'react';
import PropTypes from 'prop-types';
import sdk from '../../../index';
import dis from '../../../dispatcher';
2017-08-04 17:00:34 +03:00
import { GroupMemberType } from '../../../groups';
2017-07-25 17:56:16 +03:00
import withMatrixClient from '../../../wrappers/withMatrixClient';
export default withMatrixClient(React.createClass({
displayName: 'GroupMemberTile',
propTypes: {
matrixClient: PropTypes.object,
2017-08-04 17:00:34 +03:00
groupId: PropTypes.string.isRequired,
member: GroupMemberType.isRequired,
2017-07-25 17:56:16 +03:00
},
getInitialState: function() {
return {};
},
onClick: function(e) {
dis.dispatch({
2017-08-04 17:00:34 +03:00
action: 'view_group_user',
member: this.props.member,
groupId: this.props.groupId,
2017-07-25 17:56:16 +03:00
});
},
render: function() {
const BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
const EntityTile = sdk.getComponent('rooms.EntityTile');
2017-08-04 17:00:34 +03:00
const name = this.props.member.userId;
2017-07-25 17:56:16 +03:00
const av = (
2017-08-04 17:00:34 +03:00
<BaseAvatar name={this.props.member.userId} width={36} height={36} />
2017-07-25 17:56:16 +03:00
);
return (
<EntityTile presenceState="online"
avatarJsx={av} onClick={this.onClick}
2017-07-25 17:56:16 +03:00
name={name} powerLevel={0} suppressOnHover={true}
/>
);
2017-08-21 21:34:07 +03:00
},
2017-07-25 17:56:16 +03:00
}));