From 28af74f65b22795582452fff187afda12fe0adae Mon Sep 17 00:00:00 2001 From: NastiaS Date: Tue, 15 May 2018 09:42:02 +0200 Subject: [PATCH] wip --- src/components/GlobalSearch.js | 30 ++++++++++++---------- src/components/TopBar.js | 2 +- src/components/modals/SettingsAccount.js | 32 ++++++++++++++++++++---- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/components/GlobalSearch.js b/src/components/GlobalSearch.js index a0ddf36d..1b16208a 100644 --- a/src/components/GlobalSearch.js +++ b/src/components/GlobalSearch.js @@ -1,6 +1,6 @@ // @flow -import React, { PureComponent } from 'react' +import React, { PureComponent, Fragment } from 'react' import styled from 'styled-components' import type { T } from 'types/common' @@ -29,6 +29,7 @@ type State = { type Props = { t: T, + isHidden: boolean, } class GlobalSearch extends PureComponent { @@ -55,21 +56,24 @@ class GlobalSearch extends PureComponent { }) render() { - const { t } = this.props + const { t, isHidden } = this.props const { isFocused } = this.state - return ( - - - - (this._input = input)} - onBlur={this.handleBlur} - onFocus={this.handleFocus} - isFocused={isFocused} - /> + {!isHidden && ( + + + + + (this._input = input)} + onBlur={this.handleBlur} + onFocus={this.handleFocus} + isFocused={isFocused} + /> + + )} ) } diff --git a/src/components/TopBar.js b/src/components/TopBar.js index 836e62e5..59102ee9 100644 --- a/src/components/TopBar.js +++ b/src/components/TopBar.js @@ -152,7 +152,7 @@ class TopBar extends PureComponent { - + diff --git a/src/components/modals/SettingsAccount.js b/src/components/modals/SettingsAccount.js index e5abc368..70250910 100644 --- a/src/components/modals/SettingsAccount.js +++ b/src/components/modals/SettingsAccount.js @@ -4,7 +4,7 @@ import React, { PureComponent } from 'react' import { connect } from 'react-redux' import get from 'lodash/get' import { push } from 'react-router-redux' -import type { Account } from '@ledgerhq/live-common/lib/types' +import type { Account, Unit } from '@ledgerhq/live-common/lib/types' import { MODAL_SETTINGS_ACCOUNT } from 'config/constants' @@ -14,6 +14,7 @@ import { setDataModal, closeModal } from 'reducers/modals' import Box from 'components/base/Box' import Button from 'components/base/Button' import Input from 'components/base/Input' +import Select from 'components/base/Select/index' import Modal, { ModalBody, ModalTitle, ModalFooter, ModalContent } from 'components/base/Modal' import Label from 'components/base/Label' @@ -24,6 +25,7 @@ type State = { minConfirmations: number | null, editName: boolean, nameHovered: boolean, + editUnit: boolean, } type Props = { @@ -47,6 +49,7 @@ const defaultState = { accountName: null, minConfirmations: null, nameHovered: false, + editUnit: false, } function hasNoOperations(account: Account) { @@ -62,7 +65,6 @@ class SettingsAccount extends PureComponent { const { accountName, minConfirmations } = this.state const account = get(data, 'account', {}) - return { ...account, ...(accountName !== null @@ -146,8 +148,15 @@ class SettingsAccount extends PureComponent { ...defaultState, }) + handleChangeUnit = (value: Unit, account: Account) => { + const { updateAccount, setDataModal } = this.props + account = { ...account, unit: value } + updateAccount(account) + setDataModal(MODAL_SETTINGS_ACCOUNT, { account }) + } + render() { - const { editName, nameHovered } = this.state + const { editName, nameHovered, editUnit } = this.state return ( { onHide={this.handleHide} render={({ data, onClose }) => { const account = this.getAccount(data) - return ( {'Account settings'} @@ -205,12 +213,26 @@ class SettingsAccount extends PureComponent { onChange={this.handleChangeMinConfirmations(account)} /> + {editUnit && ( + + +