Skip to content

Commit

Permalink
Merge pull request #666 from nervosnetwork/rc/v0.1.0-alpha.8
Browse files Browse the repository at this point in the history
[ᚬmaster] Release v0.1.0 alpha.8
  • Loading branch information
ashchan authored Jul 16, 2019
2 parents 3b0b5cd + 6638899 commit 9fea146
Show file tree
Hide file tree
Showing 41 changed files with 801 additions and 350 deletions.
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.1.0-alpha.7",
"version": "0.1.0-alpha.8",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@nervosnetwork/neuron",
"productName": "Neuron",
"description": "CKB Neuron Wallet",
"version": "0.1.0-alpha.7",
"version": "0.1.0-alpha.8",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nervosnetwork/neuron-ui",
"version": "0.1.0-alpha.7",
"version": "0.1.0-alpha.8",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -42,6 +42,7 @@
"@nervosnetwork/ckb-sdk-core": "0.15.1",
"@uifabric/experiments": "7.4.2",
"@uifabric/styling": "7.1.1",
"canvg": "2.0.0",
"grommet-icons": "4.2.0",
"i18next": "15.1.3",
"office-ui-fabric-react": "7.6.1",
Expand Down
31 changes: 31 additions & 0 deletions packages/neuron-ui/src/components/Addresses/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { appCalls } from 'services/UILayer'

import { useLocalDescription } from 'utils/hooks'
import { MIN_CELL_WIDTH, Routes } from 'utils/const'
import { shannonToCKBFormatter } from 'utils/formatters'

