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

Use utils for trezor model

This commit is contained in:
Vladimir Volek 2019-02-20 12:17:28 +01:00
parent e9d3f3ff92
commit 8e4dd7c471
3 changed files with 6 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import * as TOKEN from 'actions/constants/token';
import * as PENDING from 'actions/constants/pendingTx';
import * as reducerUtils from 'reducers/utils';
import { getVersion } from 'utils/device';
import { initialState } from 'reducers/SelectedAccountReducer';
import type {
@ -51,12 +52,11 @@ const getExceptionPage = (state: State, selectedAccount: SelectedAccountState):
shortcut: 'not-used',
};
}
if (discovery.fwNotSupported) {
const trezorModel = device.features.model;
const trezorName = trezorModel.toString() === '1' ? 'One' : trezorModel;
return {
type: 'fwNotSupported',
title: `${network.name} is not supported with Trezor ${trezorName}`,
title: `${network.name} is not supported with Trezor ${getVersion(device)}`,
message: 'Find more information on Trezor Wiki.',
shortcut: network.shortcut,
};

View File

@ -16,7 +16,8 @@ const Img = styled.img`
const TrezorImage = ({ model }: Props) => {
// $FlowIssue: `require` must be a string literal.
const src = require(`./images/trezor-${model}.png`); // eslint-disable-line
const imageName = model === 'One' ? 1 : model;
const src = require(`./images/trezor-${imageName}.png`); // eslint-disable-line
return (
<Wrapper>
<Img model={model} src={src} />

View File

@ -104,7 +104,7 @@ export const getVersion = (device: TrezorDevice): string => {
if (device.features && device.features.major_version > 1) {
version = 'T';
} else {
version = '1';
version = 'One';
}
return version;
};