1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-13 20:08:56 +00:00

add seedless view

This commit is contained in:
Szymon Lesisz 2018-11-01 10:53:56 +01:00
parent ade65a222b
commit bdf1a1d409
5 changed files with 56 additions and 4 deletions

View File

@ -64,8 +64,8 @@ export const paramsValidation = (params: RouterLocationState): PayloadAction<boo
if (!device) return false;
if (!deviceUtils.isDeviceAccessible(device)) {
// TODO: there should be no access to deep links if device has incorrect mode/firmware
// if (params.hasOwnProperty('network') || params.hasOwnProperty('account')) return false;
// no access to deep links if device has incorrect mode/firmware
if (params.hasOwnProperty('network') || params.hasOwnProperty('account')) return false;
}
}
@ -190,6 +190,8 @@ const getDeviceUrl = (device: TrezorDevice | Device): PayloadAction<?string> =>
url = `/device/${device.path}/bootloader`;
} else if (device.mode === 'initialize') {
url = `/device/${device.features.device_id}/initialize`;
} else if (device.mode === 'seedless') {
url = `/device/${device.features.device_id}/seedless`;
} else if (device.firmware === 'required') {
url = `/device/${device.features.device_id}/firmware-update`;
} else if (typeof device.instance === 'number') {

View File

@ -47,6 +47,11 @@ export const routes: Array<Route> = [
pattern: '/device/:device/initialize',
fields: ['device', 'initialize'],
},
{
name: 'wallet-seedless',
pattern: '/device/:device/seedless',
fields: ['device', 'seedless'],
},
{
name: 'wallet-firmware-update',
pattern: '/device/:device/firmware-update',

View File

@ -21,6 +21,9 @@ export const getStatus = (device: TrezorDevice): string => {
if (device.mode === 'initialize') {
return 'initialize';
}
if (device.mode === 'seedless') {
return 'seedless';
}
if (device.firmware === 'required') {
return 'firmware-required';
}
@ -57,6 +60,8 @@ export const getStatusName = (deviceStatus: string): string => {
return 'Connected (bootloader mode)';
case 'initialize':
return 'Connected (not initialized)';
case 'seedless':
return 'Connected (seedless mode)';
case 'firmware-required':
return 'Connected (update required)';
case 'firmware-recommended':
@ -81,8 +86,8 @@ export const isDisabled = (selectedDevice: TrezorDevice, devices: Array<TrezorDe
if (devices.length < 1) return true; // no devices
if (devices.length === 1) {
if (!selectedDevice.features) return true; // unacquired, unreadable
if (selectedDevice.mode !== 'normal') return true; // bootloader, not initialized
if (selectedDevice.firmware === 'required') return true; // bootloader, not initialized
if (selectedDevice.mode !== 'normal') return true; // bootloader, not initialized, seedless
if (selectedDevice.firmware === 'required') return true;
}
return false; // default
};
@ -112,6 +117,7 @@ export const getStatusColor = (deviceStatus: string): string => {
return colors.ERROR_PRIMARY;
case 'bootloader':
case 'initialize':
case 'seedless':
case 'firmware-recommended':
case 'used-in-other-window':
case 'unacquired':

View File

@ -0,0 +1,37 @@
import styled from 'styled-components';
import { H2 } from 'components/Heading';
import Button from 'components/Button';
import Paragraph from 'components/Paragraph';
import React from 'react';
import { connect } from 'react-redux';
const Wrapper = styled.div`
display: flex;
flex: 1;
justify-content: center;
align-items: center;
`;
const Row = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
`;
const StyledParagraph = styled(Paragraph)`
margin: 10px 50px;
display: block;
text-align: center;
`;
const Seedless = () => (
<Wrapper>
<Row>
<H2>Device is in seedless mode</H2>
<StyledParagraph>It&apos;s not suitable to use this service.</StyledParagraph>
</Row>
</Wrapper>
);
export default connect(null, null)(Seedless);

View File

@ -26,6 +26,7 @@ import WalletSettings from 'views/Wallet/views/WalletSettings';
import WalletBootloader from 'views/Wallet/views/Bootloader';
import WalletFirmwareUpdate from 'views/Wallet/views/FirmwareUpdate';
import WalletInitialize from 'views/Wallet/views/Initialize';
import WalletSeedless from 'views/Wallet/views/Seedless';
import WalletAcquire from 'views/Wallet/views/Acquire';
import WalletUnreadableDevice from 'views/Wallet/views/UnreadableDevice';
@ -47,6 +48,7 @@ const App = () => (
<Route exact path={getPattern('wallet-unreadable')} component={WalletUnreadableDevice} />
<Route exact path={getPattern('wallet-bootloader')} component={WalletBootloader} />
<Route exact path={getPattern('wallet-initialize')} component={WalletInitialize} />
<Route exact path={getPattern('wallet-seedless')} component={WalletSeedless} />
<Route exact path={getPattern('wallet-firmware-update')} component={WalletFirmwareUpdate} />
<Route exact path={getPattern('wallet-device-settings')} component={WalletDeviceSettings} />
<Route exact path={getPattern('wallet-account-summary')} component={AccountSummary} />