|
|
|
@ -6,7 +6,7 @@ import { FormattedMessage } from 'react-intl';
|
|
|
|
|
|
|
|
|
|
import COLORS from 'config/colors';
|
|
|
|
|
import { FONT_SIZE, FONT_WEIGHT } from 'config/variables';
|
|
|
|
|
import { SLIDE_DOWN } from 'config/animations';
|
|
|
|
|
import { SLIDE_DOWN, FADE_IN } from 'config/animations';
|
|
|
|
|
|
|
|
|
|
import Button from 'components/Button';
|
|
|
|
|
import * as deviceUtils from 'utils/device';
|
|
|
|
@ -29,6 +29,14 @@ const Wrapper = styled.div`
|
|
|
|
|
animation: ${SLIDE_DOWN} 0.25s cubic-bezier(0.17, 0.04, 0.03, 0.94) forwards;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const Overlay = styled.div`
|
|
|
|
|
position: absolute;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
background: rgba(0, 0, 0, 0.1);
|
|
|
|
|
animation: ${FADE_IN} 0.25s;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const ButtonWrapper = styled.div`
|
|
|
|
|
margin: 10px 0;
|
|
|
|
|
padding: 0 10px;
|
|
|
|
@ -115,28 +123,35 @@ class DeviceMenu extends PureComponent<Props> {
|
|
|
|
|
myRef: { current: ?HTMLDivElement };
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
|
const { devices, onSelectDevice, forgetDevice } = this.props;
|
|
|
|
|
const { devices, onSelectDevice, forgetDevice, toggleDeviceDropdown } = this.props;
|
|
|
|
|
const { transport } = this.props.connect;
|
|
|
|
|
const { selectedDevice } = this.props.wallet;
|
|
|
|
|
const { selectedDevice, dropdownOpened } = this.props.wallet;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Wrapper ref={this.myRef}>
|
|
|
|
|
{this.showMenuItems() && <MenuItems device={selectedDevice} {...this.props} />}
|
|
|
|
|
{this.showDivider() && <StyledDivider hasBorder textLeft="Other devices" />}
|
|
|
|
|
<DeviceList
|
|
|
|
|
devices={devices}
|
|
|
|
|
selectedDevice={selectedDevice}
|
|
|
|
|
onSelectDevice={onSelectDevice}
|
|
|
|
|
forgetDevice={forgetDevice}
|
|
|
|
|
<>
|
|
|
|
|
<Wrapper ref={this.myRef}>
|
|
|
|
|
{this.showMenuItems() && <MenuItems device={selectedDevice} {...this.props} />}
|
|
|
|
|
{this.showDivider() && <StyledDivider hasBorder textLeft="Other devices" />}
|
|
|
|
|
<DeviceList
|
|
|
|
|
devices={devices}
|
|
|
|
|
selectedDevice={selectedDevice}
|
|
|
|
|
onSelectDevice={onSelectDevice}
|
|
|
|
|
forgetDevice={forgetDevice}
|
|
|
|
|
/>
|
|
|
|
|
{deviceUtils.isWebUSB(transport) && (
|
|
|
|
|
<ButtonWrapper>
|
|
|
|
|
<StyledButton isWebUsb>
|
|
|
|
|
<FormattedMessage {...l10nCommonMessages.TR_CHECK_FOR_DEVICES} />
|
|
|
|
|
</StyledButton>
|
|
|
|
|
</ButtonWrapper>
|
|
|
|
|
)}
|
|
|
|
|
</Wrapper>
|
|
|
|
|
<Overlay
|
|
|
|
|
onClick={() => {
|
|
|
|
|
toggleDeviceDropdown(!dropdownOpened);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
{deviceUtils.isWebUSB(transport) && (
|
|
|
|
|
<ButtonWrapper>
|
|
|
|
|
<StyledButton isWebUsb>
|
|
|
|
|
<FormattedMessage {...l10nCommonMessages.TR_CHECK_FOR_DEVICES} />
|
|
|
|
|
</StyledButton>
|
|
|
|
|
</ButtonWrapper>
|
|
|
|
|
)}
|
|
|
|
|
</Wrapper>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|