From 929d7e7d339c5c586879cf0f46b42d060cec844e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 20 Jun 2018 16:17:12 +0200 Subject: [PATCH 1/7] pixel push OperationDetails --- src/components/GradientBox.js | 14 ++ src/components/base/Ellipsis.js | 4 +- src/components/modals/OperationDetails.js | 240 +++++++++++++--------- src/components/modals/ReleaseNotes.js | 14 +- static/i18n/en/app.yml | 3 +- 5 files changed, 158 insertions(+), 117 deletions(-) create mode 100644 src/components/GradientBox.js diff --git a/src/components/GradientBox.js b/src/components/GradientBox.js new file mode 100644 index 00000000..dc637006 --- /dev/null +++ b/src/components/GradientBox.js @@ -0,0 +1,14 @@ +// @flow +import styled from 'styled-components' + +export default styled.div` + width: 100%; + height: 60px; + position: absolute; + bottom: 68px; + left: 0; + right: 0; + background: linear-gradient(rgba(255, 255, 255, 0), #ffffff 70%); + z-index: 2; + pointer-events: none; +` diff --git a/src/components/base/Ellipsis.js b/src/components/base/Ellipsis.js index d811d5ab..7f105dab 100644 --- a/src/components/base/Ellipsis.js +++ b/src/components/base/Ellipsis.js @@ -7,10 +7,10 @@ import Text from 'components/base/Text' const outerStyle = { width: 0 } const innerStyle = { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } -export default ({ children, ...p }: { children: any }) => ( +export default ({ children, canSelect, ...p }: { children: any, canSelect: * }) => ( - {children} + {children} ) diff --git a/src/components/modals/OperationDetails.js b/src/components/modals/OperationDetails.js index 9e665e08..ff48caa4 100644 --- a/src/components/modals/OperationDetails.js +++ b/src/components/modals/OperationDetails.js @@ -1,7 +1,6 @@ // @flow -import React, { Fragment } from 'react' -import uniq from 'lodash/uniq' +import React, { Fragment, Component } from 'react' import { connect } from 'react-redux' import { shell } from 'electron' import { translate } from 'react-i18next' @@ -17,16 +16,19 @@ import { MODAL_OPERATION_DETAILS } from 'config/constants' import { getMarketColor } from 'styles/helpers' import Box from 'components/base/Box' -import Spoiler from 'components/base/Spoiler' +import GradientBox from 'components/GradientBox' +import GrowScroll from 'components/base/GrowScroll' import Button from 'components/base/Button' import Bar from 'components/base/Bar' import FormattedVal from 'components/base/FormattedVal' import Modal, { ModalBody, ModalTitle, ModalFooter, ModalContent } from 'components/base/Modal' +import Text from 'components/base/Text' import { createStructuredSelector, createSelector } from 'reselect' import { accountSelector } from 'reducers/accounts' import { currencySettingsForAccountSelector, marketIndicatorSelector } from 'reducers/settings' +import IconChevronRight from 'icons/ChevronRight' import CounterValue from 'components/CounterValue' import ConfirmationCheck from 'components/OperationsList/ConfirmationCheck' import Ellipsis from '../base/Ellipsis' @@ -102,91 +104,93 @@ const OperationDetails = connect(mapStateToProps)((props: Props) => { const isConfirmed = confirmations >= currencySettings.confirmationsNb const url = getAccountOperationExplorer(account, operation) - const uniqSenders = uniq(senders) return ( {t('app:operationDetails.title')} - - - - - - - - - + + + + + + + + + + + + - - - - - {t('app:operationDetails.account')} - {name} - - - {t('app:operationDetails.date')} - {moment(date).format('LLL')} - - - - - - {t('app:operationDetails.fees')} - {fee ? ( - - - + + + {t('app:operationDetails.account')} + {name} + + + {t('app:operationDetails.date')} + {moment(date).format('LLL')} + + + + + + {t('app:operationDetails.fees')} + {fee ? ( + + + + + + ) : null} + + + {t('app:operationDetails.status')} + + + {isConfirmed + ? t('app:operationDetails.confirmed') + : t('app:operationDetails.notConfirmed')} + + {`(${confirmations})`} - - ) : null} - - - {t('app:operationDetails.status')} - - - {isConfirmed - ? t('app:operationDetails.confirmed') - : t('app:operationDetails.notConfirmed')} - {`(${confirmations})`} - + + + + {t('app:operationDetails.identifier')} + + {hash} + + + + + {t('app:operationDetails.from')} + + + + + {t('app:operationDetails.to')} + + - - - - {t('app:operationDetails.from')} - {uniqSenders.map(v => {v})} - - - - {t('app:operationDetails.to')} - - - - - {t('app:operationDetails.identifier')} - - - {hash} - - - + + @@ -194,7 +198,7 @@ const OperationDetails = connect(mapStateToProps)((props: Props) => { {t('app:common.cancel')} {url ? ( - ) : null} @@ -223,31 +227,63 @@ const OperationDetailsWrapper = ({ t }: { t: T }) => ( export default translate()(OperationDetailsWrapper) -export function RenderRecipients({ recipients, t }: { recipients: *, t: T }) { - // Hardcoded for now - const numToShow = 2 - return ( - - - {recipients - .slice(0, numToShow) - .map(recipient => {recipient})} - - {recipients.length > numToShow && ( - +const More = styled(Text).attrs({ + ff: p => (p.ff ? p.ff : 'Museo Sans|Bold'), + fontSize: p => (p.fontSize ? p.fontSize : 2), + color: p => (p.color ? p.color : 'dark'), + tabIndex: 0, +})` + text-transform: ${p => (!p.textTransform ? 'auto' : 'uppercase')}; + cursor: pointer; + outline: none; +` + +export class Recipients extends Component<{ recipients: Array<*>, t: T }, *> { + state = { + showMore: false, + } + onClick = () => { + this.setState(({ showMore }) => ({ showMore: !showMore })) + } + render() { + const { recipients, t } = this.props + const { showMore } = this.state + // Hardcoded for now + const numToShow = 2 + const shouldShowMore = recipients.length > 3 + return ( + + + {(shouldShowMore ? recipients.slice(0, numToShow) : recipients).map(recipient => ( + {recipient} + ))} + + {shouldShowMore && + !showMore && ( + + + + {t('app:operationDetails.showMore', { recipients: recipients.length - numToShow })} + + + )} + {showMore && ( {recipients .slice(numToShow) .map(recipient => {recipient})} - - )} - - ) + )} + {shouldShowMore && + showMore && ( + + + + {t('app:operationDetails.showLess')} + + + )} + + ) + } } diff --git a/src/components/modals/ReleaseNotes.js b/src/components/modals/ReleaseNotes.js index a003fc2c..24f9114a 100644 --- a/src/components/modals/ReleaseNotes.js +++ b/src/components/modals/ReleaseNotes.js @@ -13,6 +13,7 @@ import Box from 'components/base/Box' import GrowScroll from 'components/base/GrowScroll' import Text from 'components/base/Text' import Spinner from 'components/base/Spinner' +import GradientBox from 'components/GradientBox' import type { T } from 'types/common' @@ -218,7 +219,7 @@ class ReleaseNotes extends PureComponent { return ( {t('app:releaseNotes.title')} - + {content} @@ -237,15 +238,4 @@ class ReleaseNotes extends PureComponent { } } -const GradientBox = styled.div` - width: 100%; - height: 60px; - position: absolute; - bottom: 68px; - left: 0; - right: 0; - background: linear-gradient(rgba(255, 255, 255, 0), #ffffff 70%); - z-index: 2; -` - export default translate()(ReleaseNotes) diff --git a/static/i18n/en/app.yml b/static/i18n/en/app.yml index 6b589f92..b9b86e60 100644 --- a/static/i18n/en/app.yml +++ b/static/i18n/en/app.yml @@ -167,7 +167,8 @@ operationDetails: to: To identifier: Hash viewOperation: View operation - showMore: See {{recipients}} more + showMore: Show {{recipients}} more + showLess: Show less operationList: noMoreOperations: No more operations manager: From 141e538fdb67add2633dfdb5025ccdb5445d702c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 20 Jun 2018 16:24:59 +0200 Subject: [PATCH 2/7] remove paddingBottom to avoid Modal to scroll --- src/components/base/Modal/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/base/Modal/index.js b/src/components/base/Modal/index.js index ca2e45e1..a57b5fbe 100644 --- a/src/components/base/Modal/index.js +++ b/src/components/base/Modal/index.js @@ -198,7 +198,7 @@ export class Modal extends Component { - + Date: Wed, 20 Jun 2018 16:36:10 +0200 Subject: [PATCH 3/7] experimental modal centering --- src/components/base/Modal/index.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/components/base/Modal/index.js b/src/components/base/Modal/index.js index a57b5fbe..6d1f19d6 100644 --- a/src/components/base/Modal/index.js +++ b/src/components/base/Modal/index.js @@ -10,6 +10,7 @@ import { connect } from 'react-redux' import Mortal from 'react-mortal' import styled from 'styled-components' import noop from 'lodash/noop' +import { EXPERIMENTAL_CENTER_MODAL } from 'config/constants' import { rgba } from 'styles/helpers' import { radii } from 'styles/theme' @@ -133,6 +134,18 @@ function stopPropagation(e) { e.stopPropagation() } +const wrap = EXPERIMENTAL_CENTER_MODAL + ? children => ( + + {children} + + ) + : children => ( + + {children} + + ) + export class Modal extends Component { static defaultProps = { isOpened: false, @@ -198,7 +211,7 @@ export class Modal extends Component { - + {wrap( { width={width} > - - + , + )} )} From b4ef42d36236938cae945fa15e396f5247b7e63c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 20 Jun 2018 16:47:50 +0200 Subject: [PATCH 4/7] polish the splashscreen --- src/index.ejs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/index.ejs b/src/index.ejs index b6be399f..ba5b3565 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -40,16 +40,16 @@ transform: rotate(0deg); } 20% { - transform: rotate(360deg); + transform: rotate(-360deg); } 30% { - transform: rotate(360deg); + transform: rotate(-360deg); } 50% { - transform: rotate(720deg); + transform: rotate(-720deg); } 60% { - transform: rotate(720deg); + transform: rotate(-720deg); } 100% { transform: rotate(0deg); From 0fda780eb5006da287ffa5ec5412efda0361aeb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 20 Jun 2018 16:53:43 +0200 Subject: [PATCH 5/7] fix scrollbar size --- package.json | 1 + src/components/base/Ellipsis.js | 2 +- src/components/base/GrowScroll/index.js | 5 ++++- yarn.lock | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8d6c79ed..f044185c 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "invariant": "^2.2.4", "lodash": "^4.17.5", "lru-cache": "^4.1.3", + "measure-scrollbar": "^1.1.0", "moment": "^2.22.2", "qrcode": "^1.2.0", "qrcode-reader": "^1.0.4", diff --git a/src/components/base/Ellipsis.js b/src/components/base/Ellipsis.js index 7f105dab..d2b10585 100644 --- a/src/components/base/Ellipsis.js +++ b/src/components/base/Ellipsis.js @@ -10,7 +10,7 @@ const innerStyle = { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: ' export default ({ children, canSelect, ...p }: { children: any, canSelect: * }) => ( - {children} + {children} ) diff --git a/src/components/base/GrowScroll/index.js b/src/components/base/GrowScroll/index.js index 4b8de481..4abf5370 100644 --- a/src/components/base/GrowScroll/index.js +++ b/src/components/base/GrowScroll/index.js @@ -2,6 +2,7 @@ import React, { PureComponent } from 'react' import Box from 'components/base/Box' +import measureScrollbar from 'measure-scrollbar/commonjs' type Props = { children: any, @@ -11,6 +12,8 @@ type Props = { export const GrowScrollContext = React.createContext() +const scrollbarWidth = measureScrollbar() + class GrowScroll extends PureComponent { static defaultProps = { full: false, @@ -47,7 +50,7 @@ class GrowScroll extends PureComponent { const scrollContainerStyles = { overflowY: 'scroll', - marginRight: `-80px`, + marginRight: `-${80 + scrollbarWidth}px`, paddingRight: `80px`, ...(maxHeight ? { diff --git a/yarn.lock b/yarn.lock index 229560e6..7e315c02 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9322,6 +9322,10 @@ meant@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/meant/-/meant-1.0.1.tgz#66044fea2f23230ec806fb515efea29c44d2115d" +measure-scrollbar@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/measure-scrollbar/-/measure-scrollbar-1.1.0.tgz#986890d22866255ec5b212480f097c55a82d1231" + media-typer@0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" From ea1b8443ed3640a1bf4aad2b023d240f156bb0ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 20 Jun 2018 16:53:53 +0200 Subject: [PATCH 6/7] fix missing constants --- src/config/constants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/config/constants.js b/src/config/constants.js index eb61aeb7..14e45f0d 100644 --- a/src/config/constants.js +++ b/src/config/constants.js @@ -66,6 +66,7 @@ export const SKIP_ONBOARDING = boolFromEnv('SKIP_ONBOARDING') export const SHOW_LEGACY_NEW_ACCOUNT = boolFromEnv('SHOW_LEGACY_NEW_ACCOUNT') export const HIGHLIGHT_I18N = boolFromEnv('HIGHLIGHT_I18N') export const DISABLE_ACTIVITY_INDICATORS = boolFromEnv('DISABLE_ACTIVITY_INDICATORS') +export const EXPERIMENTAL_CENTER_MODAL = boolFromEnv('EXPERIMENTAL_CENTER_MODAL') // Other constants From c3c03bf5684bd3d26a5ce66dce4d5700439c8d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 20 Jun 2018 18:03:37 +0200 Subject: [PATCH 7/7] fix flow --- src/components/base/Ellipsis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/base/Ellipsis.js b/src/components/base/Ellipsis.js index d2b10585..5990be5b 100644 --- a/src/components/base/Ellipsis.js +++ b/src/components/base/Ellipsis.js @@ -7,7 +7,7 @@ import Text from 'components/base/Text' const outerStyle = { width: 0 } const innerStyle = { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } -export default ({ children, canSelect, ...p }: { children: any, canSelect: * }) => ( +export default ({ children, canSelect, ...p }: { children: any, canSelect?: boolean }) => ( {children}