diff --git a/src/js/views/Landing/index.js b/src/js/views/Landing/index.js index 2b09328d..34909851 100644 --- a/src/js/views/Landing/index.js +++ b/src/js/views/Landing/index.js @@ -1,81 +1,157 @@ /* @flow */ import React from 'react'; -import { H2 } from 'components/Heading'; +import styled from 'styled-components'; import Header from 'components/Header'; import Footer from 'components/Footer'; import Log from 'components/Log'; +import Link from 'components/Link'; +import Loader from 'components/LoaderCircle'; import Notifications, { Notification } from 'components/Notification'; +import colors from 'config/colors'; +import P from 'components/Paragraph'; +import { H2 } from 'components/Heading'; -import Preloader from './components/Preloader'; +import BrowserNotSupported from './components/BrowserNotSupported'; import ConnectDevice from './components/ConnectDevice'; import InstallBridge from './components/InstallBridge'; -import LocalStorageError from './components/LocalStorageError'; -import TrezorConnectError from './components/TrezorConnectError'; - -import type { Props } from './index'; - -const BrowserNotSupported = (props: {}): React$Element => ( -
-

Your browser is not supported

-

Please choose one of the supported browsers

-
-
-

Google Chrome

- Get Chrome -
-
-

Mozilla Firefox

- Get Firefox -
-
-
-); +import type { Props } from './Container'; + +const LandingWrapper = styled.div` + min-height: 100vh; + min-width: 720px; + + display: flex; + flex-direction: column; + align-items: center; + + text-align: center; + background: ${colors.LANDING}; +`; + +const LandingContent = styled.div` + flex: 1; + display: flex; + align-items: center; + justify-content: center; +`; + +const LandingImage = styled.div` + width: 777px; + min-height: 500px; + margin: auto; + background-image: url('../images/case.png'); + background-repeat: no-repeat; + background-position: center 0px; + background-size: contain; +`; + +const TitleWrapper = styled.div` + margin-top: 60px; +`; + +const LandingFooterWrapper = styled.div` + margin-bottom: 32px; +`; + +const LandingFooterTextWrapper = styled.span` + margin-right: 4px; +`; + +const LandingLoader = styled(Loader)` + margin: auto; +`; export default (props: Props) => { - const { web3 } = props; const { devices } = props; const { browserState, transport } = props.connect; const localStorageError = props.localStorage.error; const connectError = props.connect.error; - let notification = null; - let body = null; - let css: string = 'app landing'; const bridgeRoute: boolean = props.router.location.state.hasOwnProperty('bridge'); + const deviceLabel = props.wallet.disconnectRequest ? props.wallet.disconnectRequest.label : ''; + + const hasWebUsb = transport && transport.version.indexOf('webusb') >= 0; + const shouldShowInstallBridge = connectError || bridgeRoute; + const shouldShowConnectDevice = props.wallet.ready && devices.length < 1; + const shouldShowDisconnectDevice = !!props.wallet.disconnectRequest; + const shouldShowUnsupportedBrowser = browserState.supported === false; + + const isLoading = !shouldShowInstallBridge && !shouldShowConnectDevice && !shouldShowUnsupportedBrowser && !localStorageError; + + return ( + + {isLoading && } + {!isLoading && ( + +
+ {localStorageError && ( + + )} + + + + + + {shouldShowUnsupportedBrowser && } + {shouldShowInstallBridge && } + + {(shouldShowConnectDevice || shouldShowDisconnectDevice) && ( +
+ +

The private bank in your hands.

+

TREZOR Wallet is an easy-to-use interface for your TREZOR.

+

TREZOR Wallet allows you to easily control your funds, manage your balance and initiate transfers.

+
+ + + + + + {shouldShowConnectDevice && ( + + {hasWebUsb && ( +

+ + Device not recognized? + + +

+ )} +

+ + Don't have TREZOR? + + +

+
+ )} +
+ )} +
- if (localStorageError) { - notification = ( - - ); - css += ' config-error'; - } else if (browserState.supported === false) { - css += ' browser-not-supported'; - body = ; - } else if (connectError || bridgeRoute) { - css += ' install-bridge'; - body = ; - } else if (props.wallet.ready && devices.length < 1) { - css += ' connect-device'; - body = ; - } - - if (notification || body) { - return ( -
-
- { notification } - - - { body } -
-
- ); - } - return (); +