Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit e4e0c6b

Browse files
committed
Merge branch 'develop'
2 parents b348e63 + 6eaa5a4 commit e4e0c6b

28 files changed

+619
-243
lines changed

public/images/pattern-light.png

62.6 KB
Loading

public/main/plugins/ethWallet/index.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ function syncTransactions ({ number, walletId, webContents, bloqEthExplorer }) {
363363
logger.debug('Syncing', addresses, indexed)
364364
return Promise.all(
365365
addresses.map(function (address) {
366+
webContents.send('transactions-scan-started', { address })
366367
const from = bestBlock + 1
367368
const to = indexed
368369
return promiseAllProps({
@@ -410,6 +411,7 @@ function syncTransactions ({ number, walletId, webContents, bloqEthExplorer }) {
410411
})
411412
.then(function () {
412413
if (!webContents.isDestroyed()) {
414+
webContents.send('transactions-scan-finished', { address })
413415
webContents.send('eth-block', { number: indexed })
414416
logger.verbose('<-- New best block', { number: indexed })
415417
}
@@ -420,6 +422,9 @@ function syncTransactions ({ number, walletId, webContents, bloqEthExplorer }) {
420422
)
421423
})
422424
.catch(function (err) {
425+
if (!webContents.isDestroyed()) {
426+
webContents.send('transactions-scan-finished', {})
427+
}
423428
sendError({
424429
webContents,
425430
walletId,

public/main/plugins/tokens/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const settings = require('electron-settings')
55
const toLowerCase = str => str.toLowerCase()
66

77
const getTokenContractAddresses = () =>
8-
Object.keys(settings.get('tokens')).map(toLowerCase)
8+
Object.keys(settings.get('tokens') || {}).map(toLowerCase)
99

1010
const getTokenSymbol = address =>
1111
settings.get(`tokens.${address.toLowerCase()}.symbol`)

src/components/ConfirmModal.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import { Modal, BaseBtn } from './common'
2+
import PropTypes from 'prop-types'
3+
import styled from 'styled-components'
4+
import React from 'react'
5+
6+
const Container = styled.div`
7+
background-color: ${p => p.theme.colors.bg.white};
8+
padding: 2.4rem 1.6rem 1.6rem 1.6rem;
9+
`
10+
11+
const Message = styled.div`
12+
color: ${p => p.theme.colors.copy};
13+
margin-bottom: 2.4rem;
14+
font-size: 1.6rem;
15+
line-height: 1.5;
16+
`
17+
18+
const Button = styled(BaseBtn)`
19+
background-color: ${p => p.theme.colors.bg.primary};
20+
border-radius: 12px;
21+
display: block;
22+
line-height: 1.6rem;
23+
font-size: 1.3rem;
24+
font-weight: 600;
25+
letter-spacing: 0.4px;
26+
text-shadow: 0 2px 0 ${p => p.theme.colors.darkShade};
27+
padding: 1.2rem;
28+
width: 100%;
29+
30+
&:hover {
31+
opacity: 0.9;
32+
}
33+
`
34+
35+
export default class ConfirmModal extends React.Component {
36+
static propTypes = {
37+
onRequestClose: PropTypes.func.isRequired,
38+
onConfirm: PropTypes.func.isRequired,
39+
isOpen: PropTypes.bool.isRequired
40+
}
41+
42+
// eslint-disable-next-line complexity
43+
render() {
44+
const { onRequestClose, onConfirm, isOpen } = this.props
45+
46+
return (
47+
<Modal
48+
shouldReturnFocusAfterClose={false}
49+
onRequestClose={onRequestClose}
50+
styleOverrides={{
51+
width: 304,
52+
top: '35%'
53+
}}
54+
variant="primary"
55+
isOpen={isOpen}
56+
title="Confirm Rescan"
57+
>
58+
<Container data-testid="confirm-modal">
59+
<Message>
60+
Rescanning your transactions will close and re-open the app. You
61+
will need to log back in.
62+
</Message>
63+
<Button onClick={onConfirm}>Confirm and Log Out</Button>
64+
</Container>
65+
</Modal>
66+
)
67+
}
68+
}

src/components/Converter.js

Lines changed: 68 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
Btn,
1414
Sp
1515
} from './common'
16-
import ConverterIcon from './common/ConverterIcon'
1716

1817
const Container = styled.div`
1918
padding: 3.2rem 2.4rem;
@@ -112,24 +111,10 @@ const AvailableAmount = styled.div`
112111
}
113112
`
114113

115-
const Title = styled.h1`
116-
margin: 0;
117-
line-height: 3rem;
118-
font-size: 2.4rem;
119-
`
120-
121-
const SmallText = styled.span`
122-
text-shadow: 0 1px 1px ${p => p.theme.colors.darkShade};
123-
line-height: 2.5rem;
124-
font-size: 1.6rem;
125-
font-weight: normal;
126-
`
127-
128114
class Converter extends React.Component {
129115
static propTypes = {
130116
convertFeatureStatus: PropTypes.oneOf([
131117
'in-initial-auction',
132-
'transfer-disabled',
133118
'offline',
134119
'no-eth',
135120
'ok'
@@ -162,93 +147,74 @@ class Converter extends React.Component {
162147
title="Autonomous Converter"
163148
>
164149
{converterStatus ? (
165-
convertFeatureStatus !== 'transfer-disabled' ? (
166-
<Container>
167-
<StatsContainer data-testid="stats">
168-
<Sp p={2}>
169-
<Flex.Row justify="space-between" align="baseline">
170-
<Label>Current Price</Label>
171-
<Flex.Column>
172-
<Flex.Row align="baseline">
173-
<Badge>1 MET</Badge>
174-
<Price>
175-
<DisplayValue
176-
pre=" = "
177-
value={converterStatus.currentPrice}
178-
post=" ETH"
179-
/>
180-
</Price>
181-
</Flex.Row>
182-
<USDPrice>{converterPriceUSD}</USDPrice>
183-
</Flex.Column>
184-
</Flex.Row>
185-
</Sp>
186-
<Sp p={2}>
187-
<Flex.Row justify="space-between" align="baseline">
188-
<Label>Available MET</Label>
189-
<AvailableAmount>
190-
<DisplayValue
191-
value={converterStatus.availableMtn}
192-
post=" MET"
193-
/>
194-
</AvailableAmount>
195-
</Flex.Row>
196-
</Sp>
197-
<Sp p={2}>
198-
<Flex.Row justify="space-between" align="baseline">
199-
<Label>Available ETH</Label>
200-
<AvailableAmount>
201-
<DisplayValue
202-
value={converterStatus.availableEth}
203-
post=" ETH"
204-
/>
205-
</AvailableAmount>
206-
</Flex.Row>
207-
</Sp>
208-
</StatsContainer>
209-
210-
<ConvertBtn
211-
data-disabled={convertFeatureStatus !== 'ok' ? true : null}
212-
data-rh-negative
213-
data-rh={
214-
convertFeatureStatus === 'offline'
215-
? "Can't convert while offline"
216-
: convertFeatureStatus === 'in-initial-auction'
217-
? 'Conversions are disabled during Initial Auction'
218-
: convertFeatureStatus === 'no-eth'
219-
? 'You need some ETH to pay for conversion gas'
220-
: null
221-
}
222-
data-modal="convert"
223-
data-testid="convert-btn"
224-
onClick={
225-
convertFeatureStatus === 'ok' ? this.onOpenModal : null
226-
}
227-
>
228-
Convert
229-
</ConvertBtn>
230-
231-
<ConvertDrawer
232-
onRequestClose={this.onCloseModal}
233-
isOpen={this.state.activeModal === 'convert'}
234-
/>
235-
</Container>
236-
) : (
237-
<Sp p={6}>
238-
<LoadingContainer data-testid="commingsoon">
239-
<Sp py={4}>
240-
<ConverterIcon display="inline" size="69.5px" />
241-
</Sp>
242-
<Title>Coming Soon</Title>
243-
<Sp py={2}>
244-
<SmallText>
245-
The Autonomous Converter will become available after the
246-
initial auction has ended.
247-
</SmallText>
248-
</Sp>
249-
</LoadingContainer>
250-
</Sp>
251-
)
150+
<Container>
151+
<StatsContainer data-testid="stats">
152+
<Sp p={2}>
153+
<Flex.Row justify="space-between" align="baseline">
154+
<Label>Current Price</Label>
155+
<Flex.Column>
156+
<Flex.Row align="baseline">
157+
<Badge>1 MET</Badge>
158+
<Price>
159+
<DisplayValue
160+
pre=" = "
161+
value={converterStatus.currentPrice}
162+
post=" ETH"
163+
/>
164+
</Price>
165+
</Flex.Row>
166+
<USDPrice>{converterPriceUSD}</USDPrice>
167+
</Flex.Column>
168+
</Flex.Row>
169+
</Sp>
170+
<Sp p={2}>
171+
<Flex.Row justify="space-between" align="baseline">
172+
<Label>Available MET</Label>
173+
<AvailableAmount>
174+
<DisplayValue
175+
value={converterStatus.availableMtn}
176+
post=" MET"
177+
/>
178+
</AvailableAmount>
179+
</Flex.Row>
180+
</Sp>
181+
<Sp p={2}>
182+
<Flex.Row justify="space-between" align="baseline">
183+
<Label>Available ETH</Label>
184+
<AvailableAmount>
185+
<DisplayValue
186+
value={converterStatus.availableEth}
187+
post=" ETH"
188+
/>
189+
</AvailableAmount>
190+
</Flex.Row>
191+
</Sp>
192+
</StatsContainer>
193+
194+
<ConvertBtn
195+
data-disabled={convertFeatureStatus !== 'ok' ? true : null}
196+
data-rh-negative
197+
data-rh={
198+
convertFeatureStatus === 'offline'
199+
? "Can't convert while offline"
200+
: convertFeatureStatus === 'in-initial-auction'
201+
? 'Conversions are disabled during Initial Auction'
202+
: convertFeatureStatus === 'no-eth'
203+
? 'You need some ETH to pay for conversion gas'
204+
: null
205+
}
206+
data-modal="convert"
207+
data-testid="convert-btn"
208+
onClick={convertFeatureStatus === 'ok' ? this.onOpenModal : null}
209+
>
210+
Convert
211+
</ConvertBtn>
212+
213+
<ConvertDrawer
214+
onRequestClose={this.onCloseModal}
215+
isOpen={this.state.activeModal === 'convert'}
216+
/>
217+
</Container>
252218
) : (
253219
<Sp p={6}>
254220
<LoadingContainer data-testid="waiting">

src/components/Dashboard.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import SendDrawer from './SendDrawer'
77
import PropTypes from 'prop-types'
88
import { Btn } from './common'
99
import styled from 'styled-components'
10-
import TxList from './TxList'
10+
import TxList from './tx-list/TxList'
1111
import React from 'react'
1212

1313
const Container = styled.div`
@@ -75,17 +75,9 @@ const ReceiveBtn = Btn.extend`
7575
}
7676
`
7777

78-
const NoTx = styled.div`
79-
font-size: 1.6rem;
80-
margin-top: 4.8rem;
81-
text-shadow: 0 1px 1px ${p => p.theme.colors.darkShade};
82-
`
83-
8478
class Dashboard extends React.Component {
8579
static propTypes = {
86-
sendFeatureStatus: PropTypes.oneOf(['offline', 'no-funds', 'ok'])
87-
.isRequired,
88-
hasTransactions: PropTypes.bool.isRequired
80+
sendFeatureStatus: PropTypes.oneOf(['offline', 'no-funds', 'ok']).isRequired
8981
}
9082

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

9991
render() {
100-
const { sendFeatureStatus, hasTransactions } = this.props
92+
const { sendFeatureStatus } = this.props
10193

10294
return (
10395
<Container data-testid="dashboard-container">
@@ -138,11 +130,7 @@ class Dashboard extends React.Component {
138130
</Right>
139131
</Hero>
140132

141-
{hasTransactions ? (
142-
<TxList />
143-
) : (
144-
<NoTx data-testid="notx-msg">No transactions to show yet.</NoTx>
145-
)}
133+
<TxList />
146134

147135
<ReceiveDrawer
148136
onRequestClose={this.onCloseModal}
@@ -158,8 +146,7 @@ class Dashboard extends React.Component {
158146
}
159147

160148
const mapStateToProps = state => ({
161-
sendFeatureStatus: selectors.sendFeatureStatus(state),
162-
hasTransactions: selectors.getActiveWalletTransactions(state).length > 0
149+
sendFeatureStatus: selectors.sendFeatureStatus(state)
163150
})
164151

165152
export default connect(mapStateToProps)(Dashboard)

0 commit comments

Comments
 (0)