diff --git a/packages/apps-routing/src/addressbook.ts b/packages/apps-routing/src/addressbook.ts deleted file mode 100644 index ac32be2c3d..0000000000 --- a/packages/apps-routing/src/addressbook.ts +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017-2020 @polkadot/apps-routing 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 { Routes } from './types'; - -import AddressBook from '@polkadot/app-address-book'; - -export default ([ - { - Component: AddressBook, - display: { - needsApi: [] - }, - i18n: { - defaultValue: 'Address book' - }, - icon: 'address book', - name: 'addressbook' - } -] as Routes); diff --git a/packages/apps-routing/src/index.ts b/packages/apps-routing/src/index.ts index 534f2e6843..079976b5d9 100644 --- a/packages/apps-routing/src/index.ts +++ b/packages/apps-routing/src/index.ts @@ -8,7 +8,6 @@ import appSettings from '@polkadot/ui-settings'; import template from './123code'; import accounts from './accounts'; -import addressbook from './addressbook'; import claims from './claims'; import contracts from './contracts'; import council from './council'; @@ -34,7 +33,6 @@ const routes: Routes = appSettings.uiMode === 'light' // dashboard, explorer, accounts, - addressbook, claims, transfer, genericAsset, @@ -50,7 +48,6 @@ const routes: Routes = appSettings.uiMode === 'light' // dashboard, explorer, accounts, - addressbook, claims, transfer, genericAsset, diff --git a/packages/apps-routing/src/transfer.ts b/packages/apps-routing/src/transfer.ts index 56a61fc27d..f53950b044 100644 --- a/packages/apps-routing/src/transfer.ts +++ b/packages/apps-routing/src/transfer.ts @@ -5,7 +5,7 @@ import { Routes } from './types'; import Transfer from '@polkadot/app-transfer'; -import TransferModal from '@polkadot/app-accounts/modals/Transfer'; +import TransferModal from '@polkadot/app-accounts/Accounts/modals/Transfer'; export default ([ { diff --git a/packages/apps/public/locales/en/app-accounts.json b/packages/apps/public/locales/en/app-accounts.json index 7508571fb5..e2694f0563 100644 --- a/packages/apps/public/locales/en/app-accounts.json +++ b/packages/apps/public/locales/en/app-accounts.json @@ -9,7 +9,7 @@ "Accounts injected from any of these extensions will appear in this application and be available for use. The above list is updated as more extensions with external signing capability become available.": "Accounts injected from any of these extensions will appear in this application and be available for use. The above list is updated as more extensions with external signing capability become available.", "Learn more...": "Learn more...", "My accounts": "My accounts", - "Vanity address": "Vanity address", + "Vanity generator": "Vanity generator", "account backed up": "account backed up", "Backup account": "Backup account", "Cancel": "Cancel", @@ -131,12 +131,26 @@ "The addresses that are able to help in recovery. You can select up to {{maxHelpers}} trusted helpers.": "The addresses that are able to help in recovery. You can select up to {{maxHelpers}} trusted helpers.", "trusted social recovery helpers": "trusted social recovery helpers", "The threshold of vouches that is to be reached for the account to be recovered.": "The threshold of vouches that is to be reached for the account to be recovered.", - "recoverey threshold": "recoverey threshold", "The delay between vouching and the availability of the recovered account.": "The delay between vouching and the availability of the recovered account.", - "recoverey block delay": "recoverey block delay", "recovery threshold": "recovery threshold", "recovery block delay": "recovery block delay", "available social recovery helpers": "available social recovery helpers", "Verify the password entered above.": "Verify the password entered above.", - "password (repeat)": "password (repeat)" + "password (repeat)": "password (repeat)", + "address forgotten": "address forgotten", + "Forget this address": "Forget this address", + "Send funds to this address": "Send funds to this address", + "My contacts": "My contacts", + "address edited": "address edited", + "address created": "address created", + "Add an address": "Add an address", + "Paste here the address of the contact you want to add to your address book.": "Paste here the address of the contact you want to add to your address book.", + "address": "address", + "Type the name of your contact. This name will be used across all the apps. It can be edited later on.": "Type the name of your contact. This name will be used across all the apps. It can be edited later on.", + "Add contact": "Add contact", + "No contacts found.": "No contacts found.", + "new address": "new address", + "no addresses yet add and existring contact": "no addresses yet add and existring contact", + "no contracts yet, add an existing contact": "no contracts yet, add an existing contact", + "no addresses saved yet, add any existing address": "no addresses saved yet, add any existing address" } diff --git a/packages/apps/public/locales/en/app-address-book.json b/packages/apps/public/locales/en/app-address-book.json deleted file mode 100644 index 1ef7df7963..0000000000 --- a/packages/apps/public/locales/en/app-address-book.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "address forgotten": "address forgotten", - "Forget this address": "Forget this address", - "deposit": "deposit", - "Send funds to this address": "Send funds to this address", - "My contacts": "My contacts", - "address edited": "address edited", - "address created": "address created", - "Add an address": "Add an address", - "Paste here the address of the contact you want to add to your address book.": "Paste here the address of the contact you want to add to your address book.", - "address": "address", - "Type the name of your contact. This name will be used across all the apps. It can be edited later on.": "Type the name of your contact. This name will be used across all the apps. It can be edited later on.", - "name": "name", - "Cancel": "Cancel", - "Save": "Save", - "Add contact": "Add contact", - "No contacts found.": "No contacts found.", - "new address": "new address", - "no tags": "no tags", - "filter by tags": "filter by tags", - "no addresses yet add and existring contact": "no addresses yet add and existring contact", - "no contracts yet, add an existing contact": "no contracts yet, add an existing contact", - "filter by name or tags": "filter by name or tags", - "no addresses saved yet, add any existing address": "no addresses saved yet, add any existing address" -} diff --git a/packages/apps/public/locales/zh/app-accounts.json b/packages/apps/public/locales/zh/app-accounts.json index a1be58f800..86405f95ac 100644 --- a/packages/apps/public/locales/zh/app-accounts.json +++ b/packages/apps/public/locales/zh/app-accounts.json @@ -9,7 +9,7 @@ "Accounts injected from any of these extensions will appear in this application and be available for use. The above list is updated as more extensions with external signing capability become available.": "从这些扩展程序中的任何一个注入的帐户都将出现在此应用程序中并可供使用。 随着更多具有外部签名功能的扩展可用,上面列表将会自动更新.", "Learn more...": "了解更多...", "My accounts": "我的账户", - "Vanity address": "地址美化", + "Vanity generator": "地址美化", "account backed up": "账号已备份", "Backup account": "备份账户", "Cancel": "取消", @@ -95,5 +95,21 @@ "no tags": "没有标签", "filter by tags": "根据标签过滤", "no accounts yet, create or import and existing": "还没有账户, 创建或者导入存在的", - "no accounts yet, create or import an existing": "还没有账户, 创建或者导入一个已经存在的账户" + "no accounts yet, create or import an existing": "还没有账户, 创建或者导入一个已经存在的账户", + "address forgotten": "地址忘记了", + "Forget this address": "忘记这个地址", + "deposit": "存入", + "Send funds to this address": "发送资金到这个地址", + "My contacts": "我的账户", + "address edited": "地址被编辑了", + "address created": "地址被创建了", + "Add an address": "添加一个地址", + "Paste here the address of the contact you want to add to your address book.": "把你想要添加到地址簿的联系人地址粘贴到这里.", + "address": "地址", + "Type the name of your contact. This name will be used across all the apps. It can be edited later on.": "输入联系人的名字. 这个名字在整个app内可用. 稍后课编辑.", + "Add contact": "添加联系人", + "No contacts found.": "没有联系人被找到.", + "new address": "新建地址", + "no addresses yet add and existring contact": "没有地址被添加并且存在联系人", + "no contracts yet, add an existing contact": "没有地址,添加一个存在的联系人" } diff --git a/packages/apps/public/locales/zh/app-address-book.json b/packages/apps/public/locales/zh/app-address-book.json deleted file mode 100644 index bd52325b8e..0000000000 --- a/packages/apps/public/locales/zh/app-address-book.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "address forgotten": "地址忘记了", - "Forget this address": "忘记这个地址", - "deposit": "存入", - "Send funds to this address": "发送资金到这个地址", - "My contacts": "我的账户", - "address edited": "地址被编辑了", - "address created": "地址被创建了", - "Add an address": "添加一个地址", - "Paste here the address of the contact you want to add to your address book.": "把你想要添加到地址簿的联系人地址粘贴到这里.", - "address": "地址", - "Type the name of your contact. This name will be used across all the apps. It can be edited later on.": "输入联系人的名字. 这个名字在整个app内可用. 稍后课编辑.", - "name": "名称", - "Cancel": "取消", - "Save": "保存", - "Add contact": "添加联系人", - "No contacts found.": "没有联系人被找到.", - "new address": "新建地址", - "no tags": "没有标签", - "filter by tags": "使用标签过滤", - "no addresses yet add and existring contact": "没有地址被添加并且存在联系人", - "no contracts yet, add an existing contact": "没有地址,添加一个存在的联系人" -} diff --git a/packages/page-accounts/src/Account.tsx b/packages/page-accounts/src/Accounts/Account.tsx similarity index 99% rename from packages/page-accounts/src/Account.tsx rename to packages/page-accounts/src/Accounts/Account.tsx index 5eba22bd7e..475edb0143 100644 --- a/packages/page-accounts/src/Account.tsx +++ b/packages/page-accounts/src/Accounts/Account.tsx @@ -14,6 +14,7 @@ import { Option } from '@polkadot/types'; import keyring from '@polkadot/ui-keyring'; import { formatBalance, formatNumber } from '@polkadot/util'; +import { useTranslation } from '../translate'; import Backup from './modals/Backup'; import ChangePass from './modals/ChangePass'; import Derive from './modals/Derive'; @@ -21,7 +22,6 @@ import Identity from './modals/Identity'; import RecoverAccount from './modals/RecoverAccount'; import RecoverSetup from './modals/RecoverSetup'; import Transfer from './modals/Transfer'; -import { useTranslation } from './translate'; interface Props { address: string; diff --git a/packages/page-accounts/src/Banner.tsx b/packages/page-accounts/src/Accounts/Banner.tsx similarity index 98% rename from packages/page-accounts/src/Banner.tsx rename to packages/page-accounts/src/Accounts/Banner.tsx index 1fdc97b6c6..fb835c7f92 100644 --- a/packages/page-accounts/src/Banner.tsx +++ b/packages/page-accounts/src/Accounts/Banner.tsx @@ -9,7 +9,7 @@ import { availableExtensions } from '@polkadot/apps-config/extensions'; import { isWeb3Injected } from '@polkadot/extension-dapp'; import { stringUpperFirst } from '@polkadot/util'; -import { useTranslation } from './translate'; +import { useTranslation } from '../translate'; // it would have been really good to import this from detect, however... not exported type Browser = 'chrome' | 'firefox'; diff --git a/packages/page-accounts/src/Overview.tsx b/packages/page-accounts/src/Accounts/index.tsx similarity index 97% rename from packages/page-accounts/src/Overview.tsx rename to packages/page-accounts/src/Accounts/index.tsx index 5439bb2a75..e90a098148 100644 --- a/packages/page-accounts/src/Overview.tsx +++ b/packages/page-accounts/src/Accounts/index.tsx @@ -3,7 +3,7 @@ // of the Apache-2.0 license. See the LICENSE file for details. import { KeyringAddress } from '@polkadot/ui-keyring/types'; -import { ComponentProps as Props } from './types'; +import { ComponentProps as Props } from '../types'; import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; @@ -12,12 +12,12 @@ import { getLedger, isLedger } from '@polkadot/react-api'; import { useAccounts, useFavorites, useToggle } from '@polkadot/react-hooks'; import { Button, Input, Table } from '@polkadot/react-components'; +import { useTranslation } from '../translate'; import CreateModal from './modals/Create'; import ImportModal from './modals/Import'; import QrModal from './modals/Qr'; import Account from './Account'; import Banner from './Banner'; -import { useTranslation } from './translate'; type SortedAccount = { address: string; isFavorite: boolean }; diff --git a/packages/page-accounts/src/modals/Backup.tsx b/packages/page-accounts/src/Accounts/modals/Backup.tsx similarity index 98% rename from packages/page-accounts/src/modals/Backup.tsx rename to packages/page-accounts/src/Accounts/modals/Backup.tsx index a686dfbed7..b82ebfd1fb 100644 --- a/packages/page-accounts/src/modals/Backup.tsx +++ b/packages/page-accounts/src/Accounts/modals/Backup.tsx @@ -9,7 +9,7 @@ import React, { useState, useMemo } from 'react'; import { AddressRow, Button, Modal, Password } from '@polkadot/react-components'; import keyring from '@polkadot/ui-keyring'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; interface Props extends BareProps { onClose: () => void; diff --git a/packages/page-accounts/src/modals/ChangePass.tsx b/packages/page-accounts/src/Accounts/modals/ChangePass.tsx similarity index 99% rename from packages/page-accounts/src/modals/ChangePass.tsx rename to packages/page-accounts/src/Accounts/modals/ChangePass.tsx index 3eb992d384..1078d0fa6a 100644 --- a/packages/page-accounts/src/modals/ChangePass.tsx +++ b/packages/page-accounts/src/Accounts/modals/ChangePass.tsx @@ -9,7 +9,7 @@ import { AddressRow, Button, Modal, Password, TxComponent } from '@polkadot/reac import { ActionStatus } from '@polkadot/react-components/Status/types'; import keyring from '@polkadot/ui-keyring'; -import translate from '../translate'; +import translate from '../../translate'; interface Props extends I18nProps { address: string; diff --git a/packages/page-accounts/src/modals/Create.tsx b/packages/page-accounts/src/Accounts/modals/Create.tsx similarity index 99% rename from packages/page-accounts/src/modals/Create.tsx rename to packages/page-accounts/src/Accounts/modals/Create.tsx index 51d735bc40..7da3d314a0 100644 --- a/packages/page-accounts/src/modals/Create.tsx +++ b/packages/page-accounts/src/Accounts/modals/Create.tsx @@ -5,7 +5,7 @@ import { ActionStatus } from '@polkadot/react-components/Status/types'; import { CreateResult } from '@polkadot/ui-keyring/types'; import { KeypairType } from '@polkadot/util-crypto/types'; -import { ModalProps } from '../types'; +import { ModalProps } from '../../types'; import FileSaver from 'file-saver'; import React, { useMemo, useState } from 'react'; @@ -18,7 +18,7 @@ import uiSettings from '@polkadot/ui-settings'; import { isHex, u8aToHex } from '@polkadot/util'; import { keyExtractSuri, mnemonicGenerate, mnemonicValidate, randomAsU8a } from '@polkadot/util-crypto'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; import CreateConfirmation from './CreateConfirmation'; interface Props extends ModalProps { diff --git a/packages/page-accounts/src/modals/CreateConfirmation.tsx b/packages/page-accounts/src/Accounts/modals/CreateConfirmation.tsx similarity index 96% rename from packages/page-accounts/src/modals/CreateConfirmation.tsx rename to packages/page-accounts/src/Accounts/modals/CreateConfirmation.tsx index 72409b5459..5e4fad30cb 100644 --- a/packages/page-accounts/src/modals/CreateConfirmation.tsx +++ b/packages/page-accounts/src/Accounts/modals/CreateConfirmation.tsx @@ -5,7 +5,7 @@ import React from 'react'; import { AddressRow, Button, Modal } from '@polkadot/react-components'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; interface Props { address: string; diff --git a/packages/page-accounts/src/modals/Derive.tsx b/packages/page-accounts/src/Accounts/modals/Derive.tsx similarity index 99% rename from packages/page-accounts/src/modals/Derive.tsx rename to packages/page-accounts/src/Accounts/modals/Derive.tsx index 61fe8fafc3..92e0202810 100644 --- a/packages/page-accounts/src/modals/Derive.tsx +++ b/packages/page-accounts/src/Accounts/modals/Derive.tsx @@ -12,7 +12,7 @@ import { useDebounce } from '@polkadot/react-hooks'; import keyring from '@polkadot/ui-keyring'; import { keyExtractPath } from '@polkadot/util-crypto'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; import { downloadAccount } from './Create'; import CreateConfirmation from './CreateConfirmation'; diff --git a/packages/page-accounts/src/modals/Identity.tsx b/packages/page-accounts/src/Accounts/modals/Identity.tsx similarity index 99% rename from packages/page-accounts/src/modals/Identity.tsx rename to packages/page-accounts/src/Accounts/modals/Identity.tsx index 96032daf18..12d093c754 100644 --- a/packages/page-accounts/src/modals/Identity.tsx +++ b/packages/page-accounts/src/Accounts/modals/Identity.tsx @@ -12,7 +12,7 @@ import { useApi, useCall } from '@polkadot/react-hooks'; import { Data, Option } from '@polkadot/types'; import { u8aToString } from '@polkadot/util'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; interface Props { address: string; diff --git a/packages/page-accounts/src/modals/Import.tsx b/packages/page-accounts/src/Accounts/modals/Import.tsx similarity index 98% rename from packages/page-accounts/src/modals/Import.tsx rename to packages/page-accounts/src/Accounts/modals/Import.tsx index 26ddc7dd11..a29c4d03f6 100644 --- a/packages/page-accounts/src/modals/Import.tsx +++ b/packages/page-accounts/src/Accounts/modals/Import.tsx @@ -5,14 +5,14 @@ import { KeyringPair$Json } from '@polkadot/keyring/types'; import { I18nProps } from '@polkadot/react-components/types'; import { ActionStatus } from '@polkadot/react-components/Status/types'; -import { ModalProps } from '../types'; +import { ModalProps } from '../../types'; import React from 'react'; import { AddressRow, Button, InputAddress, InputFile, Modal, Password, TxComponent } from '@polkadot/react-components'; import { isHex, isObject, u8aToString } from '@polkadot/util'; import keyring from '@polkadot/ui-keyring'; -import translate from '../translate'; +import translate from '../../translate'; interface Props extends ModalProps, I18nProps {} diff --git a/packages/page-accounts/src/modals/Qr.tsx b/packages/page-accounts/src/Accounts/modals/Qr.tsx similarity index 96% rename from packages/page-accounts/src/modals/Qr.tsx rename to packages/page-accounts/src/Accounts/modals/Qr.tsx index b12eff2bd5..1d83b0d3b5 100644 --- a/packages/page-accounts/src/modals/Qr.tsx +++ b/packages/page-accounts/src/Accounts/modals/Qr.tsx @@ -2,7 +2,7 @@ // This software may be modified and distributed under the terms // of the Apache-2.0 license. See the LICENSE file for details. -import { ModalProps } from '../types'; +import { ModalProps } from '../../types'; import React, { useState } from 'react'; import styled from 'styled-components'; @@ -10,7 +10,7 @@ import { AddressRow, Button, Input, InputAddress, Modal } from '@polkadot/react- import { QrScanAddress } from '@polkadot/react-qr'; import keyring from '@polkadot/ui-keyring'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; interface Scanned { address: string; diff --git a/packages/page-accounts/src/modals/RecoverAccount.tsx b/packages/page-accounts/src/Accounts/modals/RecoverAccount.tsx similarity index 96% rename from packages/page-accounts/src/modals/RecoverAccount.tsx rename to packages/page-accounts/src/Accounts/modals/RecoverAccount.tsx index 13df51df3a..1b1f106daa 100644 --- a/packages/page-accounts/src/modals/RecoverAccount.tsx +++ b/packages/page-accounts/src/Accounts/modals/RecoverAccount.tsx @@ -5,7 +5,7 @@ import React, { useState } from 'react'; import { InputAddress, Modal, TxButton } from '@polkadot/react-components'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; interface Props { address: string; diff --git a/packages/page-accounts/src/modals/RecoverSetup.tsx b/packages/page-accounts/src/Accounts/modals/RecoverSetup.tsx similarity index 98% rename from packages/page-accounts/src/modals/RecoverSetup.tsx rename to packages/page-accounts/src/Accounts/modals/RecoverSetup.tsx index 518edbdfd7..d829f78b81 100644 --- a/packages/page-accounts/src/modals/RecoverSetup.tsx +++ b/packages/page-accounts/src/Accounts/modals/RecoverSetup.tsx @@ -7,7 +7,7 @@ import React, { useEffect, useState } from 'react'; import { InputAddressMulti, InputAddress, InputNumber, Modal, TxButton } from '@polkadot/react-components'; import { useAccounts, useAddresses } from '@polkadot/react-hooks'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; interface Props { address: string; diff --git a/packages/page-accounts/src/modals/Transfer.tsx b/packages/page-accounts/src/Accounts/modals/Transfer.tsx similarity index 64% rename from packages/page-accounts/src/modals/Transfer.tsx rename to packages/page-accounts/src/Accounts/modals/Transfer.tsx index 19771be3f4..137f62b312 100644 --- a/packages/page-accounts/src/modals/Transfer.tsx +++ b/packages/page-accounts/src/Accounts/modals/Transfer.tsx @@ -10,9 +10,8 @@ import styled from 'styled-components'; import { InputAddress, InputBalance, Modal, TxButton } from '@polkadot/react-components'; import { useApi } from '@polkadot/react-hooks'; import { Available } from '@polkadot/react-query'; -// import Checks from '@polkadot/react-signer/Checks'; -import { useTranslation } from '../translate'; +import { useTranslation } from '../../translate'; interface Props { className?: string; @@ -23,43 +22,6 @@ interface Props { const ZERO = new BN(0); -// TODO Re-enable when we have proper fee calculation (incl. weights) -// async function calcMax (api: ApiPromise, balances_fees: DerivedFees | undefined, senderId: string, recipientId: string): Promise { -// let maxBalance = new BN(1); - -// if (!balances_fees) { -// return maxBalance; -// } - -// const { transferFee, transactionBaseFee, transactionByteFee, creationFee } = balances_fees; - -// const [senderNonce, senderBalances, recipientBalances] = await Promise.all([ -// api.query.system.accountNonce(senderId), -// api.derive.balances.all(senderId), -// api.derive.balances.all(recipientId) -// ]); - -// let prevMax = new BN(0); - -// // something goes screwy here when we move this out of the component :( -// let extrinsic: any; - -// while (!prevMax.eq(maxBalance)) { -// prevMax = maxBalance; -// extrinsic = api.tx.balances.transfer(senderNonce, prevMax); - -// const txLength = calcTxLength(extrinsic, senderNonce); -// const fees = transactionBaseFee -// .add(transactionByteFee.mul(txLength)) -// .add(transferFee) -// .add(recipientBalances.availableBalance.isZero() ? creationFee : ZERO); - -// maxBalance = bnMax(senderBalances.availableBalance.sub(fees), ZERO); -// } - -// return maxBalance; -// } - function Transfer ({ className, onClose, recipientId: propRecipientId, senderId: propSenderId }: Props): React.ReactElement { const { t } = useTranslation(); const { api } = useApi(); @@ -71,12 +33,9 @@ function Transfer ({ className, onClose, recipientId: propRecipientId, senderId: const [senderId, setSenderId] = useState(propSenderId || null); useEffect((): void => { - senderId && recipientId && setExtrinsic(api.tx.balances.transfer(recipientId, amount || ZERO)); - - // We currently have not enabled the max functionality - we don't take care of weights - // calcMax(api, balances_fees, senderId, recipientId) - // .then(([maxBalance]): void => setMaxBalance(maxBalance)) - // .catch((error: Error): void => console.error(error)); + senderId && recipientId && setExtrinsic( + () => api.tx.balances.transfer(recipientId, amount || ZERO) + ); }, [amount, recipientId, senderId]); const transferrable = {t('transferrable')}; @@ -116,12 +75,6 @@ function Transfer ({ className, onClose, recipientId: propRecipientId, senderId: onChange={setAmount} withMax /> - {/* */} diff --git a/packages/page-address-book/src/Address.tsx b/packages/page-accounts/src/Contacts/Address.tsx similarity index 98% rename from packages/page-address-book/src/Address.tsx rename to packages/page-accounts/src/Contacts/Address.tsx index 6ecfc0125b..1b8dc11d04 100644 --- a/packages/page-address-book/src/Address.tsx +++ b/packages/page-accounts/src/Contacts/Address.tsx @@ -1,4 +1,4 @@ -// Copyright 2017-2020 @polkadot/app-staking authors & contributors +// Copyright 2017-2020 @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. @@ -11,9 +11,9 @@ import styled from 'styled-components'; import { AddressSmall, AddressInfo, Button, ChainLock, Icon, InputTags, Input, LinkExternal, Forget, Menu, Popup, Tag } from '@polkadot/react-components'; import { useApi, useCall } from '@polkadot/react-hooks'; import keyring from '@polkadot/ui-keyring'; -import Transfer from '@polkadot/app-accounts/modals/Transfer'; -import { useTranslation } from './translate'; +import Transfer from '../Accounts/modals/Transfer'; +import { useTranslation } from '../translate'; interface Props { address: string; diff --git a/packages/page-address-book/src/Overview.tsx b/packages/page-accounts/src/Contacts/index.tsx similarity index 85% rename from packages/page-address-book/src/Overview.tsx rename to packages/page-accounts/src/Contacts/index.tsx index 10af7bd2d2..eebede0b99 100644 --- a/packages/page-address-book/src/Overview.tsx +++ b/packages/page-accounts/src/Contacts/index.tsx @@ -1,17 +1,17 @@ -// Copyright 2017-2020 @polkadot/app-address-book authors & contributors +// Copyright 2017-2020 @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 { ComponentProps as Props } from './types'; +import { ComponentProps as Props } from '../types'; import React, { useEffect, useState } from 'react'; import styled from 'styled-components'; import { Button, Input, Table } from '@polkadot/react-components'; -import { useAddresses, useFavorites } from '@polkadot/react-hooks'; +import { useAddresses, useFavorites, useToggle } from '@polkadot/react-hooks'; import CreateModal from './modals/Create'; import Address from './Address'; -import { useTranslation } from './translate'; +import { useTranslation } from '../translate'; type SortedAddress = { address: string; isFavorite: boolean }; @@ -20,7 +20,7 @@ const STORE_FAVS = 'accounts:favorites'; function Overview ({ className, onStatusChange }: Props): React.ReactElement { const { t } = useTranslation(); const { hasAddresses, allAddresses } = useAddresses(); - const [isCreateOpen, setIsCreateOpen] = useState(false); + const [isCreateOpen, toggleCreate] = useToggle(false); const [favorites, toggleFavorite] = useFavorites(STORE_FAVS); const [sortedAddresses, setSortedAddresses] = useState([]); const [filter, setFilter] = useState(''); @@ -39,20 +39,18 @@ function Overview ({ className, onStatusChange }: Props): React.ReactElement setIsCreateOpen(!isCreateOpen); - return (