mirror of
https://github.com/element-hq/element-web.git
synced 2024-12-15 23:22:01 +03:00
f4937a81cf
Signed-off-by: Marco Zehe <marcozehe@mailbox.org>
78 lines
2.4 KiB
JavaScript
78 lines
2.4 KiB
JavaScript
/*
|
|
Copyright 2017 Vector Creations Ltd
|
|
Copyright 2017 New Vector Ltd
|
|
Copyright 2019 Michael Telatynski <7t3chguy@gmail.com>
|
|
|
|
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 createReactClass from 'create-react-class';
|
|
import * as sdk from '../../../index';
|
|
import dis from '../../../dispatcher';
|
|
import { GroupMemberType } from '../../../groups';
|
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
|
|
|
export default createReactClass({
|
|
displayName: 'GroupMemberTile',
|
|
|
|
propTypes: {
|
|
groupId: PropTypes.string.isRequired,
|
|
member: GroupMemberType.isRequired,
|
|
},
|
|
|
|
getInitialState: function() {
|
|
return {};
|
|
},
|
|
|
|
statics: {
|
|
contextType: MatrixClientContext,
|
|
},
|
|
|
|
onClick: function(e) {
|
|
dis.dispatch({
|
|
action: 'view_group_user',
|
|
member: this.props.member,
|
|
groupId: this.props.groupId,
|
|
});
|
|
},
|
|
|
|
render: function() {
|
|
const BaseAvatar = sdk.getComponent('avatars.BaseAvatar');
|
|
const EntityTile = sdk.getComponent('rooms.EntityTile');
|
|
|
|
const name = this.props.member.displayname || this.props.member.userId;
|
|
const avatarUrl = this.context.mxcUrlToHttp(
|
|
this.props.member.avatarUrl,
|
|
36, 36, 'crop',
|
|
);
|
|
|
|
const av = (
|
|
<BaseAvatar
|
|
aria-hidden="true"
|
|
name={this.props.member.displayname || this.props.member.userId}
|
|
idName={this.props.member.userId}
|
|
width={36} height={36}
|
|
url={avatarUrl}
|
|
/>
|
|
);
|
|
|
|
return (
|
|
<EntityTile name={name} avatarJsx={av} onClick={this.onClick}
|
|
suppressOnHover={true} presenceState="online"
|
|
powerStatus={this.props.member.isPrivileged ? EntityTile.POWER_STATUS_ADMIN : null}
|
|
/>
|
|
);
|
|
},
|
|
});
|