1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 09:18:09 +00:00

device menu sorted by instance

This commit is contained in:
Szymon Lesisz 2018-08-16 23:00:06 +02:00
parent ebbba8139a
commit d8b492e7b6

View File

@ -171,7 +171,11 @@ export class DeviceDropdown extends Component<Props> {
);
}
const deviceList = devices.map((dev, index) => {
const sortByInstance = (a: TrezorDevice, b: TrezorDevice) => {
if (!a.instance || !b.instance) return -1;
return a.instance > b.instance ? 1 : -1;
}
const deviceList = devices.sort(sortByInstance).map((dev, index) => {
if (dev === selected) return null;
let deviceStatus: string = 'Connected';
@ -197,7 +201,7 @@ export class DeviceDropdown extends Component<Props> {
return (
<div key={index} className={css} onClick={() => this.props.onSelectDevice(dev)}>
<div className="label-container">
<span className="label">{ dev.instanceLabel }</span>
<span className="label">111{ dev.instanceLabel }</span>
<span className="status">{ deviceStatus }</span>
</div>
<div