mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
Added MenuItems comnponent
This commit is contained in:
parent
9bc266c4fb
commit
ab4ecbebd7
@ -0,0 +1,31 @@
|
||||
import React, { Component } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import Icon from 'components/Icon';
|
||||
import icons from 'config/icons';
|
||||
import colors from 'config/colors';
|
||||
|
||||
const Wrapper = styled.div``;
|
||||
const Item = styled.div``;
|
||||
|
||||
class MenuItems extends Component {
|
||||
showClone() {
|
||||
return this.props.selectedDevice.features.passphrase_protection && this.props.selectedDevice.connected && this.props.selectedDevice.available;
|
||||
}
|
||||
|
||||
showRenewSession() {
|
||||
return this.props.selectedDevice.status;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Wrapper>
|
||||
<Item>Device settings</Item>
|
||||
<Item>Forget</Item>
|
||||
{this.showClone() && <Item>Create hidden wallet</Item>}
|
||||
{this.showRenewSession() && <Item>Renew session</Item>}
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default MenuItems;
|
@ -1,55 +0,0 @@
|
||||
import React, { Component } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import Icon from 'components/Icon';
|
||||
import DeviceHeader from 'components/DeviceHeader';
|
||||
import icons from 'config/icons';
|
||||
import colors from 'config/colors';
|
||||
|
||||
const Wrapper = styled.div``;
|
||||
const IconClick = styled.div``;
|
||||
|
||||
class DeviceList extends Component {
|
||||
sortByInstance(a, b) {
|
||||
if (!a.instance || !b.instance) return -1;
|
||||
return a.instance > b.instance ? 1 : -1;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { devices, selectedDevice, onSelectDevice } = this.props;
|
||||
return (
|
||||
<Wrapper>
|
||||
{devices
|
||||
.sort(this.sortByInstance)
|
||||
.map(device => (
|
||||
device !== selectedDevice && (
|
||||
<DeviceHeader
|
||||
key={`${device.instanceLabel}`}
|
||||
onClickWrapper={() => this.props.onSelectDevice(device)}
|
||||
onClickIcon={() => this.onDeviceMenuClick({ type: 'forget', label: '' }, device)}
|
||||
icon={(
|
||||
<IconClick onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
this.onDeviceMenuClick({ type: 'forget', label: '' }, device);
|
||||
}}
|
||||
>
|
||||
<Icon
|
||||
icon={icons.EJECT}
|
||||
size={25}
|
||||
color={colors.TEXT_SECONDARY}
|
||||
/>
|
||||
</IconClick>
|
||||
)}
|
||||
device={device}
|
||||
devices={devices}
|
||||
isHoverable
|
||||
/>
|
||||
)
|
||||
))}
|
||||
|
||||
</Wrapper>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default DeviceList;
|
Loading…
Reference in New Issue
Block a user