From 9426ec9c313e593e0b8622ec1e9c25ed5796ca5f Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Wed, 22 May 2019 22:01:55 +0200 Subject: [PATCH] Hide edit on injected accounts, Button w/ tooltip (#1192) * Hide edit on injected accounts, Button w/ tooltip * Don't display "add tags" when not isEditable * Indentation --- packages/app-accounts/src/Account.tsx | 67 ++++++++++++------------- packages/apps/src/SideBar/Item.tsx | 40 ++++----------- packages/ui-app/src/AddressSummary.tsx | 16 +++--- packages/ui-app/src/Button/Button.tsx | 36 +++++++++---- packages/ui-app/src/Button/index.tsx | 12 +++-- packages/ui-app/src/Button/types.ts | 3 +- packages/ui-app/src/Labelled.tsx | 9 ++-- packages/ui-app/src/RecentlyOffline.tsx | 5 +- packages/ui-app/src/Tooltip.tsx | 15 ++++-- packages/ui-reactive/src/Unlocking.tsx | 30 +++++------ 10 files changed, 117 insertions(+), 116 deletions(-) diff --git a/packages/app-accounts/src/Account.tsx b/packages/app-accounts/src/Account.tsx index 64c4147a80..8529f9cd8d 100644 --- a/packages/app-accounts/src/Account.tsx +++ b/packages/app-accounts/src/Account.tsx @@ -3,12 +3,11 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { ActionStatus } from '@polkadot/ui-app/Status/types'; -import { I18nProps } from './types'; +import { I18nProps } from '@polkadot/ui-app/types'; -import { Button as SUIB, Popup } from 'semantic-ui-react'; import React from 'react'; import styled from 'styled-components'; -import { AddressSummary, Available, Balance, Bonded, CryptoType, Nonce, Unlocking } from '@polkadot/ui-app'; +import { AddressSummary, Available, Balance, Bonded, Button, CryptoType, Nonce, Unlocking } from '@polkadot/ui-app'; import keyring from '@polkadot/ui-keyring'; import Backup from './modals/Backup'; @@ -22,6 +21,7 @@ type Props = I18nProps & { type State = { isBackupOpen: boolean, + isEditable: boolean, isForgetOpen: boolean, isPasswordOpen: boolean }; @@ -109,6 +109,7 @@ class Account extends React.PureComponent { this.state = { isBackupOpen: false, + isEditable: !(keyring.getAccount(props.address).getMeta().isInjected), isForgetOpen: false, isPasswordOpen: false }; @@ -116,14 +117,17 @@ class Account extends React.PureComponent { render () { const { address } = this.props; + const { isEditable } = this.state; + // FIXME It is a bit heavy-handled switching of being editable here completely + // (and removing the tags, however the keyring cannot save these) return ( {this.renderModals()} { } private renderButtons () { + const { t } = this.props; + const { isEditable } = this.state; + + if (!isEditable) { + return null; + } - // FIXME: The event trigger on='hover' does not work together with the ui-app' - //