1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-07-06 14:52:33 +00:00
trezor-wallet/src/js/components/Devices.js
Szymon Lesisz 6a9fde9f86 first
2017-12-13 12:01:37 +01:00

43 lines
1.2 KiB
JavaScript

/* @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>
);
}
}