import React, { PureComponent } from 'react'; import styled from 'styled-components'; import PropTypes from 'prop-types'; import Icon from 'components/Icon'; import Link from 'components/Link'; import DeviceIcon from 'components/images/DeviceIcon'; import { FormattedMessage } from 'react-intl'; import { getPattern } from 'support/routes'; import icons from 'config/icons'; import colors from 'config/colors'; import { FONT_SIZE } from 'config/variables'; import l10nCommonMessages from 'views/common.messages'; import l10nMessages from './index.messages'; const Wrapper = styled.div` background: ${colors.WHITE}; `; const Item = styled.div` padding: 6px 24px; display: flex; align-items: center; font-size: ${FONT_SIZE.BASE}; cursor: pointer; color: ${colors.TEXT_SECONDARY}; &:hover { background: ${colors.GRAY_LIGHT}; } `; const Divider = styled.div` width: 100%; height: 1px; background: ${colors.DIVIDER}; `; const Label = styled.div` padding-left: 15px; `; class MenuItems extends PureComponent { showDeviceMenu() { const { device } = this.props; return device && device.mode === 'normal'; } showClone() { return ( this.props.device && this.props.device.features.passphrase_protection && this.props.device.connected && this.props.device.available ); } showRenewSession() { return this.props.device && this.props.device.status !== 'available'; } render() { if (!this.showDeviceMenu()) return null; const { device } = this.props; return ( {/* { this.props.toggleDeviceDropdown(false); this.props.gotoDeviceSettings(device); }} > */} {this.showClone() && ( this.props.duplicateDevice(device)}> )} {this.showRenewSession() && ( this.props.acquireDevice()}> )} this.props.forgetDevice(device)}> ); } } MenuItems.propTypes = { device: 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;