diff --git a/src/js/config/icons.js b/src/js/config/icons.js index 629801ad..26be1430 100644 --- a/src/js/config/icons.js +++ b/src/js/config/icons.js @@ -1,6 +1,6 @@ export default { REFRESH: [ - 'M347.392 473.312c17.28-82.24 90.4-142.336 173.92-142.336 31.648 0 61.92 8.704 88.576 24.416 6.656 3.936 12.8 8.672 18.944 13.504l-68.832 68.736 192 33.056-32-198.272-38.4 42.016c-5.92-5.024-12.064-9.728-18.336-14.144-40.928-28.672-89.92-44.288-141.92-44.288-121.664 0-225.12 89.312-245.984 210.368l-3.36 20.896h72.672l2.72-13.952zM676.608 550.688c-17.28 82.24-90.4 142.336-173.92 142.336-31.648 0-61.92-8.704-88.576-24.416-6.624-3.936-12.8-8.672-18.944-13.504l68.832-68.736-192-33.056 32 198.272 38.4-42.016c5.92 5.024 12.032 9.696 18.336 14.144 40.928 28.672 89.92 44.288 141.952 44.288 121.664 0 225.12-89.312 245.984-210.368l3.328-20.864h-72.672l-2.72 13.92z', + 'M347.392 473.312c17.28-82.24 90.4-142.336 173.92-142.336 31.648 0 61.92 8.704 88.576 24.416 6.656 3.936 12.8 8.672 18.944 13.504l-68.832 68.736 192 33.056-32-198.272-38.4 42.016c-5.92-5.024-12.064-9.728-18.336-14.144-40.928-28.672-89.92-44.288-141.92-44.288-121.664 0-225.12 89.312-245.984 210.368l-3.36 20.896h72.672l2.72-13.952zM676.608 550.688c-17.28 82.24-90.4 142.336-173.92 142.336-31.648 0-61.92-8.704-88.576-24.416-6.624-3.936-12.8-8.672-18.944-13.504l68.832-68.736-192-33.056 32 198.272 38.4-42.016c5.92 5.024 12.032 9.696 18.336 14.144 40.928 28.672 89.92 44.288 141.952 44.288 121.664 0 225.12-89.312 245.984-210.368l3.328-20.864h-72.672l-2.72 13.92z', ], T1: [ 'M603.2 265.6h-6.4c-25.494-5.341-54.79-8.398-84.8-8.398s-59.305 3.058-87.592 8.879l2.792-0.48h-6.72c-30.053 5.643-52.489 31.68-52.489 62.956 0 0.367 0.003 0.733 0.009 1.099l-0.001-0.055v234.88c0.075 40.921 11.238 79.22 30.643 112.071l-0.563-1.031 35.2 60.48c11.655 19.297 32.515 32.001 56.342 32.001 0.105 0 0.209 0 0.314-0.001h44.144c0.359 0.007 0.783 0.011 1.208 0.011 23.569 0 44.162-12.74 55.269-31.709l0.164-0.302 36.16-64c18.232-31.447 29.027-69.173 29.12-109.413v-232.987c0.005-0.293 0.008-0.639 0.008-0.986 0-31.391-22.599-57.503-52.416-62.954l-0.392-0.059zM629.76 563.2c-0.193 35.364-9.792 68.446-26.418 96.923l0.498-0.923-35.84 64c-6.868 11.865-19.463 19.742-33.906 19.84h-44.174c-0.073 0-0.159 0.001-0.246 0.001-14.427 0-27.041-7.762-33.894-19.338l-0.1-0.183-34.88-59.84c-16.656-28.155-26.515-62.042-26.56-98.227v-235.853c0.133-19.025 13.742-34.833 31.751-38.359l0.249-0.041h6.72c24.050-5.126 51.682-8.062 80-8.062s55.949 2.936 82.608 8.519l-2.608-0.457h6.72c18.258 3.568 31.867 19.375 32 38.386v0.014zM422.4 353.92h179.2c3.535 0 6.4 2.865 6.4 6.4v99.2c0 3.535-2.865 6.4-6.4 6.4h-179.2c-3.535 0-6.4-2.865-6.4-6.4v-99.2c0-3.535 2.865-6.4 6.4-6.4z', diff --git a/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/MenuItems/index.js b/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/MenuItems/index.js index 63469ddb..d2d86191 100644 --- a/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/MenuItems/index.js +++ b/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/MenuItems/index.js @@ -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; \ No newline at end of file diff --git a/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/index.js b/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/index.js index 00e6968b..c3485d3f 100644 --- a/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/index.js +++ b/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/index.js @@ -81,6 +81,19 @@ export class DeviceDropdown extends Component { 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 { 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 { return ( - {/* {currentDeviceMenu} */} - {this.showMenuItems() && } + {currentDeviceMenu} + {/* {selectedDevice && selectedDevice.features && } */} {this.showDivider() && } (