Skip to content
This repository has been archived by the owner on Oct 5, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
gabmontes committed Jul 26, 2018
2 parents b348e63 + 6eaa5a4 commit e4e0c6b
Show file tree
Hide file tree
Showing 28 changed files with 619 additions and 243 deletions.
Binary file added public/images/pattern-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/main/plugins/ethWallet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ function syncTransactions ({ number, walletId, webContents, bloqEthExplorer }) {
logger.debug('Syncing', addresses, indexed)
return Promise.all(
addresses.map(function (address) {
webContents.send('transactions-scan-started', { address })
const from = bestBlock + 1
const to = indexed
return promiseAllProps({
Expand Down Expand Up @@ -410,6 +411,7 @@ function syncTransactions ({ number, walletId, webContents, bloqEthExplorer }) {
})
.then(function () {
if (!webContents.isDestroyed()) {
webContents.send('transactions-scan-finished', { address })
webContents.send('eth-block', { number: indexed })
logger.verbose('<-- New best block', { number: indexed })
}
Expand All @@ -420,6 +422,9 @@ function syncTransactions ({ number, walletId, webContents, bloqEthExplorer }) {
)
})
.catch(function (err) {
if (!webContents.isDestroyed()) {
webContents.send('transactions-scan-finished', {})
}
sendError({
webContents,
walletId,
Expand Down
2 changes: 1 addition & 1 deletion public/main/plugins/tokens/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const settings = require('electron-settings')
const toLowerCase = str => str.toLowerCase()

const getTokenContractAddresses = () =>
Object.keys(settings.get('tokens')).map(toLowerCase)
Object.keys(settings.get('tokens') || {}).map(toLowerCase)

const getTokenSymbol = address =>
settings.get(`tokens.${address.toLowerCase()}.symbol`)
Expand Down
68 changes: 68 additions & 0 deletions src/components/ConfirmModal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { Modal, BaseBtn } from './common'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import React from 'react'

const Container = styled.div`
background-color: ${p => p.theme.colors.bg.white};
padding: 2.4rem 1.6rem 1.6rem 1.6rem;
`

const Message = styled.div`
color: ${p => p.theme.colors.copy};
margin-bottom: 2.4rem;
font-size: 1.6rem;
line-height: 1.5;
`

const Button = styled(BaseBtn)`
background-color: ${p => p.theme.colors.bg.primary};
border-radius: 12px;
display: block;
line-height: 1.6rem;
font-size: 1.3rem;
font-weight: 600;
letter-spacing: 0.4px;
text-shadow: 0 2px 0 ${p => p.theme.colors.darkShade};
padding: 1.2rem;
width: 100%;
&:hover {
opacity: 0.9;
}
`

export default class ConfirmModal extends React.Component {
static propTypes = {
onRequestClose: PropTypes.func.isRequired,
onConfirm: PropTypes.func.isRequired,
isOpen: PropTypes.bool.isRequired
}

// eslint-disable-next-line complexity
render() {
const { onRequestClose, onConfirm, isOpen } = this.props

return (
<Modal
shouldReturnFocusAfterClose={false}
onRequestClose={onRequestClose}
styleOverrides={{
width: 304,
top: '35%'
}}
variant="primary"
isOpen={isOpen}
title="Confirm Rescan"
>
<Container data-testid="confirm-modal">
<Message>
Rescanning your transactions will close and re-open the app. You
will need to log back in.
</Message>
<Button onClick={onConfirm}>Confirm and Log Out</Button>
</Container>
</Modal>
)
}
}
170 changes: 68 additions & 102 deletions src/components/Converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
Btn,
Sp
} from './common'
import ConverterIcon from './common/ConverterIcon'

const Container = styled.div`
padding: 3.2rem 2.4rem;
Expand Down Expand Up @@ -112,24 +111,10 @@ const AvailableAmount = styled.div`
}
`

const Title = styled.h1`
margin: 0;
line-height: 3rem;
font-size: 2.4rem;
`

const SmallText = styled.span`
text-shadow: 0 1px 1px ${p => p.theme.colors.darkShade};
line-height: 2.5rem;
font-size: 1.6rem;
font-weight: normal;
`

class Converter extends React.Component {
static propTypes = {
convertFeatureStatus: PropTypes.oneOf([
'in-initial-auction',
'transfer-disabled',
'offline',
'no-eth',
'ok'
Expand Down Expand Up @@ -162,93 +147,74 @@ class Converter extends React.Component {
title="Autonomous Converter"
>
{converterStatus ? (
convertFeatureStatus !== 'transfer-disabled' ? (
<Container>
<StatsContainer data-testid="stats">
<Sp p={2}>
<Flex.Row justify="space-between" align="baseline">
<Label>Current Price</Label>
<Flex.Column>
<Flex.Row align="baseline">
<Badge>1 MET</Badge>
<Price>
<DisplayValue
pre=" = "
value={converterStatus.currentPrice}
post=" ETH"
/>
</Price>
</Flex.Row>
<USDPrice>{converterPriceUSD}</USDPrice>
</Flex.Column>
</Flex.Row>
</Sp>
<Sp p={2}>
<Flex.Row justify="space-between" align="baseline">
<Label>Available MET</Label>
<AvailableAmount>
<DisplayValue
value={converterStatus.availableMtn}
post=" MET"
/>
</AvailableAmount>
</Flex.Row>
</Sp>
<Sp p={2}>
<Flex.Row justify="space-between" align="baseline">
<Label>Available ETH</Label>
<AvailableAmount>
<DisplayValue
value={converterStatus.availableEth}
post=" ETH"
/>
</AvailableAmount>
</Flex.Row>
</Sp>
</StatsContainer>

<ConvertBtn
data-disabled={convertFeatureStatus !== 'ok' ? true : null}
data-rh-negative
data-rh={
convertFeatureStatus === 'offline'
? "Can't convert while offline"
: convertFeatureStatus === 'in-initial-auction'
? 'Conversions are disabled during Initial Auction'
: convertFeatureStatus === 'no-eth'
? 'You need some ETH to pay for conversion gas'
: null
}
data-modal="convert"
data-testid="convert-btn"
onClick={
convertFeatureStatus === 'ok' ? this.onOpenModal : null
}
>
Convert
</ConvertBtn>

<ConvertDrawer
onRequestClose={this.onCloseModal}
isOpen={this.state.activeModal === 'convert'}
/>
</Container>
) : (
<Sp p={6}>
<LoadingContainer data-testid="commingsoon">
<Sp py={4}>
<ConverterIcon display="inline" size="69.5px" />
</Sp>
<Title>Coming Soon</Title>
<Sp py={2}>
<SmallText>
The Autonomous Converter will become available after the
initial auction has ended.
</SmallText>
</Sp>
</LoadingContainer>
</Sp>
)
<Container>
<StatsContainer data-testid="stats">
<Sp p={2}>
<Flex.Row justify="space-between" align="baseline">
<Label>Current Price</Label>
<Flex.Column>
<Flex.Row align="baseline">
<Badge>1 MET</Badge>
<Price>
<DisplayValue
pre=" = "
value={converterStatus.currentPrice}
post=" ETH"
/>
</Price>
</Flex.Row>
<USDPrice>{converterPriceUSD}</USDPrice>
</Flex.Column>
</Flex.Row>
</Sp>
<Sp p={2}>
<Flex.Row justify="space-between" align="baseline">
<Label>Available MET</Label>
<AvailableAmount>
<DisplayValue
value={converterStatus.availableMtn}
post=" MET"
/>
</AvailableAmount>
</Flex.Row>
</Sp>
<Sp p={2}>
<Flex.Row justify="space-between" align="baseline">
<Label>Available ETH</Label>
<AvailableAmount>
<DisplayValue
value={converterStatus.availableEth}
post=" ETH"
/>
</AvailableAmount>
</Flex.Row>
</Sp>
</StatsContainer>

<ConvertBtn
data-disabled={convertFeatureStatus !== 'ok' ? true : null}
data-rh-negative
data-rh={
convertFeatureStatus === 'offline'
? "Can't convert while offline"
: convertFeatureStatus === 'in-initial-auction'
? 'Conversions are disabled during Initial Auction'
: convertFeatureStatus === 'no-eth'
? 'You need some ETH to pay for conversion gas'
: null
}
data-modal="convert"
data-testid="convert-btn"
onClick={convertFeatureStatus === 'ok' ? this.onOpenModal : null}
>
Convert
</ConvertBtn>

<ConvertDrawer
onRequestClose={this.onCloseModal}
isOpen={this.state.activeModal === 'convert'}
/>
</Container>
) : (
<Sp p={6}>
<LoadingContainer data-testid="waiting">
Expand Down
23 changes: 5 additions & 18 deletions src/components/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import SendDrawer from './SendDrawer'
import PropTypes from 'prop-types'
import { Btn } from './common'
import styled from 'styled-components'
import TxList from './TxList'
import TxList from './tx-list/TxList'
import React from 'react'

const Container = styled.div`
Expand Down Expand Up @@ -75,17 +75,9 @@ const ReceiveBtn = Btn.extend`
}
`

const NoTx = styled.div`
font-size: 1.6rem;
margin-top: 4.8rem;
text-shadow: 0 1px 1px ${p => p.theme.colors.darkShade};
`

class Dashboard extends React.Component {
static propTypes = {
sendFeatureStatus: PropTypes.oneOf(['offline', 'no-funds', 'ok'])
.isRequired,
hasTransactions: PropTypes.bool.isRequired
sendFeatureStatus: PropTypes.oneOf(['offline', 'no-funds', 'ok']).isRequired
}

state = {
Expand All @@ -97,7 +89,7 @@ class Dashboard extends React.Component {
onCloseModal = () => this.setState({ activeModal: null })

render() {
const { sendFeatureStatus, hasTransactions } = this.props
const { sendFeatureStatus } = this.props

return (
<Container data-testid="dashboard-container">
Expand Down Expand Up @@ -138,11 +130,7 @@ class Dashboard extends React.Component {
</Right>
</Hero>

{hasTransactions ? (
<TxList />
) : (
<NoTx data-testid="notx-msg">No transactions to show yet.</NoTx>
)}
<TxList />

<ReceiveDrawer
onRequestClose={this.onCloseModal}
Expand All @@ -158,8 +146,7 @@ class Dashboard extends React.Component {
}

const mapStateToProps = state => ({
sendFeatureStatus: selectors.sendFeatureStatus(state),
hasTransactions: selectors.getActiveWalletTransactions(state).length > 0
sendFeatureStatus: selectors.sendFeatureStatus(state)
})

export default connect(mapStateToProps)(Dashboard)
Loading

0 comments on commit e4e0c6b

Please sign in to comment.