|
@@ -6,9 +6,8 @@ import { ActionStatus } from '@polkadot/react-components/Status/types';
|
|
|
import { I18nProps } from '@polkadot/react-components/types';
|
|
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
|
-import { Popup } from 'semantic-ui-react';
|
|
|
import styled from 'styled-components';
|
|
|
-import { AddressCard, AddressInfo, Button, ChainLock, Forget, Menu } from '@polkadot/react-components';
|
|
|
+import { AddressCard, AddressInfo, Button, ChainLock, Forget, Menu, Popup } from '@polkadot/react-components';
|
|
|
import keyring from '@polkadot/ui-keyring';
|
|
|
|
|
|
import Backup from './modals/Backup';
|
|
@@ -47,8 +46,8 @@ function Account ({ address, className, t }: Props): React.ReactElement<Props> {
|
|
|
const _toggleDerive = (): void => setIsDeriveOpen(!isDeriveOpen);
|
|
|
const _toggleForget = (): void => setIsForgetOpen(!isForgetOpen);
|
|
|
const _togglePass = (): void => setIsPasswordOpen(!isPasswordOpen);
|
|
|
- const _toggleTransfer = (): void => setIsTransferOpen(!isTransferOpen);
|
|
|
const _toggleSettingPopup = (): void => setIsSettingPopupOpen(!isSettingPopupOpen);
|
|
|
+ const _toggleTransfer = (): void => setIsTransferOpen(!isTransferOpen);
|
|
|
const _onForget = (): void => {
|
|
|
if (!address) {
|
|
|
return;
|
|
@@ -83,33 +82,6 @@ function Account ({ address, className, t }: Props): React.ReactElement<Props> {
|
|
|
buttons={
|
|
|
<div className='accounts--Account-buttons buttons'>
|
|
|
<div className='actions'>
|
|
|
- {isEditable && !isDevelopment && (
|
|
|
- <Button
|
|
|
- isNegative
|
|
|
- onClick={_toggleForget}
|
|
|
- icon='trash'
|
|
|
- size='small'
|
|
|
- tooltip={t('Forget this account')}
|
|
|
- />
|
|
|
- )}
|
|
|
- {isEditable && !isExternal && !isDevelopment && (
|
|
|
- <>
|
|
|
- <Button
|
|
|
- icon='cloud download'
|
|
|
- isPrimary
|
|
|
- onClick={_toggleBackup}
|
|
|
- size='small'
|
|
|
- tooltip={t('Create a backup file for this account')}
|
|
|
- />
|
|
|
- <Button
|
|
|
- icon='key'
|
|
|
- isPrimary
|
|
|
- onClick={_togglePass}
|
|
|
- size='small'
|
|
|
- tooltip={t("Change this account's password")}
|
|
|
- />
|
|
|
- </>
|
|
|
- )}
|
|
|
<Button
|
|
|
icon='paper plane'
|
|
|
isPrimary
|
|
@@ -118,42 +90,62 @@ function Account ({ address, className, t }: Props): React.ReactElement<Props> {
|
|
|
size='small'
|
|
|
tooltip={t('Send funds from this account')}
|
|
|
/>
|
|
|
- {isEditable && !isExternal && (
|
|
|
- <Popup
|
|
|
- onClose={_toggleSettingPopup}
|
|
|
- open={isSettingPopupOpen}
|
|
|
- position='bottom left'
|
|
|
- trigger={
|
|
|
- <Button
|
|
|
- icon='setting'
|
|
|
- onClick={_toggleSettingPopup}
|
|
|
- size='small'
|
|
|
- />
|
|
|
- }
|
|
|
- >
|
|
|
- <Menu
|
|
|
- vertical
|
|
|
- text
|
|
|
+ <Popup
|
|
|
+ className='theme--default'
|
|
|
+ onClose={_toggleSettingPopup}
|
|
|
+ open={isSettingPopupOpen}
|
|
|
+ position='bottom right'
|
|
|
+ trigger={
|
|
|
+ <Button
|
|
|
+ icon='setting'
|
|
|
onClick={_toggleSettingPopup}
|
|
|
+ size='small'
|
|
|
+ />
|
|
|
+ }
|
|
|
+ >
|
|
|
+ <Menu
|
|
|
+ vertical
|
|
|
+ text
|
|
|
+ onClick={_toggleSettingPopup}
|
|
|
+ >
|
|
|
+ <Menu.Item
|
|
|
+ disabled={!isEditable || isExternal}
|
|
|
+ onClick={_toggleDerive}
|
|
|
+ >
|
|
|
+ {t('Derive account from source')}
|
|
|
+ </Menu.Item>
|
|
|
+ <Menu.Item disabled>
|
|
|
+ {t('Change on-chain nickname')}
|
|
|
+ </Menu.Item>
|
|
|
+ <Menu.Item
|
|
|
+ disabled={!isEditable || isExternal || isDevelopment}
|
|
|
+ onClick={_toggleBackup}
|
|
|
+ >
|
|
|
+ {t('Create a backup file for this account')}
|
|
|
+ </Menu.Item>
|
|
|
+ <Menu.Item
|
|
|
+ disabled={!isEditable || isExternal || isDevelopment}
|
|
|
+ onClick={_togglePass}
|
|
|
+ >
|
|
|
+ {t("Change this account's password")}
|
|
|
+ </Menu.Item>
|
|
|
+ <Menu.Item
|
|
|
+ disabled={!isEditable || isDevelopment}
|
|
|
+ onClick={_toggleForget}
|
|
|
>
|
|
|
- <Menu.Item onClick={_toggleDerive}>
|
|
|
- {t('Derive account from source')}
|
|
|
- </Menu.Item>
|
|
|
- <Menu.Item disabled>
|
|
|
- {t('Change on-chain nickname')}
|
|
|
- </Menu.Item>
|
|
|
- </Menu>
|
|
|
- </Popup>
|
|
|
- )}
|
|
|
+ {t('Forget this account')}
|
|
|
+ </Menu.Item>
|
|
|
+ <Menu.Divider />
|
|
|
+ <ChainLock
|
|
|
+ className='accounts--network-toggle'
|
|
|
+ genesisHash={genesisHash}
|
|
|
+ isDisabled={!isEditable || isExternal}
|
|
|
+ onChange={_onGenesisChange}
|
|
|
+ preventDefault
|
|
|
+ />
|
|
|
+ </Menu>
|
|
|
+ </Popup>
|
|
|
</div>
|
|
|
- {isEditable && !isExternal && (
|
|
|
- <div className='others'>
|
|
|
- <ChainLock
|
|
|
- genesisHash={genesisHash}
|
|
|
- onChange={_onGenesisChange}
|
|
|
- />
|
|
|
- </div>
|
|
|
- )}
|
|
|
</div>
|
|
|
}
|
|
|
className={className}
|
|
@@ -217,11 +209,6 @@ export default translate(
|
|
|
styled(Account)`
|
|
|
.accounts--Account-buttons {
|
|
|
text-align: right;
|
|
|
-
|
|
|
- .others {
|
|
|
- margin-right: 0.125rem;
|
|
|
- margin-top: 0.25rem;
|
|
|
- }
|
|
|
}
|
|
|
`
|
|
|
);
|