diff --git a/package.json b/package.json index 60dedb694f..764ea2d4c5 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,9 @@ "packages/*" ], "resolutions": { - "@polkadot/api": "^0.81.0-beta.3", + "@polkadot/api": "^0.81.0-beta.7", "@polkadot/keyring": "^0.93.0-beta.0", - "@polkadot/types": "^0.81.0-beta.3", + "@polkadot/types": "^0.81.0-beta.7", "@polkadot/util": "^0.93.0-beta.0", "@polkadot/util-crypto": "^0.93.0-beta.0", "babel-core": "^7.0.0-bridge.0", diff --git a/packages/app-accounts/src/Account.tsx b/packages/app-accounts/src/Account.tsx index d0acda03fb..8aa13c8a5d 100644 --- a/packages/app-accounts/src/Account.tsx +++ b/packages/app-accounts/src/Account.tsx @@ -6,12 +6,11 @@ import { ActionStatus } from '@polkadot/ui-app/Status/types'; import { I18nProps } from '@polkadot/ui-app/types'; import React from 'react'; -import { AddressCard, AddressInfo, Button, Icon } from '@polkadot/ui-app'; +import { AddressCard, AddressInfo, Button, Forget, Icon } from '@polkadot/ui-app'; import keyring from '@polkadot/ui-keyring'; import Backup from './modals/Backup'; import ChangePass from './modals/ChangePass'; -import Forgetting from './modals/Forgetting'; import Transfer from './modals/Transfer'; import translate from './translate'; @@ -53,6 +52,7 @@ class Account extends React.PureComponent { { if (isForgetOpen) { modals.push( - diff --git a/packages/app-accounts/src/index.tsx b/packages/app-accounts/src/index.tsx index 7df34b21e8..cde9d3465d 100644 --- a/packages/app-accounts/src/index.tsx +++ b/packages/app-accounts/src/index.tsx @@ -42,6 +42,7 @@ class AccountsApp extends React.PureComponent { ...baseState, tabs: [ { + isRoot: true, name: 'overview', text: t('My accounts') }, diff --git a/packages/app-accounts/src/modals/Forgetting.tsx b/packages/app-accounts/src/modals/Forgetting.tsx deleted file mode 100644 index 32964d7c1f..0000000000 --- a/packages/app-accounts/src/modals/Forgetting.tsx +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2017-2019 @polkadot/app-accounts authors & contributors -// This software may be modified and distributed under the terms -// of the Apache-2.0 license. See the LICENSE file for details. - -import { I18nProps } from '@polkadot/ui-app/types'; - -import React from 'react'; -import { AddressRow, Button, Modal } from '@polkadot/ui-app'; - -import translate from '../translate'; - -type Props = I18nProps & { - address: string, - onClose: () => void, - doForget: () => void -}; - -class Forgetting extends React.PureComponent { - render () { - const { t } = this.props; - - return ( - - {t('Confirm account removal')} - {this.renderContent()} - {this.renderButtons()} - - ); - } - - private renderButtons () { - const { onClose, doForget, t } = this.props; - - return ( - - - + ); + } + + onSelect = (index: number) => () => { + const { address: callAddress, contractAbi: { abi: { messages } }, onSelect } = this.props; + + if (!callAddress || !messages || !messages[index]) { + return; + } + + const { name: callMethod } = messages[index]; + + onSelect && onSelect(callAddress, callMethod); + } +} + +export default translate(Messages); diff --git a/packages/ui-app/src/Params/Extrinsic.tsx b/packages/ui-app/src/Params/Extrinsic.tsx index 5f37815d0a..71d1c28fb5 100644 --- a/packages/ui-app/src/Params/Extrinsic.tsx +++ b/packages/ui-app/src/Params/Extrinsic.tsx @@ -17,7 +17,7 @@ type Props = I18nProps & { isDisabled?: boolean, isError?: boolean, isPrivate: boolean, - label: string, + label: React.ReactNode, onChange?: RawParam$OnChange, onEnter?: RawParam$OnEnter, withLabel?: boolean diff --git a/packages/ui-app/src/Row.tsx b/packages/ui-app/src/Row.tsx new file mode 100644 index 0000000000..ae8c145310 --- /dev/null +++ b/packages/ui-app/src/Row.tsx @@ -0,0 +1,312 @@ +// Copyright 2017-2019 @polkadot/ui-app authors & contributors +// This software may be modified and distributed under the terms +// of the Apache-2.0 license. See the LICENSE file for details. + +import { Label } from 'semantic-ui-react'; +import React from 'react'; +import { Button, Input, InputTags } from '@polkadot/ui-app'; + +import { classes } from './util'; + +export const styles = ` + text-align: left; + + &.inline { + display: flex; + + .ui--Row-children { + padding: 0 0 0 3rem; + } + } + + &.invalid { + filter: grayscale(100); + opacity: 0.5; + } + + button.ui.icon.editButton { + padding: 0em .3em .3em .3em; + color: #2e86ab; + background: none; + /*trick to let the button in the flow but keep the content centered regardless*/ + margin-left: -2em; + position: relative; + right: -2.3em; + z-index: 1; + } + + .ui--Row-accountId, + .ui--Row-accountIndex { + font-family: monospace; + font-size: 1.25em; + padding: 0; + margin-bottom: 0.25rem; + } + + .ui--Row-accountIndex { + font-style: italic; + } + + .ui--Row-balances { + .column { + display: block; + + label, + .result { + display: inline-block; + } + } + + > span { + text-align: left; + } + } + + .ui--Row-base { + display: flex; + } + + .ui--Row-buttons { + flex: 0; + margin: -0.75rem -0.75rem 0 0; + white-space: nowrap; + } + + .ui--Row-children { + display: block; + padding-top: 1rem; + } + + .ui--Row-details { + flex: 1; + margin-right: 1rem; + padding: 0.25rem 0 0; + + * { + vertical-align: middle; + } + } + + .ui--Row-icon { + flex: 0; + margin-right: 1em; + position: relative; + + .ui--Row-icon-info { + left: -0.5rem; + position: absolute; + top: -0.5rem; + } + } + + .ui--Row-name { + box-sizing: border-box; + margin: 0; + padding: 0; + overflow: hidden; + text-overflow: ellipsis; + text-transform: uppercase; + white-space: normal; + } + + .ui--Row-name-input { + input { + height: 1em; + text-transform: uppercase; + margin-top: -0.3em; + margin-bottom: -0.35em; + } + } + + .ui--Row-tags { + &.editable { + display: flex; + flex-wrap: wrap; + justify-content: left; + + > span { + border: 1px #00000052 solid; + border-radius: .5em; + border-style: dashed; + color: grey; + font-size: x-small; + padding: .1em 0.3em 0.1em 0.3em; + margin-top: .2em; + } + + > div.label { + margin-top:.3em + } + } + } + + .ui--Row-tags-input { + margin-bottom: -1.4em; + } +`; + +export type RowProps = { + buttons?: React.ReactNode, + children?: React.ReactNode, + className?: string, + defaultName?: string, + extraInfo?: React.ReactNode, + iconInfo?: React.ReactNode, + isEditable?: boolean, + isInline?: boolean, + withIcon?: boolean, + withTags?: boolean +}; + +export type RowState = { + isEditingName: boolean, + isEditingTags: boolean, + name: string, + tags: string[] +}; + +// const DEFAULT_ADDR = '5'.padEnd(16, 'x'); +// const ICON_SIZE = 48; + +class Row

extends React.PureComponent { + state: S = { + isEditingName: false, + isEditingTags: false + } as S; + + static defaultProps = { + defaultName: '' + }; + + protected onChangeName = (name: string) => { + this.setState({ name }); + } + + protected onChangeTags = (tags: string[]) => { + this.setState({ tags }); + } + + protected renderButtons () { + const { buttons } = this.props; + + return buttons + ?

{buttons}
+ : null; + } + + protected renderChildren () { + const { children } = this.props; + + const hasChildren = !children + ? false + : Array.isArray(children) + ? children.filter((child) => child).length !== 0 + : true; + + if (!hasChildren) { + return null; + } + + return ( +
+ {children} +
+ ); + } + + protected renderEditIcon () { + return ( +