From 1bc6fa941285b9f1a3258278437d2b7b027304ed Mon Sep 17 00:00:00 2001 From: Vasek Mlejnsky Date: Tue, 25 Sep 2018 14:36:07 +0200 Subject: [PATCH] Fix broken eject icon & disable click on Header in LeftNavigation if device is in bootloader moder --- src/components/DeviceHeader/index.js | 7 +++++-- .../components/DeviceMenu/components/DeviceList/index.js | 8 +++++--- .../LeftNavigation/components/DeviceMenu/index.js | 1 + src/views/Wallet/components/LeftNavigation/index.js | 3 +-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/DeviceHeader/index.js b/src/components/DeviceHeader/index.js index e1e6ec26..ad9b7c54 100644 --- a/src/components/DeviceHeader/index.js +++ b/src/components/DeviceHeader/index.js @@ -26,7 +26,7 @@ const Wrapper = styled.div` box-shadow: none; `} - ${props => props.isHoverable && css` + ${props => props.isHoverable && !props.disabled && css` &:hover { background: ${colors.GRAY_LIGHT}; } @@ -103,7 +103,10 @@ const DeviceHeader = ({ isHoverable={isHoverable} disabled={disabled} > - + diff --git a/src/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/DeviceList/index.js b/src/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/DeviceList/index.js index 31d66a0c..d8228df3 100644 --- a/src/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/DeviceList/index.js +++ b/src/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/DeviceList/index.js @@ -15,7 +15,9 @@ class DeviceList extends Component { } render() { - const { devices, selectedDevice, onSelectDevice } = this.props; + const { + devices, selectedDevice, onSelectDevice, forgetDevice, + } = this.props; return ( {devices @@ -31,13 +33,13 @@ class DeviceList extends Component { onSelectDevice(device); } }} - onClickIcon={() => this.onDeviceMenuClick({ type: 'forget', label: '' }, device)} + onClickIcon={() => forgetDevice(device)} icon={( { event.stopPropagation(); event.preventDefault(); - this.onDeviceMenuClick({ type: 'forget', label: '' }, device); + forgetDevice(device); }} > { devices={devices} selectedDevice={selectedDevice} onSelectDevice={onSelectDevice} + forgetDevice={() => this.props.forgetDevice(selectedDevice)} /> {isWebUSB(transport) && ( diff --git a/src/views/Wallet/components/LeftNavigation/index.js b/src/views/Wallet/components/LeftNavigation/index.js index ad81cb8d..e44c30c6 100644 --- a/src/views/Wallet/components/LeftNavigation/index.js +++ b/src/views/Wallet/components/LeftNavigation/index.js @@ -190,8 +190,7 @@ class LeftNavigation extends React.PureComponent { isSelected onClickWrapper={() => this.handleOpen()} device={this.props.wallet.selectedDevice} - transport={this.props.connect.transport} - devices={this.props.devices} + disabled={this.props.wallet.selectedDevice.features && this.props.wallet.selectedDevice.features.bootloader_mode && this.props.devices.length === 1} isOpen={this.props.wallet.dropdownOpened} icon={(