You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-wallet/src/js/components/Devices.js

43 lines
1.2 KiB

/* @flow */
'use strict';
import React, { Component } from 'react';
export default class Devices extends Component {
render() {
const { devices, selectedDevice } = this.props.connect;
const deviceList: Array<any> = devices.map((dev, index) => {
let css: string = "";
if (dev.unacquired) {
css += "unacquired";
}
if (dev.isUsedElsewhere) {
css += " used-elsewhere";
}
if (dev.featuresNeedsReload) {
css += " reload-features";
}
if (dev.path === selectedDevice) {
css += " active";
}
return (<li key={index} className={css} onClick={ event => this.props.onSelectDevice(dev.path) } >{ dev.label }</li>);
});
if (deviceList.length === 0) {
deviceList.push(
(<li key={0}>No connected devices</li>)
);
}
return (
<nav>
<div className="layout-wrapper">
<ul>
{ deviceList }
</ul>
</div>
</nav>
);
}
}