Use isWebUSB function in utils

pull/8/head
Vasek Mlejnsky 6 years ago
parent a837db7a49
commit 0b1a6ce0e1

@ -80,6 +80,7 @@ const getStatusColor = (deviceStatus) => {
}; };
export { export {
isWebUSB,
getStatus, getStatus,
isDisabled, isDisabled,
getStatusName, getStatusName,

@ -11,6 +11,7 @@ import Notifications, { Notification } from 'components/Notification';
import colors from 'config/colors'; import colors from 'config/colors';
import P from 'components/Paragraph'; import P from 'components/Paragraph';
import { H2 } from 'components/Heading'; import { H2 } from 'components/Heading';
import { isWebUSB } from 'utils/device';
import BrowserNotSupported from './components/BrowserNotSupported'; import BrowserNotSupported from './components/BrowserNotSupported';
import ConnectDevice from './components/ConnectDevice'; import ConnectDevice from './components/ConnectDevice';
@ -72,7 +73,6 @@ export default (props: Props) => {
const bridgeRoute: boolean = props.router.location.state.hasOwnProperty('bridge'); const bridgeRoute: boolean = props.router.location.state.hasOwnProperty('bridge');
const deviceLabel = props.wallet.disconnectRequest ? props.wallet.disconnectRequest.label : ''; const deviceLabel = props.wallet.disconnectRequest ? props.wallet.disconnectRequest.label : '';
const hasWebUsb = transport && transport.version.indexOf('webusb') >= 0;
const shouldShowInstallBridge = connectError || bridgeRoute; const shouldShowInstallBridge = connectError || bridgeRoute;
const shouldShowConnectDevice = props.wallet.ready && devices.length < 1; const shouldShowConnectDevice = props.wallet.ready && devices.length < 1;
const shouldShowDisconnectDevice = !!props.wallet.disconnectRequest; const shouldShowDisconnectDevice = !!props.wallet.disconnectRequest;
@ -111,7 +111,7 @@ export default (props: Props) => {
<ConnectDevice <ConnectDevice
deviceLabel={deviceLabel} deviceLabel={deviceLabel}
showWebUsb={hasWebUsb} showWebUsb={isWebUSB(transport)}
showDisconnect={shouldShowDisconnectDevice} showDisconnect={shouldShowDisconnectDevice}
/> />
@ -119,7 +119,7 @@ export default (props: Props) => {
{shouldShowConnectDevice && ( {shouldShowConnectDevice && (
<LandingFooterWrapper> <LandingFooterWrapper>
{hasWebUsb && ( {isWebUSB(transport) && (
<P> <P>
<LandingFooterTextWrapper> <LandingFooterTextWrapper>
Device not recognized? Device not recognized?

Loading…
Cancel
Save