Skip to content

Commit 3352ca5

Browse files
authored
Merge pull request #635 from nervosnetwork/rc/0.1.0-alpha.4
[ᚬmaster] Rc/0.1.0 alpha.4
2 parents 8c8b222 + 09e0a05 commit 3352ca5

File tree

39 files changed

+3114
-326
lines changed

39 files changed

+3114
-326
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ jobs:
148148
tag: $(Build.SourceBranchName)
149149
assets: |
150150
$(Build.SourcesDirectory)/release/*.zip
151+
$(Build.SourcesDirectory)/release/*.dmg
151152
$(Build.SourcesDirectory)/release/*.exe
152153
$(Build.SourcesDirectory)/release/*.deb
153154
$(Build.SourcesDirectory)/release/*.AppImage

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.3",
5+
"version": "0.1.0-alpha.4",
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.3",
5+
"version": "0.1.0-alpha.4",
66
"private": true,
77
"author": {
88
"name": "Nervos Core Dev",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import '@storybook/addon-actions/register'
2+
import '@storybook/addon-links/register'
3+
import '@storybook/addon-viewport/register'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {
2+
configure
3+
} from '@storybook/react'
4+
5+
function loadStories() {
6+
require('../src/stories')
7+
}
8+
9+
configure(loadStories, module)

packages/neuron-ui/package.json

Lines changed: 14 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.3",
3+
"version": "0.1.0-alpha.4",
44
"private": true,
55
"author": {
66
"name": "Nervos Core Dev",
@@ -16,7 +16,9 @@
1616
"test": "react-app-rewired test --env=jsdom --color --watchAll=false",
1717
"build": "react-app-rewired build",
1818
"clean": "rimraf build/*",
19-
"precommit": "lint-staged"
19+
"precommit": "lint-staged",
20+
"storybook": "start-storybook -p 9009 -s public",
21+
"build-storybook": "build-storybook -s public"
2022
},
2123
"publishConfig": {
2224
"registry": "https://registry.npmjs.org/"
@@ -52,12 +54,20 @@
5254
"styled-components": "5.0.0-beta.0"
5355
},
5456
"devDependencies": {
57+
"@storybook/addon-actions": "5.1.9",
58+
"@storybook/addon-links": "5.1.9",
59+
"@storybook/addon-viewport": "5.1.9",
60+
"@storybook/addons": "5.1.9",
61+
"@storybook/cli": "5.1.9",
62+
"@storybook/react": "5.1.9",
5563
"@types/enzyme": "3.9.3",
5664
"@types/enzyme-adapter-react-16": "1.0.5",
5765
"@types/node": "11.13.5",
5866
"@types/react": "16.8.19",
5967
"@types/react-dom": "16.8.4",
6068
"@types/react-router-dom": "4.3.3",
69+
"@types/storybook-react-router": "1.0.0",
70+
"@types/storybook__react": "4.0.2",
6171
"@types/styled-components": "4.1.16",
6272
"babel-jest": "24.8.0",
6373
"enzyme": "3.9.0",
@@ -67,6 +77,7 @@
6777
"lint-staged": "8.1.7",
6878
"node-sass": "4.12.0",
6979
"react-app-rewired": "2.1.3",
70-
"rimraf": "2.6.3"
80+
"rimraf": "2.6.3",
81+
"storybook-react-router": "1.0.5"
7182
}
7283
}

packages/neuron-ui/public/icon.png

47.3 KB
Loading

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

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
import React, { useEffect, useMemo } from 'react'
22
import { RouteComponentProps } from 'react-router-dom'
33
import { useTranslation } from 'react-i18next'
4-
import { DetailsList, TextField, IColumn, DetailsListLayoutMode, CheckboxVisibility } from 'office-ui-fabric-react'
4+
import {
5+
DetailsList,
6+
TextField,
7+
IColumn,
8+
DetailsListLayoutMode,
9+
CheckboxVisibility,
10+
ITextFieldStyleProps,
11+
getTheme,
12+
} from 'office-ui-fabric-react'
513

614
import { StateWithDispatch } from 'states/stateProvider/reducer'
715

@@ -37,6 +45,9 @@ const Addresses = ({
3745
dispatch
3846
)
3947

48+
const theme = getTheme()
49+
const { semanticColors } = theme
50+
4051
const addressColumns: IColumn[] = useMemo(
4152
() => [
4253
{
@@ -78,11 +89,23 @@ const Addresses = ({
7889
onRender: (item?: State.Address, idx?: number) => {
7990
return item && undefined !== idx ? (
8091
<TextField
92+
borderless
8193
title={item.description}
8294
value={localDescription[idx] || ''}
8395
onKeyPress={onDescriptionPress(idx)}
8496
onBlur={onDescriptionFieldBlur(idx)}
8597
onChange={onDescriptionChange(idx)}
98+
styles={(props: ITextFieldStyleProps) => {
99+
return {
100+
root: {
101+
flex: 1,
102+
},
103+
fieldGroup: {
104+
borderColor: props.focused ? semanticColors.inputBorder : 'transparent',
105+
border: '1px solid',
106+
},
107+
}
108+
}}
86109
/>
87110
) : null
88111
},
@@ -106,7 +129,7 @@ const Addresses = ({
106129
isCollapsible: false,
107130
},
108131
],
109-
[onDescriptionChange, localDescription, onDescriptionFieldBlur, onDescriptionPress, t]
132+
[onDescriptionChange, localDescription, onDescriptionFieldBlur, onDescriptionPress, t, semanticColors]
110133
)
111134

112135
return (
@@ -118,6 +141,16 @@ const Addresses = ({
118141
onItemContextMenu={item => {
119142
appCalls.contextMenu({ type: 'addressList', id: item.identifier })
120143
}}
144+
styles={{
145+
contentWrapper: {
146+
selectors: {
147+
'.ms-DetailsRow-cell': {
148+
display: 'flex',
149+
alignItems: 'center',
150+
},
151+
},
152+
},
153+
}}
121154
/>
122155
)
123156
}

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useState, useMemo, useEffect } from 'react'
1+
import { useState, useEffect } from 'react'
22
import { AppActions } from 'states/stateProvider/reducer'
33
import actionCreators from 'states/stateProvider/actionCreators'
44
import { queryParsers } from 'utils/parser'
@@ -17,11 +17,10 @@ const backToTop = () => {
1717
export const useSearch = (
1818
search: string = '',
1919
incomingKeywords: string = '',
20-
addresses: { address: string }[] = [],
20+
walletID: string = '',
2121
dispatch: React.Dispatch<any>
2222
) => {
2323
const [keywords, setKeywords] = useState('')
24-
const defaultKeywords = useMemo(() => addresses.map(addr => addr.address).join(','), [addresses])
2524

2625
const onKeywordsChange = (_e?: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => {
2726
if (undefined !== newValue) {
@@ -42,9 +41,9 @@ export const useSearch = (
4241
payload: null,
4342
})
4443

45-
dispatch(actionCreators.getTransactions({ ...params, keywords: params.keywords || defaultKeywords }))
46-
}, [search, dispatch, defaultKeywords])
47-
return { keywords, addresses, onKeywordsChange }
44+
dispatch(actionCreators.getTransactions({ ...params, keywords: params.keywords, walletID }))
45+
}, [search, walletID, dispatch])
46+
return { keywords, onKeywordsChange }
4847
}
4948

5049
export default {

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
import React, { useCallback, useMemo } from 'react'
22
import { NavLink, RouteComponentProps } from 'react-router-dom'
33
import { useTranslation } from 'react-i18next'
4-
import { Stack, SearchBox, DefaultButton } from 'office-ui-fabric-react'
4+
import { Stack, SearchBox, getTheme } from 'office-ui-fabric-react'
55
import { Search as SearchIcon } from 'grommet-icons'
66

77
import TransactionList from 'components/TransactionList'
88
import { StateWithDispatch } from 'states/stateProvider/reducer'
99

1010
import { Routes } from 'utils/const'
11+
import { registerIcons } from 'utils/icons'
1112

1213
import { useSearch } from './hooks'
1314

15+
const theme = getTheme()
16+
const { semanticColors } = theme
17+
registerIcons({
18+
icons: {
19+
Search: <SearchIcon size="16px" color={semanticColors.menuIcon} />,
20+
},
21+
})
22+
1423
const History = ({
15-
wallet: { id, addresses = [] },
24+
wallet: { id },
1625
chain: {
1726
transactions: { pageNo = 1, pageSize = 15, totalCount = 0, items = [], keywords: incomingKeywords = '' },
1827
},
@@ -22,23 +31,21 @@ const History = ({
2231
}: React.PropsWithoutRef<StateWithDispatch & RouteComponentProps>) => {
2332
const [t] = useTranslation()
2433

25-
const { keywords, onKeywordsChange } = useSearch(search, incomingKeywords, addresses, dispatch)
34+
const { keywords, onKeywordsChange } = useSearch(search, incomingKeywords, id, dispatch)
2635
const onSearch = useCallback(() => history.push(`${Routes.History}?keywords=${keywords}`), [history, keywords])
2736
const totalPages = useMemo(() => Math.ceil(totalCount / pageSize) || 1, [totalCount, pageSize])
2837

2938
return (
3039
<Stack>
31-
<Stack horizontal horizontalAlign="start" tokens={{ childrenGap: 15 }}>
40+
<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: 15 }}>
3241
<SearchBox
3342
value={keywords}
3443
styles={{ root: { width: 200 } }}
3544
placeholder="Search"
3645
onChange={onKeywordsChange}
3746
onSearch={onSearch}
47+
iconProps={{ iconName: 'Search', styles: { root: { height: '18px' } } }}
3848
/>
39-
<DefaultButton onClick={onSearch}>
40-
<SearchIcon />
41-
</DefaultButton>
4249
</Stack>
4350
<TransactionList walletID={id} items={items} dispatch={dispatch} />
4451
<div style={{ display: 'flex', justifyContent: 'center' }}>

0 commit comments

Comments
 (0)