|
|
|
@ -27,19 +27,6 @@ const Label = styled.div`
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
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() {
|
|
|
|
|
const { device } = this.props;
|
|
|
|
|
return device && device.mode === 'normal';
|
|
|
|
@ -55,9 +42,14 @@ class MenuItems extends PureComponent {
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
if (!this.showDeviceMenu()) return null;
|
|
|
|
|
const { device } = this.props;
|
|
|
|
|
return (
|
|
|
|
|
<Wrapper>
|
|
|
|
|
{/* <Item onClick={() => this.onDeviceMenuClick('settings', this.props.device)}>
|
|
|
|
|
{/* <Item onClick={() => {
|
|
|
|
|
this.props.toggleDeviceDropdown(false);
|
|
|
|
|
this.props.gotoDeviceSettings(device);
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<Icon
|
|
|
|
|
icon={icons.COG}
|
|
|
|
|
size={25}
|
|
|
|
@ -65,16 +57,8 @@ class MenuItems extends PureComponent {
|
|
|
|
|
/>
|
|
|
|
|
<Label>Device settings</Label>
|
|
|
|
|
</Item> */}
|
|
|
|
|
<Item onClick={() => this.onDeviceMenuClick('forget', this.props.device)}>
|
|
|
|
|
<Icon
|
|
|
|
|
icon={icons.EJECT}
|
|
|
|
|
size={25}
|
|
|
|
|
color={colors.TEXT_SECONDARY}
|
|
|
|
|
/>
|
|
|
|
|
<Label>Forget</Label>
|
|
|
|
|
</Item>
|
|
|
|
|
{this.showClone() && (
|
|
|
|
|
<Item onClick={() => this.onDeviceMenuClick('clone', this.props.device)}>
|
|
|
|
|
<Item onClick={() => this.props.duplicateDevice(device)}>
|
|
|
|
|
<Icon
|
|
|
|
|
icon={icons.T1}
|
|
|
|
|
size={25}
|
|
|
|
@ -85,12 +69,20 @@ class MenuItems extends PureComponent {
|
|
|
|
|
)}
|
|
|
|
|
{this.showRenewSession() && (
|
|
|
|
|
<Item
|
|
|
|
|
onClick={() => this.onDeviceMenuClick('reload')}
|
|
|
|
|
onClick={() => this.props.acquireDevice()}
|
|
|
|
|
>
|
|
|
|
|
<Icon icon={icons.T1} size={25} color={colors.TEXT_SECONDARY} />
|
|
|
|
|
<Label>Renew session</Label>
|
|
|
|
|
</Item>
|
|
|
|
|
)}
|
|
|
|
|
<Item onClick={() => this.props.forgetDevice(device)}>
|
|
|
|
|
<Icon
|
|
|
|
|
icon={icons.EJECT}
|
|
|
|
|
size={25}
|
|
|
|
|
color={colors.TEXT_SECONDARY}
|
|
|
|
|
/>
|
|
|
|
|
<Label>Forget device</Label>
|
|
|
|
|
</Item>
|
|
|
|
|
</Wrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -101,8 +93,8 @@ MenuItems.propTypes = {
|
|
|
|
|
acquireDevice: PropTypes.func.isRequired,
|
|
|
|
|
forgetDevice: PropTypes.func.isRequired,
|
|
|
|
|
duplicateDevice: PropTypes.func.isRequired,
|
|
|
|
|
toggleDeviceDropdown: PropTypes.func.isRequired,
|
|
|
|
|
gotoDeviceSettings: PropTypes.func.isRequired,
|
|
|
|
|
// toggleDeviceDropdown: PropTypes.func.isRequired,
|
|
|
|
|
// gotoDeviceSettings: PropTypes.func.isRequired,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default MenuItems;
|