diff --git a/packages/app-accounts/src/Account.tsx b/packages/app-accounts/src/Account.tsx index d7cadb785a..bc7d0272e6 100644 --- a/packages/app-accounts/src/Account.tsx +++ b/packages/app-accounts/src/Account.tsx @@ -6,20 +6,22 @@ import { ActionStatus } from '@polkadot/react-components/Status/types'; import { I18nProps } from '@polkadot/react-components/types'; import React from 'react'; -import { AddressCard, AddressInfo, Button, Forget, Icon } from '@polkadot/react-components'; +import styled from 'styled-components'; +import { AddressCard, AddressInfo, Button, ChainLock, Forget, Icon } from '@polkadot/react-components'; import keyring from '@polkadot/ui-keyring'; import Backup from './modals/Backup'; import ChangePass from './modals/ChangePass'; import Transfer from './modals/Transfer'; - import translate from './translate'; interface Props extends I18nProps { address: string; + className?: string; } interface State { + genesisHash: string | null; isBackupOpen: boolean; isEditable: boolean; isForgetOpen: boolean; @@ -36,6 +38,7 @@ class Account extends React.PureComponent { const account = keyring.getAccount(props.address); this.state = { + genesisHash: (account && account.meta.genesisHash) || null, isBackupOpen: false, isEditable: account ? !(account.meta.isInjected) @@ -47,7 +50,7 @@ class Account extends React.PureComponent { } public render (): React.ReactNode { - const { address } = this.props; + const { address, className } = this.props; const { isEditable } = this.state; // FIXME It is a bit heavy-handled switching of being editable here completely @@ -55,6 +58,7 @@ class Account extends React.PureComponent { return ( { } } + private onGenesisChange = (genesisHash: string | null): void => { + const { address } = this.props; + + this.setState({ genesisHash }, (): void => { + const account = keyring.getPair(address); + + account && keyring.saveAccountMeta(account, { ...account.meta, genesisHash }); + }); + } + private renderButtons (): React.ReactNode { const { t } = this.props; - const { isEditable } = this.state; + const { genesisHash, isEditable } = this.state; return (
+
+ {isEditable && ( + <> +
{isEditable && ( - <> -
)} -