2016-06-08 15:13:41 +03:00
|
|
|
/*
|
|
|
|
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';
|
2017-12-26 04:03:18 +03:00
|
|
|
import PropTypes from 'prop-types';
|
2019-12-20 04:19:56 +03:00
|
|
|
import * as sdk from '../../../index';
|
2017-06-02 12:18:31 +03:00
|
|
|
import { _t } from '../../../languageHandler';
|
2019-02-01 19:32:46 +03:00
|
|
|
import classNames from 'classnames';
|
2016-06-08 15:13:41 +03:00
|
|
|
|
2016-09-04 16:01:19 +03:00
|
|
|
export default class MemberDeviceInfo extends React.Component {
|
|
|
|
render() {
|
2017-10-11 19:56:17 +03:00
|
|
|
const DeviceVerifyButtons = sdk.getComponent('elements.DeviceVerifyButtons');
|
2020-01-03 18:38:59 +03:00
|
|
|
// XXX: These checks are not cross-signing aware but this component is only used
|
|
|
|
// from the old, pre-cross-signing memberinfopanel
|
2019-02-01 19:32:46 +03:00
|
|
|
const iconClasses = classNames({
|
|
|
|
mx_MemberDeviceInfo_icon: true,
|
|
|
|
mx_MemberDeviceInfo_icon_blacklisted: this.props.device.isBlocked(),
|
|
|
|
mx_MemberDeviceInfo_icon_verified: this.props.device.isVerified(),
|
|
|
|
mx_MemberDeviceInfo_icon_unverified: this.props.device.isUnverified(),
|
|
|
|
});
|
|
|
|
const indicator = (<div className={iconClasses} />);
|
2019-02-12 20:34:35 +03:00
|
|
|
const deviceName = (this.props.device.ambiguous || this.props.showDeviceId) ?
|
2016-09-22 21:23:34 +03:00
|
|
|
(this.props.device.getDisplayName() ? this.props.device.getDisplayName() : "") + " (" + this.props.device.deviceId + ")" :
|
|
|
|
this.props.device.getDisplayName();
|
|
|
|
|
2016-09-22 21:28:50 +03:00
|
|
|
// add the deviceId as a titletext to help with debugging
|
2016-06-08 15:13:41 +03:00
|
|
|
return (
|
2016-09-22 21:28:50 +03:00
|
|
|
<div className="mx_MemberDeviceInfo"
|
2017-06-02 12:18:31 +03:00
|
|
|
title={_t("device id: ") + this.props.device.deviceId} >
|
2019-02-01 19:32:46 +03:00
|
|
|
{ indicator }
|
2016-09-22 21:23:34 +03:00
|
|
|
<div className="mx_MemberDeviceInfo_deviceInfo">
|
|
|
|
<div className="mx_MemberDeviceInfo_deviceId">
|
2017-10-11 19:56:17 +03:00
|
|
|
{ deviceName }
|
2016-09-22 21:23:34 +03:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<DeviceVerifyButtons userId={this.props.userId} device={this.props.device} />
|
2016-06-08 15:13:41 +03:00
|
|
|
</div>
|
|
|
|
);
|
2016-09-04 16:01:19 +03:00
|
|
|
}
|
2017-01-20 17:22:27 +03:00
|
|
|
}
|
2016-09-04 16:01:19 +03:00
|
|
|
|
|
|
|
MemberDeviceInfo.displayName = 'MemberDeviceInfo';
|
|
|
|
MemberDeviceInfo.propTypes = {
|
2017-12-26 04:03:18 +03:00
|
|
|
userId: PropTypes.string.isRequired,
|
|
|
|
device: PropTypes.object.isRequired,
|
2016-09-04 16:01:19 +03:00
|
|
|
};
|