Skip to content

Commit 9fea146

Browse files
authored
Merge pull request #666 from nervosnetwork/rc/v0.1.0-alpha.8
[ᚬmaster] Release v0.1.0 alpha.8
2 parents 3b0b5cd + 6638899 commit 9fea146

File tree

41 files changed

+801
-350
lines changed

Some content is hidden

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

41 files changed

+801
-350
lines changed

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.1.0-alpha.7",
5+
"version": "0.1.0-alpha.8",
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": "@nervosnetwork/neuron",
33
"productName": "Neuron",
44
"description": "CKB Neuron Wallet",
5-
"version": "0.1.0-alpha.7",
5+
"version": "0.1.0-alpha.8",
66
"private": true,
77
"author": {
88
"name": "Nervos Core Dev",

packages/neuron-ui/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nervosnetwork/neuron-ui",
3-
"version": "0.1.0-alpha.7",
3+
"version": "0.1.0-alpha.8",
44
"private": true,
55
"author": {
66
"name": "Nervos Core Dev",
@@ -42,6 +42,7 @@
4242
"@nervosnetwork/ckb-sdk-core": "0.15.1",
4343
"@uifabric/experiments": "7.4.2",
4444
"@uifabric/styling": "7.1.1",
45+
"canvg": "2.0.0",
4546
"grommet-icons": "4.2.0",
4647
"i18next": "15.1.3",
4748
"office-ui-fabric-react": "7.6.1",

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { appCalls } from 'services/UILayer'
1717

1818
import { useLocalDescription } from 'utils/hooks'
1919
import { MIN_CELL_WIDTH, Routes } from 'utils/const'
20+
import { shannonToCKBFormatter } from 'utils/formatters'
2021

2122
const Addresses = ({
2223
wallet: { id, addresses = [] },
@@ -77,6 +78,16 @@ const Addresses = ({
7778
maxWidth: 450,
7879
isResizable: true,
7980
isCollapsible: false,
81+
onRender: (item?: State.Address) => {
82+
if (item) {
83+
return (
84+
<span className="text-overflow" title={item.address}>
85+
{item.address}
86+
</span>
87+
)
88+
}
89+
return '-'
90+
},
8091
},
8192
{
8293
name: 'addresses.description',
@@ -118,6 +129,16 @@ const Addresses = ({
118129
maxWidth: 250,
119130
isResizable: true,
120131
isCollapsible: false,
132+
onRender: (item?: State.Address) => {
133+
if (item) {
134+
return (
135+
<span title={`${item.balance} shannon`} className="text-overflow">
136+
{`${shannonToCKBFormatter(item.balance)} CKB`}
137+
</span>
138+
)
139+
}
140+
return '-'
141+
},
121142
},
122143
{
123144
name: 'addresses.transactions',
@@ -127,6 +148,12 @@ const Addresses = ({
127148
maxWidth: 150,
128149
isResizable: true,
129150
isCollapsible: false,
151+
onRender: (item?: State.Address) => {
152+
if (item) {
153+
return (+item.txCount).toLocaleString()
154+
}
155+
return '-'
156+
},
130157
},
131158
],
132159
[onDescriptionChange, localDescription, onDescriptionFieldBlur, onDescriptionPress, t, semanticColors]
@@ -148,6 +175,10 @@ const Addresses = ({
148175
display: 'flex',
149176
alignItems: 'center',
150177
},
178+
'.text-overflow': {
179+
overflow: 'hidden',
180+
textOverflow: 'ellipsis',
181+
},
151182
},
152183
},
153184
}}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const NetworkSetting = ({
4444
key: network.id,
4545
text: network.name,
4646
checked: chain.networkID === network.id,
47-
disabled: chain.networkID === network.id,
4847
onRenderLabel: ({ text }: IChoiceGroupOption) => {
4948
return (
5049
<span className="ms-ChoiceFieldLabel" onContextMenu={onContextMenu(network.id)}>

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

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
import { StateWithDispatch } from 'states/stateProvider/reducer'
1919
import actionCreators from 'states/stateProvider/actionCreators'
2020

21-
import { localNumberFormatter } from 'utils/formatters'
21+
import { localNumberFormatter, shannonToCKBFormatter } from 'utils/formatters'
2222
import { PAGE_SIZE, MIN_CELL_WIDTH } from 'utils/const'
2323

2424
const timeFormatter = new Intl.DateTimeFormat(undefined, {
@@ -155,7 +155,14 @@ const Overview = ({
155155
{
156156
key: 'value',
157157
name: t('overview.amount'),
158+
title: 'value',
158159
minWidth: 2 * MIN_CELL_WIDTH,
160+
onRender: (item?: State.Transaction) => {
161+
if (item) {
162+
return <span title={`${item.value} shannon`}>{`${shannonToCKBFormatter(item.value)} CKB`}</span>
163+
}
164+
return '-'
165+
},
159166
},
160167
].map(
161168
(col): IColumn => ({
@@ -193,7 +200,10 @@ const Overview = ({
193200

194201
const balanceItems = useMemo(
195202
() => [
196-
{ label: t('overview.amount'), value: balance },
203+
{
204+
label: t('overview.amount'),
205+
value: <span title={`${balance} shannon`}>{`${shannonToCKBFormatter(balance)} CKB`}</span>,
206+
},
197207
{ label: t('overview.live-cells'), value: 'mock living cells' },
198208
{ label: t('overview.cell-types'), value: 'mock cell typ' },
199209
],
@@ -212,8 +222,17 @@ const Overview = ({
212222
)
213223

214224
return (
215-
<Stack horizontal horizontalAlign="space-evenly" verticalFill tokens={{ childrenGap: 15 }}>
216-
<Stack tokens={{ childrenGap: 15 }}>
225+
<Stack horizontal horizontalAlign="space-evenly" verticalFill tokens={{ childrenGap: 15 }} wrap>
226+
<Stack
227+
tokens={{
228+
childrenGap: 15,
229+
}}
230+
styles={{
231+
root: {
232+
minWidth: '680px',
233+
},
234+
}}
235+
>
217236
<Stack>
218237
<Text as="h1" variant={TITLE_FONT_SIZE}>
219238
{t('overview.balance')}
@@ -229,7 +248,14 @@ const Overview = ({
229248
) : null}
230249
</Stack.Item>
231250
</Stack>
232-
<Stack horizontalAlign="stretch">
251+
<Stack
252+
horizontalAlign="stretch"
253+
styles={{
254+
root: {
255+
minWidth: '680px',
256+
},
257+
}}
258+
>
233259
<Text as="h1" variant={TITLE_FONT_SIZE}>
234260
{t('overview.recent-activities')}
235261
</Text>

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

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
import React, { useState, useCallback, useMemo } from 'react'
22
import { RouteComponentProps } from 'react-router-dom'
33
import { useTranslation } from 'react-i18next'
4-
import { Stack, Text, TextField, TooltipHost, Modal } from 'office-ui-fabric-react'
4+
import { Stack, Text, TextField, TooltipHost, Modal, FontSizes } from 'office-ui-fabric-react'
55

66
import { StateWithDispatch } from 'states/stateProvider/reducer'
77
import QRCode from 'widgets/QRCode'
88
import { Copy } from 'grommet-icons'
99

10-
declare global {
11-
interface Window {
12-
clipboard: any
13-
}
14-
}
15-
1610
const Receive = ({
1711
wallet: { addresses = [] },
1812
match: { params },
@@ -37,24 +31,35 @@ const Receive = ({
3731
}
3832

3933
return (
40-
<Stack tokens={{ childrenGap: 15 }} horizontalAlign="center">
41-
<Stack onClick={() => setShowLargeQRCode(true)} style={{ alignSelf: 'center' }}>
42-
<QRCode value={accountAddress} size={256} />
43-
</Stack>
44-
<Stack styles={{ root: { maxWidth: 500 } }}>
45-
<TooltipHost content={t('receive.click-to-copy')} calloutProps={{ gapSpace: 0 }}>
46-
<Stack horizontal horizontalAlign="stretch" tokens={{ childrenGap: 15 }}>
47-
<TextField
48-
styles={{ root: { flex: 1 } }}
49-
readOnly
50-
placeholder={accountAddress}
51-
onClick={copyAddress}
52-
description={t('receive.prompt')}
53-
/>
54-
<Copy onClick={copyAddress} />
55-
</Stack>
56-
</TooltipHost>
34+
<>
35+
<Stack horizontal tokens={{ childrenGap: 40 }} padding="20px 0 0 0 " horizontalAlign="space-between">
36+
<Stack styles={{ root: { flex: 1 } }}>
37+
<TooltipHost content={t('receive.click-to-copy')} calloutProps={{ gapSpace: 0 }}>
38+
<Stack horizontal horizontalAlign="stretch" tokens={{ childrenGap: 15 }}>
39+
<TextField
40+
styles={{
41+
root: {
42+
flex: 1,
43+
},
44+
description: {
45+
fontSize: FontSizes.medium,
46+
},
47+
}}
48+
readOnly
49+
placeholder={accountAddress}
50+
onClick={copyAddress}
51+
description={t('receive.prompt')}
52+
/>
53+
<Copy onClick={copyAddress} />
54+
</Stack>
55+
</TooltipHost>
56+
</Stack>
57+
58+
<Stack style={{ alignSelf: 'center' }}>
59+
<QRCode value={accountAddress} onQRCodeClick={() => setShowLargeQRCode(true)} size={256} exportable />
60+
</Stack>
5761
</Stack>
62+
5863
<Modal isOpen={showLargeQRCode} onDismiss={() => setShowLargeQRCode(false)}>
5964
<Stack
6065
styles={{
@@ -77,7 +82,7 @@ const Receive = ({
7782
<QRCode value={accountAddress} size={400} />
7883
</Stack>
7984
</Modal>
80-
</Stack>
85+
</>
8186
)
8287
}
8388

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { StateWithDispatch } from 'states/stateProvider/reducer'
2020
import appState from 'states/initStates/app'
2121

2222
import { PlaceHolders, CapacityUnit } from 'utils/const'
23+
import { shannonToCKBFormatter } from 'utils/formatters'
2324

2425
import { useInitialize } from './hooks'
2526

@@ -143,7 +144,7 @@ const Send = ({
143144

144145
<TransactionFeePanel fee="10" cycles="10" price={send.price} onPriceChange={updateTransactionPrice} />
145146

146-
<div>{`${t('send.balance')}: ${balance}`}</div>
147+
<div>{`${t('send.balance')}: ${shannonToCKBFormatter(balance)} CKB`}</div>
147148

148149
<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: 20 }}>
149150
<DefaultButton type="reset" onClick={onClear}>

0 commit comments

Comments
 (0)