mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
Fixed bootloader menu
This commit is contained in:
parent
9d9340732f
commit
e0f3bb4477
@ -42,7 +42,7 @@ const ClickWrapper = styled.div`
|
||||
cursor: pointer;
|
||||
|
||||
${props => props.disabled && css`
|
||||
cursor: not-allowed;
|
||||
cursor: default;
|
||||
`}
|
||||
`;
|
||||
|
||||
@ -93,7 +93,14 @@ const Dot = styled.div`
|
||||
|
||||
|
||||
const DeviceHeader = ({
|
||||
isOpen, icon, device, isHoverable = true, onClickWrapper, disabled = false, isSelected = false,
|
||||
isOpen,
|
||||
icon,
|
||||
device,
|
||||
isHoverable = true,
|
||||
onClickWrapper,
|
||||
isBootloader = false,
|
||||
disabled = false,
|
||||
isSelected = false,
|
||||
}) => {
|
||||
const status = getStatus(device);
|
||||
return (
|
||||
@ -116,7 +123,7 @@ const DeviceHeader = ({
|
||||
<Status>{getStatusName(status)}</Status>
|
||||
</LabelWrapper>
|
||||
<IconWrapper>
|
||||
{icon && !disabled && icon}
|
||||
{icon && !disabled && !isBootloader && icon}
|
||||
</IconWrapper>
|
||||
</ClickWrapper>
|
||||
</Wrapper>
|
||||
@ -124,6 +131,7 @@ const DeviceHeader = ({
|
||||
};
|
||||
|
||||
DeviceHeader.propTypes = {
|
||||
isBootloader: PropTypes.bool,
|
||||
device: PropTypes.object,
|
||||
icon: PropTypes.element,
|
||||
isHoverable: PropTypes.bool,
|
||||
|
@ -4,6 +4,7 @@ import Icon from 'components/Icon';
|
||||
import DeviceHeader from 'components/DeviceHeader';
|
||||
import icons from 'config/icons';
|
||||
import colors from 'config/colors';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
const Wrapper = styled.div``;
|
||||
const IconClick = styled.div``;
|
||||
@ -14,6 +15,10 @@ class DeviceList extends Component {
|
||||
return a.instance > b.instance ? 1 : -1;
|
||||
}
|
||||
|
||||
redirectToBootloader(selectedDevice) {
|
||||
this.props.history.push(`/device/${selectedDevice.features.device_id}/bootloader`);
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
devices, selectedDevice, onSelectDevice, forgetDevice,
|
||||
@ -26,10 +31,12 @@ class DeviceList extends Component {
|
||||
device !== selectedDevice && (
|
||||
<DeviceHeader
|
||||
key={device.state || device.path}
|
||||
disabled={device.features && device.features.bootloader_mode}
|
||||
isBootloader={device.features.bootloader_mode}
|
||||
onClickWrapper={() => {
|
||||
if (device.features
|
||||
&& !device.features.bootloader_mode) {
|
||||
if (device.features) {
|
||||
if (device.features.bootloader_mode) {
|
||||
this.redirectToBootloader(selectedDevice);
|
||||
}
|
||||
onSelectDevice(device);
|
||||
}
|
||||
}}
|
||||
@ -62,4 +69,4 @@ class DeviceList extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default DeviceList;
|
||||
export default withRouter(DeviceList);
|
@ -187,6 +187,7 @@ class LeftNavigation extends React.PureComponent<Props, State> {
|
||||
>
|
||||
<Header
|
||||
isSelected
|
||||
isHoverable={false}
|
||||
onClickWrapper={() => {
|
||||
if (!isDeviceInBootloader || this.props.devices.length > 1) {
|
||||
this.handleOpen();
|
||||
|
Loading…
Reference in New Issue
Block a user