From a7432792ab206d82fe6be91ea0b8f3c108af606d Mon Sep 17 00:00:00 2001
From: Anastasiia Sokolova <63446892+sokolova-an@users.noreply.github.com>
Date: Tue, 19 Nov 2024 22:07:22 +0700
Subject: [PATCH] fix: switch to the new Account component (#2687)
---
.../AddProxy/ui/Confirmation.tsx | 15 +++++----------
.../BondNominate/ui/Confirmation.tsx | 12 ++++--------
.../Delegate/ui/Confirmation.tsx | 8 ++++----
.../EditDelegation/ui/Confirmation.tsx | 8 ++++----
.../Payee/ui/Confirmation.tsx | 11 ++++-------
.../RemoveProxy/ui/Confirmation.tsx | 18 ++++++------------
.../RemovePureProxied/ui/Confirmation.tsx | 15 ++++-----------
.../RevokeDelegation/ui/Confirmation.tsx | 8 ++++----
.../Transfer/ui/Confirmation.tsx | 15 ++++-----------
.../ui-entities/Account/Account.stories.tsx | 2 +-
.../shared/ui-entities/Account/Account.tsx | 10 +++++-----
.../TransactionDetails/TransactionDetails.tsx | 6 +++---
.../DelegateDetails/ui/YourDelegation.tsx | 2 +-
13 files changed, 49 insertions(+), 81 deletions(-)
diff --git a/src/renderer/features/operations/OperationsConfirm/AddProxy/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/AddProxy/ui/Confirmation.tsx
index f03ad5f44..d039cde90 100644
--- a/src/renderer/features/operations/OperationsConfirm/AddProxy/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/AddProxy/ui/Confirmation.tsx
@@ -2,14 +2,15 @@ import { useStoreMap, useUnit } from 'effector-react';
import { type ReactNode, useState } from 'react';
import { useI18n } from '@/shared/i18n';
+import { toAccountId } from '@/shared/lib/utils';
import { Button, DetailRow, FootnoteText, Icon, Tooltip } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { AssetBalance } from '@/entities/asset';
import { SignButton } from '@/entities/operations';
import { AssetFiatBalance } from '@/entities/price';
import { proxyUtils } from '@/entities/proxy';
import { FeeWithLabel, MultisigDepositWithLabel } from '@/entities/transaction';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
import { confirmModel } from '../model/confirm-model';
@@ -75,14 +76,8 @@ export const Confirmation = ({ id = 0, onGoBack, secondaryActionButton, hideSign
{t(proxyUtils.getProxyTypeName(confirmStore.proxyType))}
-
-
+
+
diff --git a/src/renderer/features/operations/OperationsConfirm/BondNominate/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/BondNominate/ui/Confirmation.tsx
index d213d2c78..5b2600cef 100644
--- a/src/renderer/features/operations/OperationsConfirm/BondNominate/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/BondNominate/ui/Confirmation.tsx
@@ -3,14 +3,14 @@ import { type ReactNode } from 'react';
import { useI18n } from '@/shared/i18n';
import { useToggle } from '@/shared/lib/hooks';
-import { formatAmount } from '@/shared/lib/utils';
+import { formatAmount, toAccountId } from '@/shared/lib/utils';
import { Button, CaptionText, DetailRow, FootnoteText, Icon, Tooltip } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { AssetBalance } from '@/entities/asset';
import { SignButton } from '@/entities/operations';
import { AssetFiatBalance } from '@/entities/price';
import { AccountsModal, SelectedValidatorsModal, StakingPopover, UnstakingDuration } from '@/entities/staking';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { type Config } from '../../../OperationsValidation';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
import { confirmModel } from '../model/confirm-model';
@@ -118,11 +118,7 @@ export const Confirmation = ({
{confirmStore.destination ? (
-
+
) : (
{t('staking.confirmation.restakeRewards')}
)}
diff --git a/src/renderer/features/operations/OperationsConfirm/Delegate/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/Delegate/ui/Confirmation.tsx
index 184b345d3..95bb8e517 100644
--- a/src/renderer/features/operations/OperationsConfirm/Delegate/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/Delegate/ui/Confirmation.tsx
@@ -4,15 +4,15 @@ import { type ReactNode } from 'react';
import { Trans } from 'react-i18next';
import { useI18n } from '@/shared/i18n';
-import { formatAmount } from '@/shared/lib/utils';
+import { formatAmount, toAccountId } from '@/shared/lib/utils';
import { Button, DetailRow, FootnoteText, HeadlineText, Icon, LargeTitleText, Loader, Tooltip } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { Box } from '@/shared/ui-kit';
import { AssetBalance } from '@/entities/asset';
import { BalanceDiff, LockPeriodDiff, LockValueDiff, TracksDetails, votingService } from '@/entities/governance';
import { SignButton } from '@/entities/operations';
import { AssetFiatBalance } from '@/entities/price';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { lockPeriodsModel, locksPeriodsAggregate } from '@/features/governance';
import { type Config } from '../../../OperationsValidation';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
@@ -133,7 +133,7 @@ export const Confirmation = ({
proxied={confirmStore.proxiedAccount}
>
-
+
diff --git a/src/renderer/features/operations/OperationsConfirm/EditDelegation/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/EditDelegation/ui/Confirmation.tsx
index 3f15a9114..c12c10f03 100644
--- a/src/renderer/features/operations/OperationsConfirm/EditDelegation/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/EditDelegation/ui/Confirmation.tsx
@@ -4,15 +4,15 @@ import { type ReactNode } from 'react';
import { Trans } from 'react-i18next';
import { useI18n } from '@/shared/i18n';
-import { formatAmount } from '@/shared/lib/utils';
+import { formatAmount, toAccountId } from '@/shared/lib/utils';
import { Button, DetailRow, FootnoteText, HeadlineText, Icon, LargeTitleText, Loader, Tooltip } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { Box } from '@/shared/ui-kit';
import { AssetBalance } from '@/entities/asset';
import { BalanceDiff, LockPeriodDiff, LockValueDiff, TracksDetails, votingService } from '@/entities/governance';
import { SignButton } from '@/entities/operations';
import { AssetFiatBalance } from '@/entities/price';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { lockPeriodsModel, locksPeriodsAggregate } from '@/features/governance';
import { type Config } from '../../../OperationsValidation';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
@@ -133,7 +133,7 @@ export const Confirmation = ({
proxied={confirmStore.proxiedAccount}
>
-
+
diff --git a/src/renderer/features/operations/OperationsConfirm/Payee/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/Payee/ui/Confirmation.tsx
index 3e397d653..8fa65033d 100644
--- a/src/renderer/features/operations/OperationsConfirm/Payee/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/Payee/ui/Confirmation.tsx
@@ -3,13 +3,14 @@ import { type ReactNode } from 'react';
import { useI18n } from '@/shared/i18n';
import { useToggle } from '@/shared/lib/hooks';
+import { toAccountId } from '@/shared/lib/utils';
import { Button, DetailRow, FootnoteText, Icon, Tooltip } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { AssetBalance } from '@/entities/asset';
import { SignButton } from '@/entities/operations';
import { AssetFiatBalance } from '@/entities/price';
import { AccountsModal } from '@/entities/staking';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
import { confirmModel } from '../model/confirm-model';
@@ -68,11 +69,7 @@ export const Confirmation = ({ id = 0, onGoBack, secondaryActionButton, hideSign
>
{confirmStore.destination ? (
-
+
) : (
{t('staking.confirmation.restakeRewards')}
)}
diff --git a/src/renderer/features/operations/OperationsConfirm/RemoveProxy/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/RemoveProxy/ui/Confirmation.tsx
index e904ae134..8bce64b55 100644
--- a/src/renderer/features/operations/OperationsConfirm/RemoveProxy/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/RemoveProxy/ui/Confirmation.tsx
@@ -2,13 +2,13 @@ import { useStoreMap, useUnit } from 'effector-react';
import { type ReactNode, useState } from 'react';
import { useI18n } from '@/shared/i18n';
-import { toAddress } from '@/shared/lib/utils';
+import { toAccountId } from '@/shared/lib/utils';
import { Button, DetailRow, FootnoteText, Icon } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { SignButton } from '@/entities/operations';
import { proxyUtils } from '@/entities/proxy';
import { FeeWithLabel, MultisigDepositWithLabel } from '@/entities/transaction';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
import { confirmModel } from '../model/confirm-model';
@@ -70,18 +70,12 @@ export const Confirmation = ({ id = 0, onGoBack, secondaryActionButton, hideSign
signatory={confirmStore.signatory}
proxied={confirmStore.proxiedAccount}
>
-
+
{t(proxyUtils.getProxyTypeName(confirmStore.proxyType))}
-
-
+
+
diff --git a/src/renderer/features/operations/OperationsConfirm/RemovePureProxied/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/RemovePureProxied/ui/Confirmation.tsx
index 8c7e5d272..640b302ad 100644
--- a/src/renderer/features/operations/OperationsConfirm/RemovePureProxied/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/RemovePureProxied/ui/Confirmation.tsx
@@ -3,13 +3,12 @@ import { type ReactNode, useState } from 'react';
import { ProxyType } from '@/shared/core';
import { useI18n } from '@/shared/i18n';
-import { toAddress } from '@/shared/lib/utils';
import { Button, DetailRow, FootnoteText, Icon } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { SignButton } from '@/entities/operations';
import { proxyUtils } from '@/entities/proxy';
import { FeeWithLabel, MultisigDepositWithLabel } from '@/entities/transaction';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
import { confirmModel } from '../model/confirm-model';
@@ -75,14 +74,8 @@ export const Confirmation = ({ id = 0, secondaryActionButton, hideSignButton, on
{t(proxyUtils.getProxyTypeName(ProxyType.ANY))}
-
-
+
+
diff --git a/src/renderer/features/operations/OperationsConfirm/RevokeDelegation/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/RevokeDelegation/ui/Confirmation.tsx
index 611cb92ae..3cb0b763a 100644
--- a/src/renderer/features/operations/OperationsConfirm/RevokeDelegation/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/RevokeDelegation/ui/Confirmation.tsx
@@ -4,15 +4,15 @@ import { type ReactNode } from 'react';
import { Trans } from 'react-i18next';
import { useI18n } from '@/shared/i18n';
-import { formatAmount } from '@/shared/lib/utils';
+import { formatAmount, toAccountId } from '@/shared/lib/utils';
import { Button, DetailRow, FootnoteText, HeadlineText, Icon, LargeTitleText, Loader, Tooltip } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { Box } from '@/shared/ui-kit';
import { AssetBalance } from '@/entities/asset';
import { BalanceDiff, LockPeriodDiff, LockValueDiff, TracksDetails, votingService } from '@/entities/governance';
import { SignButton } from '@/entities/operations';
import { AssetFiatBalance } from '@/entities/price';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { lockPeriodsModel, locksPeriodsAggregate } from '@/features/governance';
import { type Config } from '../../../OperationsValidation';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
@@ -134,7 +134,7 @@ export const Confirmation = ({
proxied={confirmStore.proxiedAccount}
>
-
+
diff --git a/src/renderer/features/operations/OperationsConfirm/Transfer/ui/Confirmation.tsx b/src/renderer/features/operations/OperationsConfirm/Transfer/ui/Confirmation.tsx
index a3e2f6f92..3ffbc70eb 100644
--- a/src/renderer/features/operations/OperationsConfirm/Transfer/ui/Confirmation.tsx
+++ b/src/renderer/features/operations/OperationsConfirm/Transfer/ui/Confirmation.tsx
@@ -4,12 +4,12 @@ import { type ReactNode } from 'react';
import { TEST_IDS } from '@/shared/constants';
import { useI18n } from '@/shared/i18n';
import { Button, DetailRow, FootnoteText, Icon, Tooltip } from '@/shared/ui';
-import { TransactionDetails } from '@/shared/ui-entities';
+import { Account, TransactionDetails } from '@/shared/ui-entities';
import { AssetBalance } from '@/entities/asset';
import { ChainTitle } from '@/entities/chain';
import { SignButton } from '@/entities/operations';
import { AssetFiatBalance } from '@/entities/price';
-import { AddressWithExplorers, accountUtils, walletModel } from '@/entities/wallet';
+import { accountUtils, walletModel } from '@/entities/wallet';
import { MultisigExistsAlert } from '../../common/MultisigExistsAlert';
import { confirmModel } from '../model/confirm-model';
@@ -88,15 +88,8 @@ export const Confirmation = ({ id = 0, secondaryActionButton, hideSignButton, on
)}
-
-
+
+
diff --git a/src/renderer/shared/ui-entities/Account/Account.stories.tsx b/src/renderer/shared/ui-entities/Account/Account.stories.tsx
index 44fbf036c..096576801 100644
--- a/src/renderer/shared/ui-entities/Account/Account.stories.tsx
+++ b/src/renderer/shared/ui-entities/Account/Account.stories.tsx
@@ -8,7 +8,7 @@ const meta: Meta = {
title: 'Design System/entities/Account',
component: Account,
args: {
- account: createBaseAccount(),
+ accountId: createBaseAccount().accountId,
chain: polkadotChain,
},
};
diff --git a/src/renderer/shared/ui-entities/Account/Account.tsx b/src/renderer/shared/ui-entities/Account/Account.tsx
index a54f415bf..a41dad066 100644
--- a/src/renderer/shared/ui-entities/Account/Account.tsx
+++ b/src/renderer/shared/ui-entities/Account/Account.tsx
@@ -1,27 +1,27 @@
import { memo } from 'react';
-import { type Account as AccountType, type Chain } from '@/shared/core';
+import { type AccountId, type Chain } from '@/shared/core';
import { toAddress } from '@/shared/lib/utils';
import { AccountExplorers } from '../AccountExplorer/AccountExplorers';
import { Address } from '../Address/Address';
type Props = {
- account: AccountType;
+ accountId: AccountId;
title?: string;
chain: Chain;
variant?: 'truncate' | 'short';
};
-export const Account = memo(({ account, title, variant = 'truncate', chain }: Props) => {
+export const Account = memo(({ accountId, title, variant = 'truncate', chain }: Props) => {
return (
);
});
diff --git a/src/renderer/shared/ui-entities/TransactionDetails/TransactionDetails.tsx b/src/renderer/shared/ui-entities/TransactionDetails/TransactionDetails.tsx
index e592985a8..6e11f6461 100644
--- a/src/renderer/shared/ui-entities/TransactionDetails/TransactionDetails.tsx
+++ b/src/renderer/shared/ui-entities/TransactionDetails/TransactionDetails.tsx
@@ -67,7 +67,7 @@ export const TransactionDetails = memo(({ wallets, chain, proxied, initiator, si
{initiator.length}
)}
- {initiator.length === 1 && }
+ {initiator.length === 1 && }
{initiator.length > 1 && (