Skip to content

Commit 9766f02

Browse files
authored
Merge pull request #591 from nervosnetwork/rc/v0.1.0-alpha.1
[ᚬmaster] Rc/v0.1.0 alpha.1
2 parents 79bd500 + 6febfc5 commit 9766f02

File tree

143 files changed

+3388
-3457
lines changed

Some content is hidden

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

143 files changed

+3388
-3457
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ cache:
1919
- yarn
2020

2121
before_install:
22-
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
23-
- export PATH=$HOME/.yarn/bin:$PATH
22+
# - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.13.0
23+
# - export PATH=$HOME/.yarn/bin:$PATH
2424
- yarn global add lerna
2525

2626
install:

azure-pipelines.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ trigger:
44
include:
55
- master
66
- develop
7+
- e2e-tests
78
- rc/*
9+
tags:
10+
include:
11+
- '*'
812

913
pr:
1014
autoCancel: true
@@ -87,3 +91,69 @@ jobs:
8791
set CI=true
8892
yarn test
8993
name: Test
94+
95+
- job: Integration
96+
condition: |
97+
or(
98+
eq(variables['build.sourceBranch'], 'refs/heads/e2e-tests'),
99+
startsWith(variables['Build.SourceBranch'], 'refs/heads/rc/')
100+
)
101+
pool:
102+
vmImage: 'macos-10.14'
103+
steps:
104+
- task: NodeTool@0
105+
inputs:
106+
versionSpec: 12.x
107+
displayName: 'Install Node.js'
108+
- script: yarn global add lerna
109+
name: Install
110+
- script: yarn bootstrap
111+
name: Bootstrap
112+
- script: yarn test:e2e
113+
name: Test
114+
115+
- job: Package
116+
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
117+
pool:
118+
vmImage: 'macos-10.14'
119+
steps:
120+
- task: NodeTool@0
121+
inputs:
122+
versionSpec: 12.x
123+
displayName: 'Install Node.js'
124+
- script: |
125+
yarn global add lerna
126+
yarn bootstrap
127+
- task: DownloadSecureFile@1
128+
name: macSiginingCertificate
129+
displayName: 'Download macOS Signing Certificate'
130+
inputs:
131+
secureFile: Neuron_mac.p12
132+
- task: DownloadSecureFile@1
133+
name: winSiginingCertificate
134+
displayName: 'Download Windows Signing Certificate'
135+
inputs:
136+
secureFile: Neuron_win.p12
137+
- script: yarn package
138+
name: Build
139+
env:
140+
CSC_LINK: $(macSiginingCertificate.secureFilePath)
141+
CSC_KEY_PASSWORD: $(macSiginingCertificatePassword)
142+
CSC_IDENTITY_AUTO_DISCOVERY: false
143+
WIN_CSC_LINK: $(winSiginingCertificate.secureFilePath)
144+
WIN_CSC_KEY_PASSWORD: $(winSiginingCertificatePassword)
145+
WIN_CSC_IDENTITY_AUTO_DISCOVERY: false
146+
- task: GitHubRelease@0
147+
inputs:
148+
gitHubConnection: nervos-bot
149+
repositoryName: nervosnetwork/neuron
150+
action: edit
151+
tag: $(Build.SourceBranchName)
152+
assets: |
153+
$(Build.ArtifactStagingDirectory)/release/*.zip
154+
$(Build.ArtifactStagingDirectory)/release/*.exe
155+
$(Build.ArtifactStagingDirectory)/release/*.deb
156+
$(Build.ArtifactStagingDirectory)/release/*.AppImage
157+
assetUploadMode: replace
158+
isPreRelease: true
159+
addChangeLog: false

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.0",
5+
"version": "0.1.0-alpha.1",
66
"npmClient": "yarn",
77
"useWorkspaces": true
88
}

package.json

Lines changed: 7 additions & 4 deletions
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.0",
5+
"version": "0.1.0-alpha.1",
66
"private": true,
77
"author": {
88
"name": "Nervos Core Dev",
@@ -20,12 +20,14 @@
2020
"scripts": {
2121
"bootstrap": "lerna bootstrap && lerna link",
2222
"start:ui": "lerna run --scope=@nervosnetwork/neuron-ui start",
23-
"start": "concurrently \"cross-env BROWSER=none yarn run start:ui\" \"wait-on http://localhost:3000 && cd packages/neuron-wallet && yarn run start:dev\"",
23+
"start:wallet": "lerna run --scope=@nervosnetwork/neuron-wallet start:dev",
24+
"start": "concurrently \"cross-env BROWSER=none yarn run start:ui\" \"wait-on http://localhost:3000 && yarn run start:wallet\"",
2425
"clean": "lerna run --stream clean",
2526
"prebuild": "yarn clean",
2627
"build": "lerna run --stream build",
27-
"package": "yarn build && ./packages/neuron-wallet/script/package.sh",
28+
"package": "yarn build && ./scripts/copy-ui-files.sh && ./scripts/package.sh",
2829
"test": "lerna run --parallel test",
30+
"test:e2e": "yarn build && ./scripts/copy-ui-files.sh && lerna run --parallel test:e2e",
2931
"lint": "lerna run --stream lint",
3032
"postinstall": "lerna run rebuild:nativemodules",
3133
"db:migrate": "ts-node ./node_modules/.bin/typeorm migration:generate",
@@ -53,10 +55,11 @@
5355
"eslint-plugin-react": "7.13.0",
5456
"husky": "2.3.0",
5557
"lerna": "3.15.0",
58+
"ncp": "2.0.0",
5659
"nodemon": "1.19.1",
5760
"prettier": "1.17.1",
5861
"ts-jest": "24.0.2",
59-
"typescript": "3.5.1",
62+
"typescript": "3.5.2",
6063
"wait-on": "3.2.0"
6164
},
6265
"dependencies": {},

packages/neuron-ui/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nervosnetwork/neuron-ui",
3-
"version": "0.1.0-alpha.0",
3+
"version": "0.1.0-alpha.1",
44
"private": true,
55
"author": {
66
"name": "Nervos Core Dev",
@@ -31,15 +31,14 @@
3131
]
3232
},
3333
"jest": {
34-
"displayName": "Neuron UI"
34+
"displayName": "UI Tests"
3535
},
3636
"browserslist": [
3737
"last 2 chrome versions"
3838
],
3939
"dependencies": {
4040
"bootstrap": "4.3.1",
4141
"grommet-icons": "4.2.0",
42-
"history": "4.9.0",
4342
"i18next": "15.1.3",
4443
"office-ui-fabric-react": "7.6.1",
4544
"qr.js": "0.0.0",

packages/neuron-ui/public/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
1212
-->
1313
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
14-
<link rel="stylesheet" href="%PUBLIC_URL%/styles/bootstrap.min.css" />
1514
<!--
1615
Notice the use of %PUBLIC_URL% in the tags above.
1716
It will be replaced with the URL of the `public` folder during the build.
@@ -28,7 +27,7 @@
2827
<header class="header"></header>
2928
<navbar class="navbar"></navbar>
3029
<div id="notification" class="notification"></div>
31-
<div id="root" class="main-content"></div>
30+
<main id="root" class="main-content"></main>
3231
<footer class="footer"></footer>
3332
<div id="dialog" class="dialog"></div>
3433
</body>

packages/neuron-ui/public/styles/bootstrap.min.css

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 59 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,84 @@
11
import React, { useMemo } from 'react'
22
import { useTranslation } from 'react-i18next'
3+
import { DetailsList, IColumn, DetailsListLayoutMode, CheckboxVisibility } from 'office-ui-fabric-react'
4+
5+
import { StateWithDispatch } from 'states/stateProvider/reducer'
36

4-
import Table from 'widgets/Table'
57
import { appCalls } from 'services/UILayer'
6-
import { useNeuronWallet, useLocalDescription } from 'utils/hooks'
7-
import { ContentProps } from 'containers/MainContent'
88

9+
import { useLocalDescription } from 'utils/hooks'
910
import DescriptionField from 'widgets/InlineInput/DescriptionField'
11+
import { MIN_CELL_WIDTH } from 'utils/const'
1012

11-
const headers = [
13+
const addressColumns: IColumn[] = [
1214
{
13-
label: 'addresses.type',
15+
name: 'addresses.type',
1416
key: 'type',
17+
fieldName: 'type',
18+
minWidth: MIN_CELL_WIDTH,
19+
maxWidth: 120,
20+
isResizable: true,
21+
isCollapsible: false,
1522
},
1623
{
17-
label: 'addresses.address',
24+
name: 'addresses.address',
1825
key: 'address',
26+
fieldName: 'address',
27+
className: 'fixedWidth',
28+
minWidth: MIN_CELL_WIDTH,
29+
maxWidth: 450,
30+
isResizable: true,
31+
isCollapsible: false,
1932
},
2033
{
21-
label: 'addresses.identifier',
22-
key: 'identifier',
23-
},
24-
{
25-
label: 'addresses.description',
34+
name: 'addresses.description',
2635
key: 'description',
36+
fieldName: 'description',
37+
minWidth: MIN_CELL_WIDTH,
38+
maxWidth: 350,
39+
isResizable: true,
40+
isCollapsible: false,
2741
},
2842
{
29-
label: 'addresses.balance',
43+
name: 'addresses.balance',
3044
key: 'balance',
45+
fieldName: 'balance',
46+
minWidth: MIN_CELL_WIDTH,
47+
maxWidth: 250,
48+
isResizable: true,
49+
isCollapsible: false,
3150
},
3251
{
33-
label: 'addresses.transactions',
52+
name: 'addresses.transactions',
3453
key: 'transactions',
54+
fieldName: 'transactions',
55+
minWidth: MIN_CELL_WIDTH,
56+
maxWidth: 150,
57+
isResizable: true,
58+
isCollapsible: false,
3559
},
3660
]
3761

38-
const onPageChange = () => {}
39-
40-
const Addresses = ({ dispatch }: React.PropsWithoutRef<ContentProps>) => {
41-
const {
42-
wallet: { addresses },
43-
} = useNeuronWallet()
62+
const Addresses = ({ dispatch, wallet: { addresses = [] } }: React.PropsWithoutRef<StateWithDispatch>) => {
4463
const [t] = useTranslation()
4564

4665
const { localDescription, onDescriptionPress, onDescriptionFieldBlur, onDescriptionChange } = useLocalDescription(
4766
'address',
48-
addresses.map(({ address: key, description }) => ({
49-
key,
50-
description,
51-
})),
67+
useMemo(
68+
() =>
69+
addresses.map(({ address: key, description }) => ({
70+
key,
71+
description,
72+
})),
73+
[addresses]
74+
),
5275
dispatch
5376
)
5477

5578
const addressesItems = useMemo(
5679
() =>
5780
addresses.map(({ type, identifier, address, txCount, balance, description }, idx) => ({
81+
key: identifier,
5882
type: type === 0 ? t('addresses.receiving-address') : t('addresses.change-address'),
5983
address,
6084
identifier,
@@ -66,37 +90,28 @@ const Addresses = ({ dispatch }: React.PropsWithoutRef<ContentProps>) => {
6690
onKeyPress={onDescriptionPress(idx)}
6791
onBlur={onDescriptionFieldBlur(idx)}
6892
onChange={onDescriptionChange(idx)}
69-
maxLength={100}
93+
maxLength={300}
7094
/>
7195
),
7296
balance,
7397
transactions: txCount,
74-
key: identifier,
7598
})),
7699
[addresses, onDescriptionChange, localDescription, onDescriptionFieldBlur, onDescriptionPress, t]
77100
)
78101

79102
return (
80-
<>
81-
<h2>{t('addresses.addresses')}</h2>
82-
<Table
83-
headers={headers.map(header => ({
84-
...header,
85-
label: t(header.label),
86-
}))}
87-
items={addressesItems}
88-
pageNo={0}
89-
pageSize={addressesItems.length}
90-
totalCount={addressesItems.length}
91-
onPageChange={onPageChange}
92-
tableAttrs={{
93-
bordered: false,
94-
striped: true,
95-
}}
96-
onContextMenu={(key: string) => () => appCalls.contextMenu({ type: 'addressList', id: key })}
97-
/>
98-
</>
103+
<DetailsList
104+
checkboxVisibility={CheckboxVisibility.hidden}
105+
layoutMode={DetailsListLayoutMode.justified}
106+
columns={addressColumns.map(col => ({ ...col, name: t(col.name) }))}
107+
items={addressesItems}
108+
onItemContextMenu={item => {
109+
appCalls.contextMenu({ type: 'addressList', id: item.key })
110+
}}
111+
/>
99112
)
100113
}
101114

115+
Addresses.displayName = 'Addresses'
116+
102117
export default Addresses

packages/neuron-ui/src/components/App/index.test.tsx

Lines changed: 0 additions & 7 deletions
This file was deleted.

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

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)