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 React, { Component } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import Icon from 'components/Icon';
|
import Icon from 'components/Icon';
|
||||||
|
|
||||||
import icons from 'config/icons';
|
import icons from 'config/icons';
|
||||||
import colors from 'config/colors';
|
import colors from 'config/colors';
|
||||||
import { FONT_SIZE } from 'config/variables';
|
import { FONT_SIZE } from 'config/variables';
|
||||||
@ -26,25 +28,30 @@ const Label = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
class MenuItems extends Component {
|
class MenuItems extends Component {
|
||||||
onClick(action, device) {
|
// makeAction(action, device) {
|
||||||
if (action === 'reload') {
|
// switch (action) {
|
||||||
this.props.acquireDevice();
|
// case 'reload': this.props.acquireDevice();
|
||||||
} else if (action === 'forget') {
|
// break;
|
||||||
this.props.forgetDevice(device);
|
// case 'forget': this.props.forgetDevice();
|
||||||
} else if (action === 'clone') {
|
// break;
|
||||||
this.props.duplicateDevice(device);
|
// case 'clone': this.props.duplicateDevice();
|
||||||
} else if (action === 'settings') {
|
// break;
|
||||||
this.props.toggleDeviceDropdown(false);
|
// case 'settings': {
|
||||||
this.props.gotoDeviceSettings(device);
|
// this.props.toggleDeviceDropdown(false);
|
||||||
}
|
// this.props.gotoDeviceSettings(device);
|
||||||
}
|
// break;
|
||||||
|
// }
|
||||||
|
// default: console.log('no action');
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
showClone() {
|
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() {
|
showRenewSession() {
|
||||||
return this.props.selectedDevice.status !== 'available';
|
return this.props.selectedDevice && this.props.selectedDevice.status !== 'available';
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
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;
|
export default MenuItems;
|
@ -81,6 +81,19 @@ export class DeviceDropdown extends Component<Props> {
|
|||||||
if (transport && transport.version.indexOf('webusb') >= 0) TrezorConnect.renderWebUSBButton();
|
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 {
|
componentWillUnmount(): void {
|
||||||
window.removeEventListener('mousedown', this.mouseDownHandler, false);
|
window.removeEventListener('mousedown', this.mouseDownHandler, false);
|
||||||
// window.removeEventListener('blur', this.blurHandler, false);
|
// window.removeEventListener('blur', this.blurHandler, false);
|
||||||
@ -90,10 +103,6 @@ export class DeviceDropdown extends Component<Props> {
|
|||||||
return this.props.devices.length > 1;
|
return this.props.devices.length > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
showMenuItems() {
|
|
||||||
return this.props.wallet.selectedDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { devices, onSelectDevice } = this.props;
|
const { devices, onSelectDevice } = this.props;
|
||||||
const { transport } = this.props.connect;
|
const { transport } = this.props.connect;
|
||||||
@ -128,8 +137,8 @@ export class DeviceDropdown extends Component<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
{/* {currentDeviceMenu} */}
|
{currentDeviceMenu}
|
||||||
{this.showMenuItems() && <MenuItems selectedDevice={selectedDevice} />}
|
{/* {selectedDevice && selectedDevice.features && <MenuItems {...this.props} />} */}
|
||||||
{this.showDivider() && <AsideDivider textLeft="Other devices" />}
|
{this.showDivider() && <AsideDivider textLeft="Other devices" />}
|
||||||
<DeviceList
|
<DeviceList
|
||||||
devices={devices}
|
devices={devices}
|
||||||
|
@ -35,8 +35,8 @@ const Divider = ({
|
|||||||
Divider.propTypes = {
|
Divider.propTypes = {
|
||||||
textLeft: PropTypes.string,
|
textLeft: PropTypes.string,
|
||||||
textRight: PropTypes.string,
|
textRight: PropTypes.string,
|
||||||
borderTop: PropTypes.bool.isRequired,
|
borderTop: PropTypes.bool,
|
||||||
borderBottom: PropTypes.bool.isRequired,
|
borderBottom: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Divider;
|
export default Divider;
|
||||||
|
@ -24,6 +24,7 @@ const A = styled.a``;
|
|||||||
const StyledParagraph = styled(Paragraph)`
|
const StyledParagraph = styled(Paragraph)`
|
||||||
margin: 10px 50px;
|
margin: 10px 50px;
|
||||||
display: block;
|
display: block;
|
||||||
|
text-align: center;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Initialize = () => (
|
const Initialize = () => (
|
||||||
|
Loading…
Reference in New Issue
Block a user