From d78381106ed44836a3e7388e493b8d94314cd070 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 9 Oct 2018 15:36:55 +0200 Subject: [PATCH] Filter log --- .eslintrc | 1 + src/actions/LogActions.js | 2 -- src/actions/TrezorConnectActions.js | 4 +-- src/components/Footer/index.js | 15 +++++++--- src/components/Log/index.js | 6 ++-- src/flowtype/index.js | 3 ++ src/reducers/LogReducer.js | 2 -- src/services/LogService.js | 45 ++++++++++++++++------------- 8 files changed, 44 insertions(+), 34 deletions(-) diff --git a/.eslintrc b/.eslintrc index 9f709b13..4076a433 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,6 +5,7 @@ "plugin:jest/recommended" ], "globals": { + "LOCAL": true, "COMMITHASH": true }, "env": { diff --git a/src/actions/LogActions.js b/src/actions/LogActions.js index c841cd1e..5e1bf6a7 100644 --- a/src/actions/LogActions.js +++ b/src/actions/LogActions.js @@ -1,6 +1,5 @@ /* @flow */ - import * as LOG from 'actions/constants/log'; import type { @@ -31,7 +30,6 @@ export const toggle = (): ThunkAction => (dispatch: Dispatch, getState: GetState } }; -// export const add = (type: string, message: string): Action => { export const add = (type: string, message: any): Action => ({ type: LOG.ADD, payload: { diff --git a/src/actions/TrezorConnectActions.js b/src/actions/TrezorConnectActions.js index 40a3ea8c..d685f954 100644 --- a/src/actions/TrezorConnectActions.js +++ b/src/actions/TrezorConnectActions.js @@ -120,9 +120,7 @@ export const init = (): AsyncAction => async (dispatch: Dispatch, getState: GetS }); }); - /* global LOCAL */ - // $FlowIssue LOCAL not declared - window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://sisyfos.trezor.io/connect/'; // eslint-disable-line no-underscore-dangle + window.__TREZOR_CONNECT_SRC = typeof window.LOCAL === 'string' ? window.LOCAL : 'https://sisyfos.trezor.io/connect/'; // eslint-disable-line no-underscore-dangle // window.__TREZOR_CONNECT_SRC = typeof LOCAL === 'string' ? LOCAL : 'https://connect.trezor.io/5/'; // eslint-disable-line no-underscore-dangle try { diff --git a/src/components/Footer/index.js b/src/components/Footer/index.js index 2b988cba..0c443223 100644 --- a/src/components/Footer/index.js +++ b/src/components/Footer/index.js @@ -1,3 +1,5 @@ +/* @flow */ + import styled from 'styled-components'; import PropTypes from 'prop-types'; import React from 'react'; @@ -28,21 +30,26 @@ const Copy = styled.div` margin-right: 20px; `; -const Footer = ({ toggle }) => ( +const Footer = ({ opened, toggle }) => ( - © {getYear(new Date())} + © {getYear(new Date())} SatoshiLabs Terms - Show Log + { opened ? 'Hide Log' : 'Show Log' } ); Footer.propTypes = { + opened: PropTypes.bool.isRequired, toggle: PropTypes.func.isRequired, }; +const mapStateToProps = state => ({ + opened: state.log.opened, +}); + const mapDispatchToProps = dispatch => ({ toggle: bindActionCreators(LogActions.toggle, dispatch), }); -export default connect(null, mapDispatchToProps)(Footer); +export default connect(mapStateToProps, mapDispatchToProps)(Footer); diff --git a/src/components/Log/index.js b/src/components/Log/index.js index 63db62fa..c77ad073 100644 --- a/src/components/Log/index.js +++ b/src/components/Log/index.js @@ -6,7 +6,7 @@ import { connect } from 'react-redux'; import colors from 'config/colors'; import { H2 } from 'components/Heading'; import Icon from 'components/Icon'; -import Paragraph from 'components/Paragraph'; +import P from 'components/Paragraph'; import * as LogActions from 'actions/LogActions'; import icons from 'config/icons'; @@ -55,7 +55,7 @@ const Textarea = styled.textarea` } `; -const StyledParagraph = styled(Paragraph)` +const StyledParagraph = styled(P)` margin: 10px 0; `; @@ -67,7 +67,7 @@ const Log = (props: Props): ?React$Element => {

Log

- Attention: The log contains your XPUBs. Anyone with your XPUBs can see your account history. + Attention: The log contains your XPUBs. Anyone with your XPUBs can see your account history.