|
|
@ -30,19 +30,6 @@ const Label = styled.div`
|
|
|
|
`;
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
|
|
class MenuItems extends PureComponent {
|
|
|
|
class MenuItems extends PureComponent {
|
|
|
|
onDeviceMenuClick(action, device) {
|
|
|
|
|
|
|
|
if (action === 'reload') {
|
|
|
|
|
|
|
|
this.props.acquireDevice();
|
|
|
|
|
|
|
|
} else if (action === 'forget') {
|
|
|
|
|
|
|
|
this.props.forgetDevice(device);
|
|
|
|
|
|
|
|
} else if (action === 'clone') {
|
|
|
|
|
|
|
|
this.props.duplicateDevice(device);
|
|
|
|
|
|
|
|
} else if (action === 'settings') {
|
|
|
|
|
|
|
|
this.props.toggleDeviceDropdown(false);
|
|
|
|
|
|
|
|
this.props.gotoDeviceSettings(device);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showDeviceMenu() {
|
|
|
|
showDeviceMenu() {
|
|
|
|
const { device } = this.props;
|
|
|
|
const { device } = this.props;
|
|
|
|
return device && device.mode === 'normal';
|
|
|
|
return device && device.mode === 'normal';
|
|
|
@ -58,9 +45,14 @@ class MenuItems extends PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
if (!this.showDeviceMenu()) return null;
|
|
|
|
if (!this.showDeviceMenu()) return null;
|
|
|
|
|
|
|
|
const { device } = this.props;
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Wrapper>
|
|
|
|
<Wrapper>
|
|
|
|
{/* <Item onClick={() => this.onDeviceMenuClick('settings', this.props.device)}>
|
|
|
|
{/* <Item onClick={() => {
|
|
|
|
|
|
|
|
this.props.toggleDeviceDropdown(false);
|
|
|
|
|
|
|
|
this.props.gotoDeviceSettings(device);
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
|
|
|
>
|
|
|
|
<Icon
|
|
|
|
<Icon
|
|
|
|
icon={icons.COG}
|
|
|
|
icon={icons.COG}
|
|
|
|
size={25}
|
|
|
|
size={25}
|
|
|
@ -68,28 +60,32 @@ class MenuItems extends PureComponent {
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<Label>Device settings</Label>
|
|
|
|
<Label>Device settings</Label>
|
|
|
|
</Item> */}
|
|
|
|
</Item> */}
|
|
|
|
<Item onClick={() => this.onDeviceMenuClick('forget', this.props.device)}>
|
|
|
|
{this.showClone() && (
|
|
|
|
|
|
|
|
<Item onClick={() => this.props.duplicateDevice(device)}>
|
|
|
|
<Icon
|
|
|
|
<Icon
|
|
|
|
icon={icons.EJECT}
|
|
|
|
icon={icons.WALLET_STANDARD}
|
|
|
|
size={25}
|
|
|
|
size={25}
|
|
|
|
color={colors.TEXT_SECONDARY}
|
|
|
|
color={colors.TEXT_SECONDARY}
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<Label>Forget</Label>
|
|
|
|
|
|
|
|
</Item>
|
|
|
|
|
|
|
|
{this.showClone() && (
|
|
|
|
|
|
|
|
<Item onClick={() => this.onDeviceMenuClick('clone', this.props.device)}>
|
|
|
|
|
|
|
|
<DeviceIcon device={this.props.device} size={25} color={colors.TEXT_SECONDARY} />
|
|
|
|
|
|
|
|
<Label>Change wallet type</Label>
|
|
|
|
<Label>Change wallet type</Label>
|
|
|
|
</Item>
|
|
|
|
</Item>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
{this.showRenewSession() && (
|
|
|
|
{this.showRenewSession() && (
|
|
|
|
<Item
|
|
|
|
<Item
|
|
|
|
onClick={() => this.onDeviceMenuClick('reload')}
|
|
|
|
onClick={() => this.props.acquireDevice()}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<DeviceIcon device={this.props.device} size={25} color={colors.TEXT_SECONDARY} />
|
|
|
|
<DeviceIcon device={this.props.device} size={25} color={colors.TEXT_SECONDARY} />
|
|
|
|
<Label>Renew session</Label>
|
|
|
|
<Label>Renew session</Label>
|
|
|
|
</Item>
|
|
|
|
</Item>
|
|
|
|
)}
|
|
|
|
)}
|
|
|
|
|
|
|
|
<Item onClick={() => this.props.forgetDevice(device)}>
|
|
|
|
|
|
|
|
<Icon
|
|
|
|
|
|
|
|
icon={icons.EJECT}
|
|
|
|
|
|
|
|
size={25}
|
|
|
|
|
|
|
|
color={colors.TEXT_SECONDARY}
|
|
|
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
<Label>Forget device</Label>
|
|
|
|
|
|
|
|
</Item>
|
|
|
|
</Wrapper>
|
|
|
|
</Wrapper>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -100,8 +96,8 @@ MenuItems.propTypes = {
|
|
|
|
acquireDevice: PropTypes.func.isRequired,
|
|
|
|
acquireDevice: PropTypes.func.isRequired,
|
|
|
|
forgetDevice: PropTypes.func.isRequired,
|
|
|
|
forgetDevice: PropTypes.func.isRequired,
|
|
|
|
duplicateDevice: PropTypes.func.isRequired,
|
|
|
|
duplicateDevice: PropTypes.func.isRequired,
|
|
|
|
toggleDeviceDropdown: PropTypes.func.isRequired,
|
|
|
|
// toggleDeviceDropdown: PropTypes.func.isRequired,
|
|
|
|
gotoDeviceSettings: PropTypes.func.isRequired,
|
|
|
|
// gotoDeviceSettings: PropTypes.func.isRequired,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
export default MenuItems;
|
|
|
|
export default MenuItems;
|