Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
500b5c4
chore: bump sdk to v0.19.1
classicalliu Aug 28, 2019
f3fbe15
feat: using keep alive connection
classicalliu Aug 29, 2019
5c11829
refactor: pass url to GetBlocks
classicalliu Aug 29, 2019
6c783e3
Merge pull request #902 from nervosnetwork/enable-keep-alive
ashchan Aug 30, 2019
9fe535b
feat: add hasData and typeScript to output entity
classicalliu Aug 30, 2019
6a85705
feat: skip cells which has data or type
classicalliu Aug 30, 2019
abf8ae9
chore: only spent cells without data or type when gather inputs
classicalliu Aug 30, 2019
e334085
fix: change typeScript type to `text` from `varchar`
classicalliu Aug 30, 2019
a0f9d9d
chore: log error in CatchControllerError
classicalliu Sep 2, 2019
c4cb7e4
fix: network test import
classicalliu Sep 2, 2019
5754a99
Merge pull request #905 from nervosnetwork/add-controller-logger
ashchan Sep 2, 2019
41cf269
chore: Bump eslint and related npm packages
ashchan Sep 3, 2019
baf5ded
Merge pull request #906 from nervosnetwork/bump-eslint-related
ashchan Sep 3, 2019
031fed0
feat: add an edit button by the side of description
Keith-CY Sep 2, 2019
4b765b8
Merge remote-tracking branch 'origin/develop' into skip-data-and-type
classicalliu Sep 3, 2019
6c4ea72
feat(neuron-ui): prevent updating tx and addr list when user is editi…
Keith-CY Sep 3, 2019
a952152
feat: add SkipDataAndType class
classicalliu Sep 3, 2019
5746438
feat: add totalBalance to address entity
classicalliu Sep 3, 2019
4e61a79
Update packages/neuron-ui/src/utils/hooks.ts
Keith-CY Sep 3, 2019
f455545
feat: calculate totalBalance and check skip data and type in gather i…
classicalliu Sep 3, 2019
834390f
feat: add controller for skip data and type
classicalliu Sep 3, 2019
7a29c03
feat: add totalBalance to address interface
classicalliu Sep 3, 2019
c8ce2dd
Merge pull request #904 from Keith-CY/add-edit-btn-in-desc-field
Keith-CY Sep 3, 2019
af4ebcd
test: test cells service
classicalliu Sep 3, 2019
90184aa
fix: add totalBalance to address test
classicalliu Sep 3, 2019
4157306
chore: rename open to skip
classicalliu Sep 3, 2019
11dcac7
fix: fix balance tests
classicalliu Sep 3, 2019
f852449
chore: rename open to skip in controller
classicalliu Sep 3, 2019
0c9d957
refactor: adapt to mainnet in wallet
classicalliu Sep 3, 2019
06362a5
chore: update comment open => skip
classicalliu Sep 3, 2019
1378768
feat(neuron-ui): move the miner info from overview to wallet list (#907)
Keith-CY Sep 4, 2019
244315b
Merge pull request #908 from nervosnetwork/adapt-mainnet-in-wallet
ashchan Sep 4, 2019
37d82fb
feat: add base settings and move skip config to here
classicalliu Sep 4, 2019
05683c6
chore: update comment
classicalliu Sep 4, 2019
8a0bfff
chore: update comment
classicalliu Sep 4, 2019
eea006f
Merge pull request #903 from nervosnetwork/skip-data-and-type
classicalliu Sep 4, 2019
82e7bb4
chore: Bump to 0.19.0-beta.1
classicalliu Sep 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ module.exports = {
"no-console": [2, {
"allow": ["warn", "error", "info"]
}],
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }]
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
"max-classes-per-file": [0]
},
"globals": {
"BigInt": "readonly"
Expand Down
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
# [0.19.0-beta.1](https://github.com/nervosnetwork/neuron/compare/v0.19.0-beta.0...v0.19.0-beta.1) (2019-09-04)


### Bug Fixes

* add totalBalance to address test ([90184aa](https://github.com/nervosnetwork/neuron/commit/90184aa))
* change typeScript type to `text` from `varchar` ([e334085](https://github.com/nervosnetwork/neuron/commit/e334085))
* fix balance tests ([11dcac7](https://github.com/nervosnetwork/neuron/commit/11dcac7))
* network test import ([c4cb7e4](https://github.com/nervosnetwork/neuron/commit/c4cb7e4))


### Features

* add base settings and move skip config to here ([37d82fb](https://github.com/nervosnetwork/neuron/commit/37d82fb))
* **neuron-ui:** move the miner info from overview to wallet list ([#907](https://github.com/nervosnetwork/neuron/issues/907)) ([1378768](https://github.com/nervosnetwork/neuron/commit/1378768))
* add an edit button by the side of description ([031fed0](https://github.com/nervosnetwork/neuron/commit/031fed0))
* add controller for skip data and type ([834390f](https://github.com/nervosnetwork/neuron/commit/834390f))
* add hasData and typeScript to output entity ([9fe535b](https://github.com/nervosnetwork/neuron/commit/9fe535b))
* add SkipDataAndType class ([a952152](https://github.com/nervosnetwork/neuron/commit/a952152))
* add totalBalance to address entity ([5746438](https://github.com/nervosnetwork/neuron/commit/5746438))
* add totalBalance to address interface ([7a29c03](https://github.com/nervosnetwork/neuron/commit/7a29c03))
* calculate totalBalance and check skip data and type in gather inputs ([f455545](https://github.com/nervosnetwork/neuron/commit/f455545))
* **neuron-ui:** prevent updating tx and addr list when user is editing the description ([6c4ea72](https://github.com/nervosnetwork/neuron/commit/6c4ea72))
* skip cells which has data or type ([6a85705](https://github.com/nervosnetwork/neuron/commit/6a85705))
* using keep alive connection ([f3fbe15](https://github.com/nervosnetwork/neuron/commit/f3fbe15))



# [0.19.0-beta.0](https://github.com/nervosnetwork/neuron/compare/v0.18.0-beta.1...v0.19.0-beta.0) (2019-08-29)

### BREAKING CHANGES
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "0.19.0-beta.0",
"version": "0.19.0-beta.1",
"npmClient": "yarn",
"useWorkspaces": true
}
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "neuron",
"productName": "Neuron",
"description": "CKB Neuron Wallet",
"version": "0.19.0-beta.0",
"version": "0.19.0-beta.1",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -44,17 +44,17 @@
},
"devDependencies": {
"@types/jest": "24.0.13",
"@typescript-eslint/eslint-plugin": "2.0.0",
"@typescript-eslint/parser": "2.0.0",
"@typescript-eslint/eslint-plugin": "2.1.0",
"@typescript-eslint/parser": "2.1.0",
"concurrently": "4.1.1",
"cross-env": "5.2.0",
"eslint": "5.16.0",
"eslint-config-airbnb": "17.1.0",
"eslint-config-prettier": "4.3.0",
"eslint-plugin-import": "2.17.3",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint": "6.3.0",
"eslint-config-airbnb": "18.0.1",
"eslint-config-prettier": "6.1.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "3.1.0",
"eslint-plugin-react": "7.13.0",
"eslint-plugin-react": "7.14.3",
"husky": "3.0.1",
"lerna": "3.16.2",
"ncp": "2.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ module.exports = {
"react/jsx-filename-extension": [1, {
"extensions": [".ts", ".tsx"]
}],
"react/jsx-props-no-spreading": [0]
}
}
6 changes: 3 additions & 3 deletions packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neuron-ui",
"version": "0.19.0-beta.0",
"version": "0.19.0-beta.1",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -43,7 +43,7 @@
"last 2 chrome versions"
],
"dependencies": {
"@nervosnetwork/ckb-sdk-core": "0.19.0",
"@nervosnetwork/ckb-sdk-core": "0.19.1",
"@uifabric/experiments": "7.10.0",
"@uifabric/styling": "7.4.0",
"canvg": "2.0.0",
Expand All @@ -55,7 +55,7 @@
"react-dom": "16.8.6",
"react-i18next": "10.11.0",
"react-router-dom": "5.0.0",
"react-scripts": "3.0.1",
"react-scripts": "3.1.1",
"styled-components": "5.0.0-beta.0"
},
"devDependencies": {
Expand Down
52 changes: 28 additions & 24 deletions packages/neuron-ui/src/components/Addresses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
TextField,
IColumn,
CheckboxVisibility,
ITextFieldStyleProps,
IconButton,
getTheme,
} from 'office-ui-fabric-react'

Expand All @@ -20,7 +20,7 @@ import { onRenderRow } from 'utils/fabricUIRender'

const Addresses = ({
app: {
loadings: { addressList: isLoading, updateDescription: isUpdatingDescription },
loadings: { addressList: isLoading },
},
wallet: { addresses = [], id: walletID },
settings: { showAddressBook = false },
Expand All @@ -39,7 +39,7 @@ const Addresses = ({
onDescriptionPress,
onDescriptionFieldBlur,
onDescriptionChange,
onDescriptionFocus,
onDescriptionSelected,
} = useLocalDescription('address', walletID, dispatch)

const theme = getTheme()
Expand Down Expand Up @@ -88,31 +88,36 @@ const Addresses = ({
minWidth: 100,
maxWidth: 300,
onRender: (item?: State.Address) => {
const isSelected = item && localDescription.key === item.address
return item ? (
<TextField
borderless
title={item.description}
value={localDescription.key === item.address ? localDescription.description : item.description || ''}
onBlur={onDescriptionFieldBlur(item.address, item.description)}
onFocus={onDescriptionFocus}
onKeyPress={onDescriptionPress(item.address, item.description)}
onChange={onDescriptionChange(item.address)}
disabled={localDescription.key === item.address && isUpdatingDescription}
iconProps={{
iconName: localDescription.key === item.address && isUpdatingDescription ? 'Updating' : '',
}}
styles={(props: ITextFieldStyleProps) => {
return {
<>
<TextField
borderless
title={item.description}
value={isSelected ? localDescription.description : item.description || ''}
onBlur={isSelected ? onDescriptionFieldBlur(item.address, item.description) : undefined}
onKeyPress={isSelected ? onDescriptionPress(item.address, item.description) : undefined}
onChange={isSelected ? onDescriptionChange(item.address) : undefined}
readOnly={!isSelected}
styles={{
root: {
flex: 1,
},
fieldGroup: {
borderColor: props.focused ? semanticColors.inputBorder : 'transparent',
border: '1px solid',
backgroundColor: isSelected ? '#fff' : 'transparent',
borderColor: 'transparent',
border: isSelected ? `1px solid ${semanticColors.inputBorder}!important` : 'none',
},
}
}}
/>
}}
/>
{isSelected ? null : (
<IconButton
iconProps={{ iconName: 'Edit' }}
className="editButton"
onClick={onDescriptionSelected(item.address, item.description)}
/>
)}
</>
) : null
},
},
Expand Down Expand Up @@ -152,8 +157,7 @@ const Addresses = ({
localDescription,
onDescriptionFieldBlur,
onDescriptionPress,
onDescriptionFocus,
isUpdatingDescription,
onDescriptionSelected,
t,
semanticColors,
]
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/components/ErrorBoundary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const handleError = (error: Error) => {
}

class ErrorBoundary extends Component<{ children: React.ReactChild }, { hasError: boolean }> {
/* eslint-disable react/state-in-constructor */
state = {
hasError: false,
}
Expand Down
4 changes: 1 addition & 3 deletions packages/neuron-ui/src/components/History/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useSearch } from './hooks'
const History = ({
app: {
tipBlockNumber: chainBlockNumber,
loadings: { transactionList: isLoading, updateDescription: isUpdatingDescription },
loadings: { transactionList: isLoading },
},
wallet: { id },
chain: {
Expand Down Expand Up @@ -54,7 +54,6 @@ const History = ({
</Stack>
<TransactionList
isLoading={isLoading}
isUpdatingDescription={isUpdatingDescription}
walletID={id}
items={items}
tipBlockNumber={tipBlockNumber}
Expand Down Expand Up @@ -87,7 +86,6 @@ const History = ({
onKeywordsChange,
onSearch,
isLoading,
isUpdatingDescription,
id,
items,
tipBlockNumber,
Expand Down
89 changes: 7 additions & 82 deletions packages/neuron-ui/src/components/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@ import {
IDetailsRowStyles,
FontSizes,
Callout,
MessageBar,
MessageBarType,
} from 'office-ui-fabric-react'
import PropertyList, { Property } from 'widgets/PropertyList'

import { StateWithDispatch } from 'states/stateProvider/reducer'
import { updateTransactionList, addPopup } from 'states/stateProvider/actionCreators'
import { updateTransactionList } from 'states/stateProvider/actionCreators'

import { showTransactionDetails, showErrorMessage } from 'services/remote'
import { showTransactionDetails } from 'services/remote'

import { localNumberFormatter, shannonToCKBFormatter, uniformTimeFormatter as timeFormatter } from 'utils/formatters'
import { PAGE_SIZE, Routes, CONFIRMATION_THRESHOLD, ErrorCode } from 'utils/const'
import { PAGE_SIZE, Routes, CONFIRMATION_THRESHOLD } from 'utils/const'
import { backToTop } from 'utils/animations'

const TITLE_FONT_SIZE = 'xxLarge'
Expand Down Expand Up @@ -157,20 +155,17 @@ const ActivityList = ({
const Overview = ({
dispatch,
app: { tipBlockNumber, chain, epoch, difficulty },
wallet: { id, name, balance = '', addresses = [] },
wallet: { id, name, balance = '' },
chain: {
tipBlockNumber: syncedBlockNumber,
codeHash = '',
transactions: { items = [] },
},
history,
}: React.PropsWithoutRef<StateWithDispatch & RouteComponentProps>) => {
const [t] = useTranslation()
const [displayBlockchainInfo, setDisplayBlockchainInfo] = useState(false)
const [displayMinerInfo, setDisplayMinerInfo] = useState(false)

const blockchainInfoRef = useRef<HTMLDivElement>(null)
const minerInfoRef = useRef<HTMLDivElement>(null)

useEffect(() => {
if (id) {
Expand Down Expand Up @@ -264,33 +259,11 @@ const Overview = ({
[t, chain, epoch, difficulty, tipBlockNumber]
)

const [showBlockchainStatus, hideBlockchainStatus, showMinerInfo, hideMinerInfo] = useMemo(
() => [
() => setDisplayBlockchainInfo(true),
() => setDisplayBlockchainInfo(false),
() => setDisplayMinerInfo(true),
() => setDisplayMinerInfo(false),
],
[setDisplayBlockchainInfo, setDisplayMinerInfo]
const [showBlockchainStatus, hideBlockchainStatus] = useMemo(
() => [() => setDisplayBlockchainInfo(true), () => setDisplayBlockchainInfo(false)],
[setDisplayBlockchainInfo]
)

const defaultAddress = useMemo(() => {
return addresses.find(addr => addr.type === 0 && addr.index === 0)
}, [addresses])

const onCopyPubkeyHash = useCallback(() => {
if (defaultAddress) {
window.navigator.clipboard.writeText(defaultAddress.identifier)
hideMinerInfo()
addPopup('lock-arg-copied')(dispatch)
} else {
showErrorMessage(
t(`messages.error`),
t(`messages.codes.${ErrorCode.FieldNotFound}`, { fieldName: `default-address` })
)
}
}, [defaultAddress, t, hideMinerInfo, dispatch])

const activityItems = useMemo(
() =>
items.map(item => {
Expand Down Expand Up @@ -342,11 +315,6 @@ const Overview = ({
{t('overview.blockchain-status')}
</DefaultButton>
</div>
<div ref={minerInfoRef}>
<DefaultButton onClick={showMinerInfo} styles={{ root: { width: '200px' } }}>
{t('overview.miner-info')}
</DefaultButton>
</div>
</Stack>
</Stack>
<Text as="h2" variant={TITLE_FONT_SIZE}>
Expand Down Expand Up @@ -375,49 +343,6 @@ const Overview = ({
</Stack>
</Callout>
) : null}
{minerInfoRef.current ? (
<Callout target={minerInfoRef.current} hidden={!displayMinerInfo} onDismiss={hideMinerInfo} gapSpace={0}>
<Stack tokens={{ padding: 15 }}>
{defaultAddress ? (
<Stack tokens={{ childrenGap: 15 }} styles={{ root: { padding: 5 } }}>
<Stack tokens={{ childrenGap: 15 }}>
<Text variant="small" style={{ fontWeight: 600 }}>
{t('overview.address')}
</Text>
<Text variant="small" className="monospacedFont">
{defaultAddress.address}
</Text>
</Stack>
<Stack tokens={{ childrenGap: 15 }}>
<Text variant="small" style={{ fontWeight: 600 }}>
{t('overview.code-hash')}
</Text>
<Text variant="small" className="monospacedFont">
{codeHash}
</Text>
</Stack>
<Stack tokens={{ childrenGap: 15 }}>
<Text variant="small" style={{ fontWeight: 600 }}>
{t('overview.lock-arg')}
</Text>
<Text variant="small" className="monospacedFont">
{defaultAddress.identifier}
</Text>
</Stack>
<Stack horizontalAlign="end">
<ActionButton iconProps={{ iconName: 'MiniCopy' }} onClick={onCopyPubkeyHash}>
{t('overview.copy-pubkey-hash')}
</ActionButton>
</Stack>
</Stack>
) : (
<MessageBar messageBarType={MessageBarType.error}>
{t(`messages.codes.${ErrorCode.FieldNotFound}`, { fieldName: `default-address` })}
</MessageBar>
)}
</Stack>
</Callout>
) : null}
</Stack>
)
}
Expand Down
Loading