marni-WIP-284-added account meta to forget modal (#287)

* added account meta to forget modal

* added modal size (tiny) and styling to center account summary info

* removed article - not needed

* Bump dependencies

* FIXME around RxJs (with types) upgrade

* fix: Fixes #290. Toggles Address Add/Edit menu correctly (#292)

* fix: Fixes #290. Toggles Address Add/Edit menu correctly

* fix: Rename to hasNoAddresses

* fixed modal title and added blank line
This commit is contained in:
Marni 2018-09-11 01:51:30 -04:00 committed by Jaco Greeff
parent 406cb6158c
commit 3eed706835
3 changed files with 31 additions and 7 deletions

View File

@ -40,13 +40,15 @@ class Editor extends React.PureComponent<Props, State> {
} }
render () { render () {
const { isForgetOpen } = this.state; const { isForgetOpen, current } = this.state;
return ( return (
<div className='accounts--Editor'> <div className='accounts--Editor'>
<Forgetting <Forgetting
isOpen={isForgetOpen} isOpen={isForgetOpen}
onClose={this.toggleForget} onClose={this.toggleForget}
doForget={this.onForget} doForget={this.onForget}
currentAddress={current}
/> />
{this.renderData()} {this.renderData()}
{this.renderButtons()} {this.renderButtons()}

View File

@ -1,18 +1,23 @@
// Copyright 2017-2018 @polkadot/app-accounts authors & contributors // Copyright 2017-2018 @polkadot/app-accounts authors & contributors
// This software may be modified and distributed under the terms // This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details. // of the ISC license. See the LICENSE file for details.
import { KeyringPair } from '@polkadot/util-keyring/types';
import { I18nProps } from '@polkadot/ui-app/types'; import { I18nProps } from '@polkadot/ui-app/types';
import React from 'react'; import React from 'react';
import Button from '@polkadot/ui-app/Button'; import Button from '@polkadot/ui-app/Button';
import Modal from '@polkadot/ui-app/Modal'; import Modal from '@polkadot/ui-app/Modal';
import AddressSummary from '@polkadot/ui-app/AddressSummary';
import translate from './translate'; import translate from './translate';
type Props = I18nProps & { type Props = I18nProps & {
isOpen: boolean, isOpen: boolean,
onClose: () => void, onClose: () => void,
doForget: () => void doForget: () => void,
currentAddress: KeyringPair | null
}; };
class Forgetting extends React.PureComponent<Props> { class Forgetting extends React.PureComponent<Props> {
@ -29,7 +34,7 @@ class Forgetting extends React.PureComponent<Props> {
return ( return (
<Modal <Modal
className='staking--Nominating' size='tiny'
dimmer='inverted' dimmer='inverted'
open open
style={style} style={style}
@ -57,7 +62,9 @@ class Forgetting extends React.PureComponent<Props> {
<Button <Button
isPrimary isPrimary
onClick={doForget} onClick={doForget}
text='Delete' text={t('forget.forget', {
defaultValue: 'Forget'
})}
/> />
</Button.Group> </Button.Group>
</Modal.Actions> </Modal.Actions>
@ -65,13 +72,24 @@ class Forgetting extends React.PureComponent<Props> {
} }
renderContent () { renderContent () {
const { t } = this.props; const { t, currentAddress } = this.props;
const address = currentAddress
? currentAddress.address()
: undefined;
return [ return [
<Modal.Header key='header'> <Modal.Header key='header'>
{t('forget.header', { {t('forget.header', {
defaultValue: 'Are you sure you want to delete this account?' defaultValue: 'Confirm account removal'
})} })}
</Modal.Header> </Modal.Header>,
<Modal.Content className='forgetting--Account' key='content'>
<AddressSummary
className='ui--AddressSummary-base'
value={address || ''}
/>
</Modal.Content>
]; ];
} }
} }

View File

@ -1,3 +1,7 @@
/* Copyright 2017-2018 @polkadot/app-accounts authors & contributors /* Copyright 2017-2018 @polkadot/app-accounts authors & contributors
/* This software may be modified and distributed under the terms /* This software may be modified and distributed under the terms
/* of the ISC license. See the LICENSE file for details. */ /* of the ISC license. See the LICENSE file for details. */
.forgetting--Account {
text-align: center;
}