update icons in member info device section

This commit is contained in:
Bruno Windels 2019-02-01 17:32:46 +01:00
parent 21fe266394
commit ce5e56aaac
4 changed files with 37 additions and 23 deletions

View file

@ -20,6 +20,25 @@ limitations under the License.
align-items: start; align-items: start;
} }
.mx_MemberDeviceInfo_icon {
margin-top: 4px;
width: 12px;
height: 12px;
mask-repeat: no-repeat;
}
.mx_MemberDeviceInfo_icon_blacklisted {
mask-image: url('$(res)/img/feather-icons/e2e/blacklisted.svg');
background-color: $warning-color;
}
.mx_MemberDeviceInfo_icon_verified {
mask-image: url('$(res)/img/feather-icons/e2e/verified.svg');
background-color: $accent-color;
}
.mx_MemberDeviceInfo_icon_unverified {
mask-image: url('$(res)/img/feather-icons/e2e/warning.svg');
background-color: $warning-color;
}
.mx_MemberDeviceInfo > .mx_DeviceVerifyButtons { .mx_MemberDeviceInfo > .mx_DeviceVerifyButtons {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View file

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12">
<defs>
<path id="a" d="M5 10A5 5 0 1 0 5 0a5 5 0 0 0 0 10zM2.5 3.5h5a1.5 1.5 0 0 1 0 3h-5a1.5 1.5 0 0 1 0-3z"/>
</defs>
<use fill="#F56679" fill-rule="evenodd" stroke="#F56679" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2" transform="translate(1 1)" xlink:href="#a"/>
</svg>

After

Width:  |  Height:  |  Size: 442 B

View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="11" height="12" viewBox="0 0 11 12">
<path fill="#7AC9A1" fill-rule="evenodd" stroke="#7AC9A1" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.2" d="M5.5 11S10 9 10 6V2.5L5.5 1 1 2.5V6c0 3 4.5 5 4.5 5z"/>
</svg>

After

Width:  |  Height:  |  Size: 278 B

View file

@ -18,32 +18,18 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import sdk from '../../../index'; import sdk from '../../../index';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import classNames from 'classnames';
export default class MemberDeviceInfo extends React.Component { export default class MemberDeviceInfo extends React.Component {
render() { render() {
let indicator = null;
const DeviceVerifyButtons = sdk.getComponent('elements.DeviceVerifyButtons'); const DeviceVerifyButtons = sdk.getComponent('elements.DeviceVerifyButtons');
const iconClasses = classNames({
if (this.props.device.isBlocked()) { mx_MemberDeviceInfo_icon: true,
indicator = ( mx_MemberDeviceInfo_icon_blacklisted: this.props.device.isBlocked(),
<div className="mx_MemberDeviceInfo_blacklisted"> mx_MemberDeviceInfo_icon_verified: this.props.device.isVerified(),
<img src={require("../../../../res/img/e2e-blocked.svg")} width="12" height="12" style={{ marginLeft: "-1px" }} alt={_t("Blacklisted")} /> mx_MemberDeviceInfo_icon_unverified: this.props.device.isUnverified(),
</div> });
); const indicator = (<div className={iconClasses} />);
} else if (this.props.device.isVerified()) {
indicator = (
<div className="mx_MemberDeviceInfo_verified">
<img src={require("../../../../res/img/e2e-verified.svg")} width="10" height="12" alt={_t("Verified")} />
</div>
);
} else {
indicator = (
<div className="mx_MemberDeviceInfo_unverified">
<img src={require("../../../../res/img/e2e-warning.svg")} width="15" height="12" style={{ marginLeft: "-2px" }} alt={_t("Unverified")} />
</div>
);
}
const deviceName = this.props.device.ambiguous ? const deviceName = this.props.device.ambiguous ?
(this.props.device.getDisplayName() ? this.props.device.getDisplayName() : "") + " (" + this.props.device.deviceId + ")" : (this.props.device.getDisplayName() ? this.props.device.getDisplayName() : "") + " (" + this.props.device.deviceId + ")" :
this.props.device.getDisplayName(); this.props.device.getDisplayName();
@ -52,10 +38,10 @@ export default class MemberDeviceInfo extends React.Component {
return ( return (
<div className="mx_MemberDeviceInfo" <div className="mx_MemberDeviceInfo"
title={_t("device id: ") + this.props.device.deviceId} > title={_t("device id: ") + this.props.device.deviceId} >
{ indicator }
<div className="mx_MemberDeviceInfo_deviceInfo"> <div className="mx_MemberDeviceInfo_deviceInfo">
<div className="mx_MemberDeviceInfo_deviceId"> <div className="mx_MemberDeviceInfo_deviceId">
{ deviceName } { deviceName }
{ indicator }
</div> </div>
</div> </div>
<DeviceVerifyButtons userId={this.props.userId} device={this.props.device} /> <DeviceVerifyButtons userId={this.props.userId} device={this.props.device} />