mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
device menu sorted by instance
This commit is contained in:
parent
ebbba8139a
commit
d8b492e7b6
@ -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;
|
if (dev === selected) return null;
|
||||||
|
|
||||||
let deviceStatus: string = 'Connected';
|
let deviceStatus: string = 'Connected';
|
||||||
@ -197,7 +201,7 @@ export class DeviceDropdown extends Component<Props> {
|
|||||||
return (
|
return (
|
||||||
<div key={index} className={css} onClick={() => this.props.onSelectDevice(dev)}>
|
<div key={index} className={css} onClick={() => this.props.onSelectDevice(dev)}>
|
||||||
<div className="label-container">
|
<div className="label-container">
|
||||||
<span className="label">{ dev.instanceLabel }</span>
|
<span className="label">111{ dev.instanceLabel }</span>
|
||||||
<span className="status">{ deviceStatus }</span>
|
<span className="status">{ deviceStatus }</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
Loading…
Reference in New Issue
Block a user