mirror of
https://github.com/trezor/trezor-wallet
synced 2025-02-08 22:22:44 +00:00
trezor-connect iframe loading error
This commit is contained in:
parent
2e4acf3ee8
commit
f59b9c31b1
23
src/views/Landing/components/InitializationError/index.js
Normal file
23
src/views/Landing/components/InitializationError/index.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/* @flow */
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { Notification } from 'components/Notification';
|
||||||
|
|
||||||
|
const Wrapper = styled.div`
|
||||||
|
min-width: 720px;
|
||||||
|
width: 100%;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const InitializationError = (props: { error: ?string }) => (
|
||||||
|
<Wrapper>
|
||||||
|
<Notification
|
||||||
|
title="Initialization error"
|
||||||
|
message={props.error || ''}
|
||||||
|
type="error"
|
||||||
|
cancelable={false}
|
||||||
|
/>
|
||||||
|
</Wrapper>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default InitializationError;
|
@ -14,6 +14,7 @@ import { H2 } from 'components/Heading';
|
|||||||
import { isWebUSB } from 'utils/device';
|
import { isWebUSB } from 'utils/device';
|
||||||
import { FONT_SIZE } from 'config/variables';
|
import { FONT_SIZE } from 'config/variables';
|
||||||
|
|
||||||
|
import InitializationError from './components/InitializationError';
|
||||||
import BrowserNotSupported from './components/BrowserNotSupported';
|
import BrowserNotSupported from './components/BrowserNotSupported';
|
||||||
import ConnectDevice from './components/ConnectDevice';
|
import ConnectDevice from './components/ConnectDevice';
|
||||||
import InstallBridge from './components/InstallBridge';
|
import InstallBridge from './components/InstallBridge';
|
||||||
@ -77,13 +78,13 @@ 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 shouldShowInstallBridge = connectError || bridgeRoute;
|
const shouldShowInitializationError = connectError && !props.connect.initialized;
|
||||||
|
const shouldShowInstallBridge = props.connect.initialized && (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;
|
||||||
const shouldShowUnsupportedBrowser = browserState.supported === false;
|
const shouldShowUnsupportedBrowser = browserState.supported === false;
|
||||||
|
|
||||||
const isLoading = !shouldShowInstallBridge && !shouldShowConnectDevice && !shouldShowUnsupportedBrowser && !localStorageError;
|
const isLoading = !shouldShowInitializationError && !shouldShowInstallBridge && !shouldShowConnectDevice && !shouldShowUnsupportedBrowser && !localStorageError;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LandingWrapper>
|
<LandingWrapper>
|
||||||
{isLoading && <LandingLoader text="Loading" size={100} />}
|
{isLoading && <LandingLoader text="Loading" size={100} />}
|
||||||
@ -98,10 +99,9 @@ export default (props: Props) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Notifications />
|
<Notifications />
|
||||||
|
{shouldShowInitializationError && <InitializationError error={connectError} />}
|
||||||
<Log />
|
<Log />
|
||||||
|
|
||||||
<LandingContent>
|
<LandingContent>
|
||||||
|
|
||||||
{shouldShowUnsupportedBrowser && <BrowserNotSupported />}
|
{shouldShowUnsupportedBrowser && <BrowserNotSupported />}
|
||||||
{shouldShowInstallBridge && <InstallBridge browserState={browserState} />}
|
{shouldShowInstallBridge && <InstallBridge browserState={browserState} />}
|
||||||
|
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
/* @flow */
|
/* @flow */
|
||||||
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { bindActionCreators } from 'redux';
|
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Notification } from 'components/Notification';
|
import { Notification } from 'components/Notification';
|
||||||
import * as TrezorConnectActions from 'actions/TrezorConnectActions';
|
|
||||||
|
|
||||||
import type { State, Dispatch } from 'flowtype';
|
|
||||||
|
|
||||||
const Wrapper = styled.div``;
|
const Wrapper = styled.div``;
|
||||||
|
|
||||||
@ -23,4 +17,4 @@ const UnreadableDevice = () => (
|
|||||||
</Wrapper>
|
</Wrapper>
|
||||||
);
|
);
|
||||||
|
|
||||||
export default connect(null, null)(UnreadableDevice);
|
export default UnreadableDevice;
|
||||||
|
Loading…
Reference in New Issue
Block a user