From ab4ecbebd7ca511dec43523cb268b095859cb693 Mon Sep 17 00:00:00 2001 From: Vladimir Volek Date: Mon, 27 Aug 2018 14:56:40 +0200 Subject: [PATCH] Added MenuItems comnponent --- .../DeviceMenu/components/MenuItems/index.js | 31 +++++++++++ .../DeviceMenu/components/Submenu/index.js | 55 ------------------- 2 files changed, 31 insertions(+), 55 deletions(-) create mode 100644 src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/MenuItems/index.js delete mode 100644 src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/Submenu/index.js 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 new file mode 100644 index 00000000..5f5d5d72 --- /dev/null +++ b/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/MenuItems/index.js @@ -0,0 +1,31 @@ +import React, { Component } from 'react'; +import styled from 'styled-components'; +import Icon from 'components/Icon'; +import icons from 'config/icons'; +import colors from 'config/colors'; + +const Wrapper = styled.div``; +const Item = styled.div``; + +class MenuItems extends Component { + showClone() { + return this.props.selectedDevice.features.passphrase_protection && this.props.selectedDevice.connected && this.props.selectedDevice.available; + } + + showRenewSession() { + return this.props.selectedDevice.status; + } + + render() { + return ( + + Device settings + Forget + {this.showClone() && Create hidden wallet} + {this.showRenewSession() && Renew session} + + ); + } +} + +export default MenuItems; \ No newline at end of file diff --git a/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/Submenu/index.js b/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/Submenu/index.js deleted file mode 100644 index 2f4f48cc..00000000 --- a/src/js/views/Wallet/components/LeftNavigation/components/DeviceMenu/components/Submenu/index.js +++ /dev/null @@ -1,55 +0,0 @@ -import React, { Component } from 'react'; -import styled from 'styled-components'; -import Icon from 'components/Icon'; -import DeviceHeader from 'components/DeviceHeader'; -import icons from 'config/icons'; -import colors from 'config/colors'; - -const Wrapper = styled.div``; -const IconClick = styled.div``; - -class DeviceList extends Component { - sortByInstance(a, b) { - if (!a.instance || !b.instance) return -1; - return a.instance > b.instance ? 1 : -1; - } - - render() { - const { devices, selectedDevice, onSelectDevice } = this.props; - return ( - - {devices - .sort(this.sortByInstance) - .map(device => ( - device !== selectedDevice && ( - this.props.onSelectDevice(device)} - onClickIcon={() => this.onDeviceMenuClick({ type: 'forget', label: '' }, device)} - icon={( - { - event.stopPropagation(); - event.preventDefault(); - this.onDeviceMenuClick({ type: 'forget', label: '' }, device); - }} - > - - - )} - device={device} - devices={devices} - isHoverable - /> - ) - ))} - - - ); - } -} - -export default DeviceList; \ No newline at end of file