Skip to content

Commit 5b82943

Browse files
authored
Merge pull request #985 from nervosnetwork/rc/v0.22.1
[ᚬmaster] Rc/v0.22.1
2 parents d7ead83 + a31d606 commit 5b82943

File tree

52 files changed

+530
-175
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

+530
-175
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## [0.22.1](https://github.com/nervosnetwork/neuron/compare/v0.22.0...v0.22.1) (2019-10-15)
2+
3+
4+
### Bug Fixes
5+
6+
* not sync after switch network ([be5a014](https://github.com/nervosnetwork/neuron/commit/be5a014))
7+
* **neuron-ui:** fix the type of script.args from string[] to string ([aa34515](https://github.com/nervosnetwork/neuron/commit/aa34515))
8+
9+
10+
### Features
11+
12+
* **neuron-ui:** add loading effects on creating/import wallets ([8508965](https://github.com/nervosnetwork/neuron/commit/8508965))
13+
* **neuron-ui:** add loading on creating networks ([8b89b1e](https://github.com/nervosnetwork/neuron/commit/8b89b1e))
14+
* **neuron-ui:** dismiss pinned top alert if it's related to auto-dismissed notifications ([b1ea6d5](https://github.com/nervosnetwork/neuron/commit/b1ea6d5))
15+
* **neuron-ui:** make the alert of lacking remote module more clear ([a36abba](https://github.com/nervosnetwork/neuron/commit/a36abba))
16+
* **neuron-ui:** remove eslint rule of no-bitwise ([c5c5101](https://github.com/nervosnetwork/neuron/commit/c5c5101))
17+
* **neuron-ui:** update loading style of submit button for importing/creating wallets ([7469911](https://github.com/nervosnetwork/neuron/commit/7469911))
18+
* **neuron-ui:** update the epoch index ([7599cb7](https://github.com/nervosnetwork/neuron/commit/7599cb7))
19+
* add lock to input ([436b388](https://github.com/nervosnetwork/neuron/commit/436b388))
20+
21+
22+
123
# [0.22.0](https://github.com/nervosnetwork/neuron/compare/v0.21.0-beta.1...v0.22.0) (2019-10-09)
224

325

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.22.0",
5+
"version": "0.22.1",
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.22.0",
5+
"version": "0.22.1",
66
"private": true,
77
"author": {
88
"name": "Nervos Core Dev",

packages/neuron-ui/.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ module.exports = {
7272
"no-alert": [0],
7373
"no-console": [2, {
7474
"allow": ["info", "warn", "error", "group", "groupEnd"]
75-
}]
75+
}],
76+
"no-bitwise": [0]
7677
},
7778
"env": {
7879
"jest": true,

packages/neuron-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "neuron-ui",
3-
"version": "0.22.0",
3+
"version": "0.22.1",
44
"private": true,
55
"author": {
66
"name": "Nervos Core Dev",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState, useEffect } from 'react'
22
import { updateTransactionList } from 'states/stateProvider/actionCreators/transactions'
3-
import { queryParsers } from 'utils/parser'
3+
import { queryParsers } from 'utils/parsers'
44
import { backToTop } from 'utils/animations'
55

66
export const useSearch = (search: string = '', walletID: string = '', dispatch: React.Dispatch<any>) => {

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

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState, useCallback, useMemo, useEffect } from 'react'
22
import { RouteComponentProps } from 'react-router-dom'
3-
import { Stack, DefaultButton, PrimaryButton, TextField } from 'office-ui-fabric-react'
3+
import { Stack, DefaultButton, PrimaryButton, TextField, Spinner } from 'office-ui-fabric-react'
44
import { useTranslation } from 'react-i18next'
55
import { showOpenDialog } from 'services/remote'
66
import { importWalletWithKeystore } from 'states/stateProvider/actionCreators'
@@ -29,6 +29,7 @@ const ImportKeystore = (props: React.PropsWithoutRef<StateWithDispatch & RouteCo
2929
settings: { wallets },
3030
} = props
3131
const [fields, setFields] = useState(defaultFields)
32+
const [loading, setLoading] = useState(false)
3233
const goBack = useGoBack(history)
3334

3435
useEffect(() => {
@@ -66,12 +67,18 @@ const ImportKeystore = (props: React.PropsWithoutRef<StateWithDispatch & RouteCo
6667
}, [fields])
6768

6869
const onSubmit = useCallback(() => {
69-
importWalletWithKeystore({
70-
name: fields.name || '',
71-
keystorePath: fields.path,
72-
password: fields.password,
73-
})(dispatch, history)
74-
}, [fields.name, fields.password, fields.path, history, dispatch])
70+
if (loading) {
71+
return
72+
}
73+
setLoading(true)
74+
setTimeout(() => {
75+
importWalletWithKeystore({
76+
name: fields.name || '',
77+
keystorePath: fields.path,
78+
password: fields.password,
79+
})(dispatch, history).finally(() => setLoading(false))
80+
}, 200)
81+
}, [fields.name, fields.password, fields.path, history, dispatch, loading])
7582

7683
return (
7784
<Stack verticalFill verticalAlign="center" tokens={{ childrenGap: 15 }}>
@@ -117,9 +124,15 @@ const ImportKeystore = (props: React.PropsWithoutRef<StateWithDispatch & RouteCo
117124
</Stack>
118125
<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: 15 }}>
119126
<DefaultButton onClick={goBack}>{t('import-keystore.button.back')}</DefaultButton>
120-
<PrimaryButton disabled={!(fields.name && fields.path && fields.password && !isNameUsed)} onClick={onSubmit}>
121-
{t('import-keystore.button.submit')}
122-
</PrimaryButton>
127+
{loading ? (
128+
<PrimaryButton disabled>
129+
<Spinner />
130+
</PrimaryButton>
131+
) : (
132+
<PrimaryButton disabled={!(fields.name && fields.path && fields.password && !isNameUsed)} onClick={onSubmit}>
133+
{t('import-keystore.button.submit')}
134+
</PrimaryButton>
135+
)}
123136
</Stack>
124137
</Stack>
125138
)

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { updateTransactionList } from 'states/stateProvider/actionCreators'
2626
import { showTransactionDetails } from 'services/remote'
2727

2828
import { localNumberFormatter, shannonToCKBFormatter, uniformTimeFormatter as timeFormatter } from 'utils/formatters'
29+
import { epochParser } from 'utils/parsers'
2930
import { PAGE_SIZE, Routes, CONFIRMATION_THRESHOLD } from 'utils/const'
3031
import { backToTop } from 'utils/animations'
3132

@@ -250,7 +251,7 @@ const Overview = ({
250251
},
251252
{
252253
label: t('overview.epoch'),
253-
value: epoch,
254+
value: epochParser(epoch).index,
254255
},
255256
{
256257
label: t('overview.difficulty'),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const Transaction = () => {
9595
return null
9696
}
9797
try {
98-
const address = ckbCore.utils.bech32Address(output.lock.args[0], {
98+
const address = ckbCore.utils.bech32Address(output.lock.args, {
9999
prefix: addressPrefix,
100100
type: ckbCore.utils.AddressType.HashIdx,
101101
codeHashIndex: '0x00',

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

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useEffect, useMemo } from 'react'
1+
import React, { useState, useCallback, useEffect, useMemo } from 'react'
22
import { useTranslation } from 'react-i18next'
33
import {
44
Stack,
@@ -10,6 +10,7 @@ import {
1010
DefaultButton,
1111
TextField,
1212
FontSizes,
13+
Spinner,
1314
} from 'office-ui-fabric-react'
1415

1516
import withWizard, { WizardElementProps, WithWizardState } from 'components/withWizard'
@@ -224,9 +225,13 @@ const Submission = ({
224225
}: WizardElementProps<{ type: string }>) => {
225226
const { name, password, confirmPassword, imported } = state
226227
const [t] = useTranslation()
228+
const [loading, setLoading] = useState(false)
227229
const message = 'wizard.set-wallet-name-and-password'
228230

229231
useEffect(() => {
232+
if (loading) {
233+
return
234+
}
230235
dispatch({
231236
type: 'name',
232237
payload: generateWalletName(wallets, wallets.length + 1, t),
@@ -239,7 +244,7 @@ const Submission = ({
239244
type: 'confirmPassword',
240245
payload: '',
241246
})
242-
}, [dispatch, wallets, t])
247+
}, [loading, dispatch, wallets, t])
243248

244249
const onChange = useCallback(
245250
(e: any, value?: string) => {
@@ -258,17 +263,23 @@ const Submission = ({
258263
)
259264

260265
const onNext = useCallback(() => {
266+
if (loading) {
267+
return
268+
}
261269
const p = {
262270
name,
263271
password,
264272
mnemonic: imported,
265273
}
266-
if (type === MnemonicAction.Create) {
267-
createWalletWithMnemonic(p)(dispatch, history)
268-
} else {
269-
importWalletWithMnemonic(p)(dispatch, history)
270-
}
271-
}, [type, name, password, imported, history, dispatch])
274+
setLoading(true)
275+
setTimeout(() => {
276+
if (type === MnemonicAction.Create) {
277+
createWalletWithMnemonic(p)(dispatch, history).finally(() => setLoading(false))
278+
} else {
279+
importWalletWithMnemonic(p)(dispatch, history).finally(() => setLoading(false))
280+
}
281+
}, 0)
282+
}, [type, name, password, imported, history, dispatch, loading])
272283

273284
const isNameUnused = useMemo(() => name && !wallets.find(w => w.name === name), [name, wallets])
274285
const isPwdComplex = useMemo(() => verifyPasswordComplexity(password) === true, [password])
@@ -310,7 +321,13 @@ const Submission = ({
310321

311322
<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: 10 }}>
312323
<DefaultButton onClick={history.goBack} text={t('wizard.back')} />
313-
<PrimaryButton type="submit" onClick={onNext} disabled={disableNext} text={t('wizard.next')} />
324+
{loading ? (
325+
<PrimaryButton disabled>
326+
<Spinner />
327+
</PrimaryButton>
328+
) : (
329+
<PrimaryButton type="submit" onClick={onNext} disabled={disableNext} text={t('wizard.next')} />
330+
)}
314331
</Stack>
315332
</Stack>
316333
)

0 commit comments

Comments
 (0)