mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-28 03:08:30 +00:00
Removed logger, fixed deviceHeader props
This commit is contained in:
parent
c0e81f8859
commit
9bc266c4fb
@ -162,15 +162,15 @@ class DeviceHeader extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DeviceHeader.propTypes = {
|
DeviceHeader.propTypes = {
|
||||||
deviceCount: PropTypes.number,
|
device: PropTypes.object,
|
||||||
|
devices: PropTypes.array,
|
||||||
|
transport: PropTypes.object,
|
||||||
|
icon: PropTypes.element,
|
||||||
|
isHoverable: PropTypes.bool,
|
||||||
disabled: PropTypes.bool,
|
disabled: PropTypes.bool,
|
||||||
isOpen: PropTypes.bool,
|
isOpen: PropTypes.bool,
|
||||||
trezorModel: PropTypes.string.isRequired,
|
|
||||||
onClickWrapper: PropTypes.func.isRequired,
|
onClickWrapper: PropTypes.func.isRequired,
|
||||||
status: PropTypes.string.isRequired,
|
|
||||||
label: PropTypes.string.isRequired,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default DeviceHeader;
|
export default DeviceHeader;
|
||||||
|
@ -39,19 +39,8 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
return pass.length === 0;
|
return pass.length === 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const logger = createLogger({
|
|
||||||
level: 'info',
|
|
||||||
predicate: excludeLogger,
|
|
||||||
collapsed: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const devToolsExtension: ?Function = window.devToolsExtension;
|
|
||||||
if (typeof devToolsExtension === 'function') {
|
|
||||||
enhancers.push(devToolsExtension());
|
|
||||||
}
|
|
||||||
|
|
||||||
composedEnhancers = compose(
|
composedEnhancers = compose(
|
||||||
applyMiddleware(...middleware, logger, ...services),
|
applyMiddleware(...middleware, ...services),
|
||||||
...enhancers,
|
...enhancers,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
import React, { Component } from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import Icon from 'components/Icon';
|
||||||
|
import DeviceHeader from 'components/DeviceHeader';
|
||||||
|
import icons from 'config/icons';
|
||||||
|
import colors from 'config/colors';
|
||||||
|
|
||||||
|
const Wrapper = styled.div``;
|
||||||
|
const IconClick = styled.div``;
|
||||||
|
|
||||||
|
class DeviceList extends Component {
|
||||||
|
sortByInstance(a, b) {
|
||||||
|
if (!a.instance || !b.instance) return -1;
|
||||||
|
return a.instance > b.instance ? 1 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { devices, selectedDevice, onSelectDevice } = this.props;
|
||||||
|
return (
|
||||||
|
<Wrapper>
|
||||||
|
{devices
|
||||||
|
.sort(this.sortByInstance)
|
||||||
|
.map(device => (
|
||||||
|
device !== selectedDevice && (
|
||||||
|
<DeviceHeader
|
||||||
|
key={`${device.instanceLabel}`}
|
||||||
|
onClickWrapper={() => this.props.onSelectDevice(device)}
|
||||||
|
onClickIcon={() => this.onDeviceMenuClick({ type: 'forget', label: '' }, device)}
|
||||||
|
icon={(
|
||||||
|
<IconClick onClick={(event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
event.preventDefault();
|
||||||
|
this.onDeviceMenuClick({ type: 'forget', label: '' }, device);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Icon
|
||||||
|
icon={icons.EJECT}
|
||||||
|
size={25}
|
||||||
|
color={colors.TEXT_SECONDARY}
|
||||||
|
/>
|
||||||
|
</IconClick>
|
||||||
|
)}
|
||||||
|
device={device}
|
||||||
|
devices={devices}
|
||||||
|
isHoverable
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
))}
|
||||||
|
|
||||||
|
</Wrapper>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DeviceList;
|
@ -24,7 +24,7 @@ export const DeviceSelect = (props: Props) => {
|
|||||||
onClickWrapper={handleOpen}
|
onClickWrapper={handleOpen}
|
||||||
device={props.wallet.selectedDevice}
|
device={props.wallet.selectedDevice}
|
||||||
transport={props.connect.transport}
|
transport={props.connect.transport}
|
||||||
devices={props.devices.length}
|
devices={props.devices}
|
||||||
isOpen={props.deviceDropdownOpened}
|
isOpen={props.deviceDropdownOpened}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -101,6 +101,10 @@ export class DeviceDropdown extends Component<Props> {
|
|||||||
return this.props.devices.length > 1;
|
return this.props.devices.length > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getMenu() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { devices, onSelectDevice } = this.props;
|
const { devices, onSelectDevice } = this.props;
|
||||||
const { transport } = this.props.connect;
|
const { transport } = this.props.connect;
|
||||||
|
@ -33,6 +33,7 @@ const DeviceSettings = () => (
|
|||||||
<Section>
|
<Section>
|
||||||
<Row>
|
<Row>
|
||||||
<Icon
|
<Icon
|
||||||
|
size={60}
|
||||||
color={colors.WARNING_PRIMARY}
|
color={colors.WARNING_PRIMARY}
|
||||||
icon={ICONS.WARNING}
|
icon={ICONS.WARNING}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user