mirror of
https://github.com/trezor/trezor-wallet
synced 2025-01-16 02:51:03 +00:00
Put back old menuItems for now
This commit is contained in:
parent
9e86cfdc0c
commit
bcc0c609a1
@ -1,6 +1,8 @@
|
||||
import React, { Component } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import PropTypes from 'prop-types';
|
||||
import Icon from 'components/Icon';
|
||||
|
||||
import icons from 'config/icons';
|
||||
import colors from 'config/colors';
|
||||
import { FONT_SIZE } from 'config/variables';
|
||||
@ -26,25 +28,30 @@ const Label = styled.div`
|
||||
`;
|
||||
|
||||
class MenuItems extends Component {
|
||||
onClick(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);
|
||||
}
|
||||
}
|
||||
// makeAction(action, device) {
|
||||
// switch (action) {
|
||||
// case 'reload': this.props.acquireDevice();
|
||||
// break;
|
||||
// case 'forget': this.props.forgetDevice();
|
||||
// break;
|
||||
// case 'clone': this.props.duplicateDevice();
|
||||
// break;
|
||||
// case 'settings': {
|
||||
// this.props.toggleDeviceDropdown(false);
|
||||
// this.props.gotoDeviceSettings(device);
|
||||
// break;
|
||||
// }
|
||||
// default: console.log('no action');
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
showClone() {
|
||||
return this.props.selectedDevice.features.passphrase_protection && this.props.selectedDevice.connected && this.props.selectedDevice.available;
|
||||
return this.props.selectedDevice && this.props.selectedDevice.features.passphrase_protection && this.props.selectedDevice.connected && this.props.selectedDevice.available;
|
||||
}
|
||||
|
||||
showRenewSession() {
|
||||
return this.props.selectedDevice.status !== 'available';
|
||||
return this.props.selectedDevice && this.props.selectedDevice.status !== 'available';
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -75,4 +82,13 @@ class MenuItems extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
MenuItems.propTypes = {
|
||||
selectedDevice: PropTypes.object.isRequired,
|
||||
acquireDevice: PropTypes.func.isRequired,
|
||||
forgetDevice: PropTypes.func.isRequired,
|
||||
duplicateDevice: PropTypes.func.isRequired,
|
||||
toggleDeviceDropdown: PropTypes.func.isRequired,
|
||||
gotoDeviceSettings: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
export default MenuItems;
|
@ -81,6 +81,19 @@ export class DeviceDropdown extends Component<Props> {
|
||||
if (transport && transport.version.indexOf('webusb') >= 0) TrezorConnect.renderWebUSBButton();
|
||||
}
|
||||
|
||||
onDeviceMenuClick(item: DeviceMenuItem, device: TrezorDevice): void {
|
||||
if (item.type === 'reload') {
|
||||
this.props.acquireDevice();
|
||||
} else if (item.type === 'forget') {
|
||||
this.props.forgetDevice(device);
|
||||
} else if (item.type === 'clone') {
|
||||
this.props.duplicateDevice(device);
|
||||
} else if (item.type === 'settings') {
|
||||
this.props.toggleDeviceDropdown(false);
|
||||
this.props.gotoDeviceSettings(device);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount(): void {
|
||||
window.removeEventListener('mousedown', this.mouseDownHandler, false);
|
||||
// window.removeEventListener('blur', this.blurHandler, false);
|
||||
@ -90,10 +103,6 @@ export class DeviceDropdown extends Component<Props> {
|
||||
return this.props.devices.length > 1;
|
||||
}
|
||||
|
||||
showMenuItems() {
|
||||
return this.props.wallet.selectedDevice;
|
||||
}
|
||||
|
||||
render() {
|
||||
const { devices, onSelectDevice } = this.props;
|
||||
const { transport } = this.props.connect;
|
||||
@ -128,8 +137,8 @@ export class DeviceDropdown extends Component<Props> {
|
||||
|
||||
return (
|
||||
<Wrapper>
|
||||
{/* {currentDeviceMenu} */}
|
||||
{this.showMenuItems() && <MenuItems selectedDevice={selectedDevice} />}
|
||||
{currentDeviceMenu}
|
||||
{/* {selectedDevice && selectedDevice.features && <MenuItems {...this.props} />} */}
|
||||
{this.showDivider() && <AsideDivider textLeft="Other devices" />}
|
||||
<DeviceList
|
||||
devices={devices}
|
||||
|
@ -35,8 +35,8 @@ const Divider = ({
|
||||
Divider.propTypes = {
|
||||
textLeft: PropTypes.string,
|
||||
textRight: PropTypes.string,
|
||||
borderTop: PropTypes.bool.isRequired,
|
||||
borderBottom: PropTypes.bool.isRequired,
|
||||
borderTop: PropTypes.bool,
|
||||
borderBottom: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default Divider;
|
||||
|
@ -24,6 +24,7 @@ const A = styled.a``;
|
||||
const StyledParagraph = styled(Paragraph)`
|
||||
margin: 10px 50px;
|
||||
display: block;
|
||||
text-align: center;
|
||||
`;
|
||||
|
||||
const Initialize = () => (
|
||||
|
Loading…
Reference in New Issue
Block a user