element-web/src/components/views/rooms/MemberDeviceInfo.js

68 lines
2.5 KiB
JavaScript
Raw Normal View History

/*
Copyright 2016 OpenMarket 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.
*/
2016-09-04 16:01:19 +03:00
import React from 'react';
2016-09-15 03:55:51 +03:00
import sdk from '../../../index';
2016-09-04 16:01:19 +03:00
export default class MemberDeviceInfo extends React.Component {
render() {
var indicator = null;
var DeviceVerifyButtons = sdk.getComponent('elements.DeviceVerifyButtons');
2016-09-15 04:44:55 +03:00
if (this.props.device.isBlocked()) {
indicator = (
2016-09-15 04:44:55 +03:00
<div className="mx_MemberDeviceInfo_blocked">
<img src="img/e2e-blocked.svg" width="12" height="12" style={{ marginLeft: "-1px" }} alt="Blocked"/>
2016-09-15 04:44:55 +03:00
</div>
);
} else if (this.props.device.isVerified()) {
indicator = (
2016-09-15 04:44:55 +03:00
<div className="mx_MemberDeviceInfo_verified">
<img src="img/e2e-verified.svg" width="10" height="12" alt="Verified"/>
2016-09-15 04:44:55 +03:00
</div>
);
} else {
indicator = (
2016-09-15 04:44:55 +03:00
<div className="mx_MemberDeviceInfo_unverified">
<img src="img/e2e-warning.svg" width="15" height="12" style={{ marginLeft: "-2px" }} alt="Unverified"/>
2016-09-15 04:44:55 +03:00
</div>
2016-09-13 01:42:24 +03:00
);
}
var deviceName = this.props.device.ambiguous ?
(this.props.device.getDisplayName() ? this.props.device.getDisplayName() : "") + " (" + this.props.device.deviceId + ")" :
this.props.device.getDisplayName();
return (
<div className="mx_MemberDeviceInfo" >
<div className="mx_MemberDeviceInfo_deviceInfo">
<div className="mx_MemberDeviceInfo_deviceId">
{deviceName}
{indicator}
</div>
</div>
<DeviceVerifyButtons userId={this.props.userId} device={this.props.device} />
</div>
);
2016-09-04 16:01:19 +03:00
}
};
MemberDeviceInfo.displayName = 'MemberDeviceInfo';
MemberDeviceInfo.propTypes = {
userId: React.PropTypes.string.isRequired,
device: React.PropTypes.object.isRequired,
};