1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-11-24 01:08:27 +00:00

Aside: implementation of wallet.selectedDevice

This commit is contained in:
Szymon Lesisz 2018-05-22 19:43:26 +02:00
parent 1e66618186
commit 663729ea62
4 changed files with 8 additions and 9 deletions

View File

@ -6,7 +6,6 @@ import { Link, NavLink } from 'react-router-dom';
import BigNumber from 'bignumber.js';
import { findDeviceAccounts } from '~/js/reducers/AccountsReducer';
import { findSelectedDevice } from '~/js/reducers/TrezorConnectReducer';
import Loader from '~/js/components/common/LoaderCircle';
import Tooltip from 'rc-tooltip';
@ -15,7 +14,7 @@ import type { TrezorDevice, Accounts } from '~/flowtype';
const AccountSelection = (props: Props): ?React$Element<string> => {
const selected = findSelectedDevice(props.connect);
const selected = props.wallet.selectedDevice;
if (!selected) return null;
const { location } = props.router;

View File

@ -10,7 +10,6 @@ import { DeviceSelect, DeviceDropdown } from './DeviceSelection';
import AccountSelection from './AccountSelection';
import CoinSelection from './CoinSelection';
import StickyContainer from './StickyContainer';
import { findSelectedDevice } from '~/js/reducers/TrezorConnectReducer';
import type { Props } from './index';
import type { TrezorDevice } from '~/flowtype';
@ -41,7 +40,7 @@ const TransitionMenu = (props: TransitionMenuProps): React$Element<TransitionGro
const Aside = (props: Props): React$Element<typeof StickyContainer | string> => {
const selected: ?TrezorDevice = findSelectedDevice(props.connect);
const selected: ?TrezorDevice = props.wallet.selectedDevice;
const { location } = props.router;
if (location.pathname === '/' || !selected) return (<aside></aside>);

View File

@ -5,8 +5,6 @@ import React, { Component } from 'react';
import Select from 'react-select';
import TrezorConnect from 'trezor-connect';
import { findSelectedDevice } from '~/js/reducers/TrezorConnectReducer';
import type { Props } from './index';
import type { TrezorDevice } from '~/flowtype';
@ -14,7 +12,7 @@ export const DeviceSelect = (props: Props) => {
const { devices, transport } = props.connect;
const selected: ?TrezorDevice = findSelectedDevice(props.connect);
const selected: ?TrezorDevice = props.wallet.selectedDevice;
if (!selected) return null;
let deviceStatus: string = "Connected";
@ -139,7 +137,7 @@ export class DeviceDropdown extends Component<Props> {
render() {
const { devices, transport } = this.props.connect;
const selected: ?TrezorDevice = findSelectedDevice(this.props.connect);
const selected: ?TrezorDevice = this.props.wallet.selectedDevice;
if (!selected) return;
let webUsbButton = null;
@ -179,6 +177,7 @@ export class DeviceDropdown extends Component<Props> {
}
const deviceList = devices.map((dev, index) => {
console.warn("DEVEEE", dev, selected, dev === selected);
if (dev === selected) return null;
let deviceStatus: string = "Connected";

View File

@ -26,6 +26,7 @@ type StateProps = {
fiat: $ElementType<State, 'fiat'>,
localStorage: $ElementType<State, 'localStorage'>,
discovery: $ElementType<State, 'discovery'>,
wallet: $ElementType<State, 'wallet'>,
}
type DispatchProps = {
@ -48,7 +49,8 @@ const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: St
deviceDropdownOpened: state.wallet.dropdownOpened,
fiat: state.fiat,
localStorage: state.localStorage,
discovery: state.discovery
discovery: state.discovery,
wallet: state.wallet
};
}