Skip to content

Commit c136b30

Browse files
authored
Merge pull request #1047 from nervosnetwork/rc/v0.24.0
[ᚬmaster] Rc/v0.24.0
2 parents 247c1a1 + 1fdb9b7 commit c136b30

File tree

52 files changed

+386
-453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+386
-453
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,34 @@
1+
# [0.24.0](https://github.com/nervosnetwork/neuron/compare/v0.23.1...v0.24.0) (2019-11-04)
2+
3+
4+
### Bug Fixes
5+
6+
* sign witness result in test ([92dbaa2](https://github.com/nervosnetwork/neuron/commit/92dbaa2))
7+
* **neuron-ui:** remove length limitation of password, but should the alert instead ([f25c8fd](https://github.com/nervosnetwork/neuron/commit/f25c8fd))
8+
* Search history by date ([6df490a](https://github.com/nervosnetwork/neuron/commit/6df490a))
9+
* **neuron-ui:** hide the colon if description is empty ([3af1ec4](https://github.com/nervosnetwork/neuron/commit/3af1ec4))
10+
* **neuron-ui:** hide the confirmations of pending txs ([456210d](https://github.com/nervosnetwork/neuron/commit/456210d))
11+
* **neuron-ui:** hide the pending list if it has no items. ([19d857e](https://github.com/nervosnetwork/neuron/commit/19d857e))
12+
13+
14+
### Features
15+
16+
* Always show address book ([940e23a](https://github.com/nervosnetwork/neuron/commit/940e23a))
17+
* Change confirmation threshold to 30 ([1dabb3c](https://github.com/nervosnetwork/neuron/commit/1dabb3c))
18+
* Change the way pending confirmations display on overview ([f5cad48](https://github.com/nervosnetwork/neuron/commit/f5cad48))
19+
* Move explorer URL determination to ChainInfo ([83c69c7](https://github.com/nervosnetwork/neuron/commit/83c69c7))
20+
* Remove miner info feature ([4dcdad4](https://github.com/nervosnetwork/neuron/commit/4dcdad4))
21+
* **neuron-ui:** clear send view on wallet switching ([47af746](https://github.com/nervosnetwork/neuron/commit/47af746))
22+
* **neuron-ui:** disable the submit button if the generated tx is null ([be45889](https://github.com/nervosnetwork/neuron/commit/be45889))
23+
* **neuron-ui:** use tooltip component instead of element title to display the sync progress. ([6780d45](https://github.com/nervosnetwork/neuron/commit/6780d45))
24+
25+
26+
### Performance Improvements
27+
28+
* cache getTransaction result when sync in indexer mode ([756bd30](https://github.com/nervosnetwork/neuron/commit/756bd30))
29+
30+
31+
132
## [0.23.1](https://github.com/nervosnetwork/neuron/compare/v0.23.0...v0.23.1) (2019-10-28)
233

334

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "0.23.1",
5+
"version": "0.24.0",
66
"npmClient": "yarn",
77
"useWorkspaces": true
88
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "neuron",
33
"productName": "Neuron",
44
"description": "CKB Neuron Wallet",
5-
"version": "0.23.1",
5+
"version": "0.24.0",
66
"private": true,
77
"author": {
88
"name": "Nervos Core Dev",

packages/neuron-ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "neuron-ui",
3-
"version": "0.23.1",
3+
"version": "0.24.0",
44
"private": true,
55
"author": {
66
"name": "Nervos Core Dev",
@@ -43,7 +43,7 @@
4343
"last 2 chrome versions"
4444
],
4545
"dependencies": {
46-
"@nervosnetwork/ckb-sdk-core": "0.23.1",
46+
"@nervosnetwork/ckb-sdk-core": "0.24.0",
4747
"@uifabric/experiments": "7.16.1",
4848
"@uifabric/styling": "7.6.2",
4949
"canvg": "2.0.0",

packages/neuron-ui/src/components/Addresses/index.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect, useMemo } from 'react'
1+
import React, { useState, useMemo } from 'react'
22
import { RouteComponentProps } from 'react-router-dom'
33
import { useTranslation } from 'react-i18next'
44
import {
@@ -18,7 +18,6 @@ import { ckbCore } from 'services/chain'
1818
import { StateWithDispatch } from 'states/stateProvider/reducer'
1919

2020
import { useLocalDescription } from 'utils/hooks'
21-
import { Routes } from 'utils/const'
2221
import { localNumberFormatter, shannonToCKBFormatter } from 'utils/formatters'
2322
import { onRenderRow } from 'utils/fabricUIRender'
2423

@@ -28,22 +27,13 @@ const Addresses = ({
2827
},
2928
wallet: { addresses = [], id: walletID },
3029
chain: { networkID },
31-
settings: {
32-
general: { showAddressBook = false },
33-
networks = [],
34-
},
35-
history,
30+
settings: { networks = [] },
3631
dispatch,
3732
}: React.PropsWithoutRef<StateWithDispatch & RouteComponentProps>) => {
3833
const isMainnet =
3934
(networks.find(n => n.id === networkID) || {}).chain === (process.env.REACT_APP_MAINNET_TAG || 'ckb')
4035
const [showMainnetAddress, setShowMainnetAddress] = useState(false)
4136
const [t] = useTranslation()
42-
useEffect(() => {
43-
if (!showAddressBook) {
44-
history.push(Routes.Overview)
45-
}
46-
}, [showAddressBook, history])
4737

4838
const {
4939
localDescription,

packages/neuron-ui/src/components/CustomRows/ActivityRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ActivityRow = (props?: ActivityRowProps) => {
3434
return (
3535
<div
3636
className={`${styles.activityRow} ${styles[status]}`}
37-
title={`${hash}: ${description || ''}`}
37+
title={`${hash}${description ? `: ${description}` : ''}`}
3838
onDoubleClick={onDoubleClick}
3939
>
4040
<div className={styles.action}>{`${typeLabel} ${shannonToCKBFormatter(value)} CKB`}</div>

packages/neuron-ui/src/components/GeneralSetting/index.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,21 @@ import { Stack, Toggle } from 'office-ui-fabric-react'
33
import { useTranslation } from 'react-i18next'
44

55
import { StateWithDispatch } from 'states/stateProvider/reducer'
6-
import { toggleAddressBook, setSkipDataAndType } from 'states/stateProvider/actionCreators'
6+
import { setSkipDataAndType } from 'states/stateProvider/actionCreators'
77

88
const GeneralSetting = ({
99
settings: {
10-
general: { showAddressBook, skipDataAndType },
10+
general: { skipDataAndType },
1111
},
1212
dispatch,
1313
}: React.PropsWithoutRef<StateWithDispatch>) => {
1414
const [t] = useTranslation()
15-
const [onToggleAddressVisibility, onSetSkipDataAndType] = useMemo(
16-
() => [() => dispatch(toggleAddressBook()), () => setSkipDataAndType(!skipDataAndType)(dispatch)],
17-
[dispatch, skipDataAndType]
18-
)
15+
const [onSetSkipDataAndType] = useMemo(() => [() => setSkipDataAndType(!skipDataAndType)(dispatch)], [
16+
dispatch,
17+
skipDataAndType,
18+
])
1919
return (
2020
<Stack tokens={{ childrenGap: 15 }}>
21-
<Toggle
22-
checked={showAddressBook}
23-
label={t('settings.general.display-address-book-in-the-navbar')}
24-
onText={t('common.toggle.on')}
25-
offText={t('common.toggle.off')}
26-
onChange={onToggleAddressVisibility}
27-
/>
2821
<Toggle
2922
checked={skipDataAndType}
3023
label={t('settings.general.skip-data-and-type')}

packages/neuron-ui/src/components/Overview/index.tsx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,31 +123,35 @@ const Overview = ({
123123
let { status } = item
124124
if (item.blockNumber !== undefined) {
125125
const confirmationCount =
126-
item.blockNumber === undefined ? 0 : 1 + Math.max(+syncedBlockNumber, +tipBlockNumber) - +item.blockNumber
126+
item.blockNumber === null || item.status === 'failed'
127+
? 0
128+
: 1 + Math.max(+syncedBlockNumber, +tipBlockNumber) - +item.blockNumber
127129

128130
if (status === 'success' && confirmationCount < CONFIRMATION_THRESHOLD) {
129131
status = 'pending'
132+
133+
if (confirmationCount === 1) {
134+
confirmations = t('overview.confirmation', {
135+
confirmationCount: localNumberFormatter(confirmationCount),
136+
threshold: CONFIRMATION_THRESHOLD,
137+
})
138+
} else if (confirmationCount > 1) {
139+
confirmations = `${t('overview.confirmations', {
140+
confirmationCount: localNumberFormatter(confirmationCount),
141+
threshold: CONFIRMATION_THRESHOLD,
142+
})}`
143+
}
130144
}
131145

132146
typeLabel = genTypeLabel(item.type, confirmationCount, status)
133-
134-
if (confirmationCount === 1) {
135-
confirmations = t('overview.confirmation', {
136-
confirmationCount: localNumberFormatter(confirmationCount),
137-
})
138-
} else if (confirmationCount > 1) {
139-
confirmations = `${t('overview.confirmations', {
140-
confirmationCount: localNumberFormatter(confirmationCount),
141-
})}`
142-
}
143147
}
144148

145149
return {
146150
...item,
147151
status,
148152
statusLabel: t(`overview.statusLabel.${status}`),
149153
value: item.value.replace(/^-/, ''),
150-
confirmations: ['success', 'pending'].includes(item.status) ? confirmations : '',
154+
confirmations,
151155
typeLabel: t(`overview.${typeLabel}`),
152156
}
153157
}),

packages/neuron-ui/src/components/Send/hooks.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ const clear = (dispatch: StateDispatch) => {
168168
const useClear = (dispatch: StateDispatch) => useCallback(() => clear(dispatch), [dispatch])
169169

170170
export const useInitialize = (
171+
walletID: string,
171172
items: TransactionOutput[],
172173
generatedTx: any | null,
173174
dispatch: React.Dispatch<any>,
@@ -187,6 +188,10 @@ export const useInitialize = (
187188
const onSubmit = useOnSubmit(items, dispatch)
188189
const onClear = useClear(dispatch)
189190

191+
useEffect(() => {
192+
clear(dispatch)
193+
}, [walletID, dispatch])
194+
190195
const onGetAddressErrorMessage = useCallback(
191196
(addr: string) => {
192197
if (addr === '') {

packages/neuron-ui/src/components/Send/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const Send = ({
5757
onGetAddressErrorMessage,
5858
onGetAmountErrorMessage,
5959
onClear,
60-
} = useInitialize(send.outputs, send.generatedTx, dispatch, t)
60+
} = useInitialize(walletID, send.outputs, send.generatedTx, dispatch, t)
6161
useOnTransactionChange(walletID, send.outputs, send.price, dispatch, setIsTransactionValid, setTotalAmount)
6262
const leftStackWidth = '70%'
6363
const labelWidth = '140px'
@@ -232,7 +232,7 @@ const Send = ({
232232
<PrimaryButton
233233
type="submit"
234234
onClick={onSubmit(walletID)}
235-
disabled={sending || !isTransactionValid || !isAffordable}
235+
disabled={sending || !isTransactionValid || !isAffordable || !send.generatedTx}
236236
text={t('send.send')}
237237
/>
238238
)}

0 commit comments

Comments
 (0)