const Addresses = ({
wallet: { id, addresses = [] },
Expand Down Expand Up @@ -77,6 +78,16 @@ const Addresses = ({
maxWidth: 450,
isResizable: true,
isCollapsible: false,
onRender: (item?: State.Address) => {
if (item) {
return (
<span className="text-overflow" title={item.address}>
{item.address}
</span>
)
}
return '-'
},
},
{
name: 'addresses.description',
Expand Down Expand Up @@ -118,6 +129,16 @@ const Addresses = ({
maxWidth: 250,
isResizable: true,
isCollapsible: false,
onRender: (item?: State.Address) => {
if (item) {
return (
<span title={`${item.balance} shannon`} className="text-overflow">
{`${shannonToCKBFormatter(item.balance)} CKB`}
</span>
)
}
return '-'
},
},
{
name: 'addresses.transactions',
Expand All @@ -127,6 +148,12 @@ const Addresses = ({
maxWidth: 150,
isResizable: true,
isCollapsible: false,
onRender: (item?: State.Address) => {
if (item) {
return (+item.txCount).toLocaleString()
}
return '-'
},
},
],
[onDescriptionChange, localDescription, onDescriptionFieldBlur, onDescriptionPress, t, semanticColors]
Expand All @@ -148,6 +175,10 @@ const Addresses = ({
display: 'flex',
alignItems: 'center',
},
'.text-overflow': {
overflow: 'hidden',
textOverflow: 'ellipsis',
},
},
},
}}
Expand Down
1 change: 0 additions & 1 deletion packages/neuron-ui/src/components/NetworkSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const NetworkSetting = ({
key: network.id,
text: network.name,
checked: chain.networkID === network.id,
disabled: chain.networkID === network.id,
onRenderLabel: ({ text }: IChoiceGroupOption) => {
return (
<span className="ms-ChoiceFieldLabel" onContextMenu={onContextMenu(network.id)}>
Expand Down
36 changes: 31 additions & 5 deletions packages/neuron-ui/src/components/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { StateWithDispatch } from 'states/stateProvider/reducer'
import actionCreators from 'states/stateProvider/actionCreators'

import { localNumberFormatter } from 'utils/formatters'
import { localNumberFormatter, shannonToCKBFormatter } from 'utils/formatters'
import { PAGE_SIZE, MIN_CELL_WIDTH } from 'utils/const'

const timeFormatter = new Intl.DateTimeFormat(undefined, {
Expand Down Expand Up @@ -155,7 +155,14 @@ const Overview = ({
{
key: 'value',
name: t('overview.amount'),
title: 'value',
minWidth: 2 * MIN_CELL_WIDTH,
onRender: (item?: State.Transaction) => {
if (item) {
return <span title={`${item.value} shannon`}>{`${shannonToCKBFormatter(item.value)} CKB`}</span>
}
return '-'
},
},
].map(
(col): IColumn => ({
Expand Down Expand Up @@ -193,7 +200,10 @@ const Overview = ({

const balanceItems = useMemo(
() => [
{ label: t('overview.amount'), value: balance },
{
label: t('overview.amount'),
value: <span title={`${balance} shannon`}>{`${shannonToCKBFormatter(balance)} CKB`}</span>,
},
{ label: t('overview.live-cells'), value: 'mock living cells' },
{ label: t('overview.cell-types'), value: 'mock cell typ' },
],
Expand All @@ -212,8 +222,17 @@ const Overview = ({
)

return (
<Stack horizontal horizontalAlign="space-evenly" verticalFill tokens={{ childrenGap: 15 }}>
<Stack tokens={{ childrenGap: 15 }}>
<Stack horizontal horizontalAlign="space-evenly" verticalFill tokens={{ childrenGap: 15 }} wrap>
<Stack
tokens={{
childrenGap: 15,
}}
styles={{
root: {
minWidth: '680px',
},
}}
>
<Stack>
<Text as="h1" variant={TITLE_FONT_SIZE}>
{t('overview.balance')}
Expand All @@ -229,7 +248,14 @@ const Overview = ({
) : null}
</Stack.Item>
</Stack>
<Stack horizontalAlign="stretch">
<Stack
horizontalAlign="stretch"
styles={{
root: {
minWidth: '680px',
},
}}
>
<Text as="h1" variant={TITLE_FONT_SIZE}>
{t('overview.recent-activities')}
</Text>
Expand Down
55 changes: 30 additions & 25 deletions packages/neuron-ui/src/components/Receive/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
import React, { useState, useCallback, useMemo } from 'react'
import { RouteComponentProps } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Stack, Text, TextField, TooltipHost, Modal } from 'office-ui-fabric-react'
import { Stack, Text, TextField, TooltipHost, Modal, FontSizes } from 'office-ui-fabric-react'

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

declare global {
interface Window {
clipboard: any
}
}

const Receive = ({
wallet: { addresses = [] },
match: { params },
Expand All @@ -37,24 +31,35 @@ const Receive = ({
}

return (
<Stack tokens={{ childrenGap: 15 }} horizontalAlign="center">
<Stack onClick={() => setShowLargeQRCode(true)} style={{ alignSelf: 'center' }}>
<QRCode value={accountAddress} size={256} />
</Stack>
<Stack styles={{ root: { maxWidth: 500 } }}>
<TooltipHost content={t('receive.click-to-copy')} calloutProps={{ gapSpace: 0 }}>
<Stack horizontal horizontalAlign="stretch" tokens={{ childrenGap: 15 }}>
<TextField
styles={{ root: { flex: 1 } }}
readOnly
placeholder={accountAddress}
onClick={copyAddress}
description={t('receive.prompt')}
/>
<Copy onClick={copyAddress} />
</Stack>
</TooltipHost>
<>
<Stack horizontal tokens={{ childrenGap: 40 }} padding="20px 0 0 0 " horizontalAlign="space-between">
<Stack styles={{ root: { flex: 1 } }}>
<TooltipHost content={t('receive.click-to-copy')} calloutProps={{ gapSpace: 0 }}>
<Stack horizontal horizontalAlign="stretch" tokens={{ childrenGap: 15 }}>
<TextField
styles={{
root: {
flex: 1,
},
description: {
fontSize: FontSizes.medium,
},
}}
readOnly
placeholder={accountAddress}
onClick={copyAddress}
description={t('receive.prompt')}
/>
<Copy onClick={copyAddress} />
</Stack>
</TooltipHost>
</Stack>

<Stack style={{ alignSelf: 'center' }}>
<QRCode value={accountAddress} onQRCodeClick={() => setShowLargeQRCode(true)} size={256} exportable />
</Stack>
</Stack>

<Modal isOpen={showLargeQRCode} onDismiss={() => setShowLargeQRCode(false)}>
<Stack
styles={{
Expand All @@ -77,7 +82,7 @@ const Receive = ({
<QRCode value={accountAddress} size={400} />
</Stack>
</Modal>
</Stack>
</>
)
}

Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/components/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { StateWithDispatch } from 'states/stateProvider/reducer'
import appState from 'states/initStates/app'

import { PlaceHolders, CapacityUnit } from 'utils/const'
import { shannonToCKBFormatter } from 'utils/formatters'

import { useInitialize } from './hooks'

Expand Down Expand Up @@ -143,7 +144,7 @@ const Send = ({

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

<div>{`${t('send.balance')}: ${balance}`}</div>
<div>{`${t('send.balance')}: ${shannonToCKBFormatter(balance)} CKB`}</div>

<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: 20 }}>
<DefaultButton type="reset" onClick={onClear}>
Expand Down
Loading

0 comments on commit 9fea146

Please sign in to comment.