Browse Source

Merge pull request #630 from NastiaS/minorFixesBranch

Minor fixes branch
master
Gaëtan Renaudeau 7 years ago
committed by GitHub
parent
commit
24a8d00e34
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      src/components/base/Spoiler/index.js
  2. 175
      src/components/modals/OperationDetails.js
  3. 3
      static/i18n/en/app.yml

16
src/components/base/Spoiler/index.js

@ -17,12 +17,12 @@ type State = {
} }
const Title = styled(Text).attrs({ const Title = styled(Text).attrs({
ff: 'Museo Sans|Bold', ff: p => (p.ff ? p.ff : 'Museo Sans|Bold'),
fontSize: 2, fontSize: p => (p.fontSize ? p.fontSize : 2),
color: 'dark', color: p => (p.color ? p.color : 'dark'),
tabIndex: 0, tabIndex: 0,
})` })`
text-transform: uppercase; text-transform: ${p => (!p.textTransform ? 'auto' : 'uppercase')};
letter-spacing: 1px; letter-spacing: 1px;
cursor: pointer; cursor: pointer;
outline: none; outline: none;
@ -41,15 +41,17 @@ class Spoiler extends PureComponent<Props, State> {
toggle = () => this.setState({ isOpened: !this.state.isOpened }) toggle = () => this.setState({ isOpened: !this.state.isOpened })
render() { render() {
const { title, children } = this.props const { title, children, ...p } = this.props
const { isOpened } = this.state const { isOpened } = this.state
return ( return (
<Fragment> <Fragment>
<Box horizontal flow={1} color="dark" align="center"> <Box horizontal flow={1} color="dark" align="center" {...p}>
<IconContainer isOpened={isOpened}> <IconContainer isOpened={isOpened}>
<IconChevronRight size={12} /> <IconChevronRight size={12} />
</IconContainer> </IconContainer>
<Title onClick={this.toggle}>{title}</Title> <Title {...p} onClick={this.toggle}>
{title}
</Title>
</Box> </Box>
{isOpened && children} {isOpened && children}
</Fragment> </Fragment>

175
src/components/modals/OperationDetails.js

@ -17,6 +17,7 @@ import { MODAL_OPERATION_DETAILS } from 'config/constants'
import { getMarketColor } from 'styles/helpers' import { getMarketColor } from 'styles/helpers'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import Spoiler from 'components/base/Spoiler'
import Button from 'components/base/Button' import Button from 'components/base/Button'
import Bar from 'components/base/Bar' import Bar from 'components/base/Bar'
import FormattedVal from 'components/base/FormattedVal' import FormattedVal from 'components/base/FormattedVal'
@ -28,26 +29,23 @@ import { currencySettingsForAccountSelector, marketIndicatorSelector } from 'red
import CounterValue from 'components/CounterValue' import CounterValue from 'components/CounterValue'
import ConfirmationCheck from 'components/OperationsList/ConfirmationCheck' import ConfirmationCheck from 'components/OperationsList/ConfirmationCheck'
import Ellipsis from '../base/Ellipsis'
const Line = styled(Box).attrs({
horizontal: true, const OpDetailsTitle = styled(Box).attrs({
})`` ff: 'Museo Sans|ExtraBold',
fontSize: 2,
const ColLeft = styled(Box).attrs({ color: 'black',
color: 'smoke', textTransform: 'uppercase',
ff: 'Open Sans', mb: 1,
fontSize: 4,
})` })`
width: 95px; letter-spacing: 2px;
` `
const ColRight = styled(Box).attrs({
fontSize: 4, const OpDetailsData = styled(Box).attrs({
ff: 'Open Sans', ff: 'Open Sans',
color: 'dark', color: 'smoke',
shrink: true, fontSize: 4,
})` })``
word-break: break-all;
`
const CanSelect = styled.div` const CanSelect = styled.div`
user-select: text; user-select: text;
@ -91,7 +89,8 @@ type Props = {
const OperationDetails = connect(mapStateToProps)((props: Props) => { const OperationDetails = connect(mapStateToProps)((props: Props) => {
const { t, onClose, operation, account, currencySettings, marketIndicator } = props const { t, onClose, operation, account, currencySettings, marketIndicator } = props
if (!operation || !account || !currencySettings) return null if (!operation || !account || !currencySettings) return null
const { hash, date, senders, recipients, type, fee } = operation const { hash, date, senders, type, fee, recipients } = operation
const { name, unit, currency } = account const { name, unit, currency } = account
const amount = getOperationAmountNumber(operation) const amount = getOperationAmountNumber(operation)
const isNegative = operation.type === 'OUT' const isNegative = operation.type === 'OUT'
@ -108,21 +107,21 @@ const OperationDetails = connect(mapStateToProps)((props: Props) => {
return ( return (
<ModalBody onClose={onClose}> <ModalBody onClose={onClose}>
<ModalTitle>{t('app:operationDetails.title')}</ModalTitle> <ModalTitle>{t('app:operationDetails.title')}</ModalTitle>
<ModalContent flow={4}> <ModalContent flow={3}>
<Box alignItems="center" mt={3}> <Box alignItems="center" mt={1}>
<ConfirmationCheck <ConfirmationCheck
marketColor={marketColor} marketColor={marketColor}
isConfirmed={isConfirmed} isConfirmed={isConfirmed}
style={{ style={{
transform: 'scale(2)', transform: 'scale(1.5)',
}} }}
t={t} t={t}
type={type} type={type}
withTooltip={false} withTooltip={false}
/> />
<Box mt={5} alignItems="center"> <Box my={4} alignItems="center">
<Box> <Box>
<FormattedVal unit={unit} alwaysShowSign showCode val={amount} fontSize={8} /> <FormattedVal unit={unit} alwaysShowSign showCode val={amount} fontSize={6} />
</Box> </Box>
<Box mt={1}> <Box mt={1}>
<CounterValue <CounterValue
@ -135,60 +134,67 @@ const OperationDetails = connect(mapStateToProps)((props: Props) => {
</Box> </Box>
</Box> </Box>
</Box> </Box>
<Line mt={4}> <Box horizontal flow={2}>
<ColLeft>{t('app:operationDetails.account')}</ColLeft> <Box flex={1}>
<ColRight>{name}</ColRight> <OpDetailsTitle>{t('app:operationDetails.account')}</OpDetailsTitle>
</Line> <OpDetailsData>{name}</OpDetailsData>
<B /> </Box>
<Line> <Box flex={1}>
<ColLeft>{t('app:operationDetails.date')}</ColLeft> <OpDetailsTitle>{t('app:operationDetails.date')}</OpDetailsTitle>
<ColRight>{moment(date).format('LLL')}</ColRight> <OpDetailsData>{moment(date).format('LLL')}</OpDetailsData>
</Line> </Box>
</Box>
<B /> <B />
<Line> <Box horizontal flow={2}>
<ColLeft>{t('app:operationDetails.status')}</ColLeft> <Box flex={1}>
<ColRight color={isConfirmed ? 'positiveGreen' : null} horizontal flow={1}> <OpDetailsTitle>{t('app:operationDetails.fees')}</OpDetailsTitle>
<Box> {fee ? (
{isConfirmed <Fragment>
? t('app:operationDetails.confirmed') <OpDetailsData>
: t('app:operationDetails.notConfirmed')} <FormattedVal unit={unit} showCode val={fee} color="dark" />
</Box> </OpDetailsData>
<Box>{`(${confirmations})`}</Box> </Fragment>
</ColRight> ) : null}
</Line> </Box>
<Box flex={1}>
<OpDetailsTitle>{t('app:operationDetails.status')}</OpDetailsTitle>
<OpDetailsData color={isConfirmed ? 'positiveGreen' : null} horizontal>
<Box>
{isConfirmed
? t('app:operationDetails.confirmed')
: t('app:operationDetails.notConfirmed')}
</Box>
<Box>{`(${confirmations})`}</Box>
</OpDetailsData>
</Box>
</Box>
<B /> <B />
{fee ? ( <Box>
<Fragment> <OpDetailsTitle>{t('app:operationDetails.from')}</OpDetailsTitle>
<Line> <OpDetailsData>{uniqSenders.map(v => <CanSelect key={v}>{v}</CanSelect>)}</OpDetailsData>
<ColLeft>{t('app:operationDetails.fees')}</ColLeft> </Box>
<ColRight>
<FormattedVal unit={unit} showCode val={fee} color="dark" />
</ColRight>
</Line>
<B />
</Fragment>
) : null}
<Line>
<ColLeft>{t('app:operationDetails.from')}</ColLeft>
<ColRight>{uniqSenders.map(v => <CanSelect key={v}>{v}</CanSelect>)}</ColRight>
</Line>
<B /> <B />
<Line> <Box>
<ColLeft>{t('app:operationDetails.to')}</ColLeft> <OpDetailsTitle>{t('app:operationDetails.to')}</OpDetailsTitle>
<ColRight>{recipients.map(v => <CanSelect key={v}> {v} </CanSelect>)}</ColRight> <RenderRecipients recipients={recipients} t={t} />
</Line> </Box>
<B /> <B />
<Line> <Box>
<ColLeft>{t('app:operationDetails.identifier')}</ColLeft> <OpDetailsTitle>{t('app:operationDetails.identifier')}</OpDetailsTitle>
<ColRight> <OpDetailsData>
<CanSelect>{hash}</CanSelect> <CanSelect>
</ColRight> <Ellipsis>{hash}</Ellipsis>
</Line> </CanSelect>
</OpDetailsData>
</Box>
</ModalContent> </ModalContent>
<ModalFooter horizontal justify="flex-end" flow={2}> <ModalFooter horizontal justify="flex-end" flow={2}>
<Button onClick={onClose}>{t('app:common.cancel')}</Button> <Button padded onClick={onClose}>
{t('app:common.cancel')}
</Button>
{url ? ( {url ? (
<Button primary onClick={() => shell.openExternal(url)}> <Button ml="auto" primary padded onClick={() => shell.openExternal(url)}>
{t('app:operationDetails.viewOperation')} {t('app:operationDetails.viewOperation')}
</Button> </Button>
) : null} ) : null}
@ -216,3 +222,32 @@ const OperationDetailsWrapper = ({ t }: { t: T }) => (
) )
export default translate()(OperationDetailsWrapper) export default translate()(OperationDetailsWrapper)
export function RenderRecipients({ recipients, t }: { recipients: *, t: T }) {
// Hardcoded for now
const numToShow = 2
return (
<Box>
<OpDetailsData>
{recipients
.slice(0, numToShow)
.map(recipient => <CanSelect key={recipient}>{recipient}</CanSelect>)}
</OpDetailsData>
{recipients.length > numToShow && (
<Spoiler
title={t('app:operationDetails.showMore', { recipients: recipients.length - numToShow })}
color="wallet"
ff="Open Sans|SemiBold"
fontSize={4}
mt={1}
>
<OpDetailsData>
{recipients
.slice(numToShow)
.map(recipient => <CanSelect key={recipient}>{recipient}</CanSelect>)}
</OpDetailsData>
</Spoiler>
)}
</Box>
)
}

3
static/i18n/en/app.yml

@ -158,8 +158,9 @@ operationDetails:
fees: Fees fees: Fees
from: From from: From
to: To to: To
identifier: Identifier identifier: Hash
viewOperation: View operation viewOperation: View operation
showMore: See {{recipients}} more
operationList: operationList:
noMoreOperations: No more operations noMoreOperations: No more operations
manager: manager:

Loading…
Cancel
Save