mirror of
https://github.com/trezor/trezor-suite.git
synced 2026-02-20 00:33:07 +01:00
fix(suite): remove circular dependency in AssetsView
- Extracted AssetData type to separate types.ts file - AssetTable now imports type directly instead of from AssetsView - This breaks the circular import between AssetTable and AssetsView - Resolves: packages/suite/src/views/dashboard/AssetsView/AssetTable/AssetTable.tsx > packages/suite/src/views/dashboard/AssetsView/AssetsView.tsx
This commit is contained in:
@@ -5,7 +5,7 @@ import type { BaseCurrencyCode } from '@trezor/blockchain-link-types';
|
||||
import { Table } from '@trezor/components';
|
||||
import { spacings } from '@trezor/theme';
|
||||
|
||||
import { AssetData } from '../AssetsView';
|
||||
import type { AssetData } from '../types';
|
||||
import { AssetRow } from './AssetRow';
|
||||
import { AssetRowSkeleton } from './AssetRowSkeleton';
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ import styled, { useTheme } from 'styled-components';
|
||||
import { Translation } from '@suite/intl';
|
||||
import { AssetFiatBalance } from '@suite-common/assets';
|
||||
import {
|
||||
type Network,
|
||||
type NetworkSymbol,
|
||||
getNetwork,
|
||||
getNetworkFeatures,
|
||||
@@ -18,7 +17,6 @@ import {
|
||||
import { RatesByKey } from '@suite-common/wallet-types';
|
||||
import {
|
||||
AMOUNT_UNIT_ZERO,
|
||||
AmountUnit,
|
||||
BASE_CURRENCY_ZERO,
|
||||
asAmountUnit,
|
||||
getFiatRateKey,
|
||||
@@ -44,6 +42,7 @@ import { selectDiscoveryOverallStatus } from 'src/utils/wallet/selectDiscoveryOv
|
||||
|
||||
import { AssetCard, AssetCardSkeleton } from './AssetCard/AssetCard';
|
||||
import { AssetTable } from './AssetTable/AssetTable';
|
||||
import type { AssetData } from './types';
|
||||
|
||||
const InfoMessage = styled.div`
|
||||
padding: ${spacingsPx.md} ${spacingsPx.xl};
|
||||
@@ -59,16 +58,6 @@ const GridWrapper = styled.div`
|
||||
grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
|
||||
`;
|
||||
|
||||
export type AssetData = {
|
||||
network: Network;
|
||||
failed: boolean;
|
||||
assetNativeCryptoBalance: AmountUnit;
|
||||
stakingAccounts: Account[];
|
||||
assetTokens: TokenInfo[];
|
||||
isStakeNetwork?: boolean;
|
||||
accounts: Account[];
|
||||
};
|
||||
|
||||
const useAssetsFiatBalances = (
|
||||
assetsData: AssetData[],
|
||||
accounts: { [key: string]: Account[] },
|
||||
|
||||
14
packages/suite/src/views/dashboard/AssetsView/types.ts
Normal file
14
packages/suite/src/views/dashboard/AssetsView/types.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import type { Network } from '@suite-common/wallet-config';
|
||||
import type { Account } from '@suite-common/wallet-types';
|
||||
import type { AmountUnit } from '@suite-common/wallet-utils';
|
||||
import type { TokenInfo } from '@trezor/blockchain-link-types';
|
||||
|
||||
export type AssetData = {
|
||||
network: Network;
|
||||
failed: boolean;
|
||||
assetNativeCryptoBalance: AmountUnit;
|
||||
stakingAccounts: Account[];
|
||||
assetTokens: TokenInfo[];
|
||||
isStakeNetwork?: boolean;
|
||||
accounts: Account[];
|
||||
};
|
||||
@@ -53,7 +53,6 @@ packages/suite/src/components/suite/troubleshooting/TroubleshootingTips.tsx > pa
|
||||
packages/suite/src/components/wallet/Fees/CollapsibleFees/CustomFee/CustomFee.tsx > packages/suite/src/components/wallet/Fees/CollapsibleFees/CustomFee/CustomFeeMisc.tsx
|
||||
packages/suite/src/utils/wallet/graph/utils.ts > packages/suite/src/utils/wallet/graph/utilsShared.ts > packages/suite/src/utils/wallet/graph/utilsWorker.ts
|
||||
packages/suite/src/utils/wallet/graph/utilsShared.ts > packages/suite/src/utils/wallet/graph/utilsWorker.ts
|
||||
packages/suite/src/views/dashboard/AssetsView/AssetTable/AssetTable.tsx > packages/suite/src/views/dashboard/AssetsView/AssetsView.tsx
|
||||
suite-common/graph/src/graphDataFetching.ts > suite-common/graph/src/graphUtils.ts
|
||||
suite-common/wallet-core/src/stake/stakeThunks.ts > suite-common/wallet-core/src/stake/stakeSelectors.ts > suite-common/wallet-core/src/stake/stakeReducer.ts
|
||||
suite-common/wallet-core/src/transactions/transactionsSelectors.ts > suite-common/wallet-core/src/transactions/transactionsReducer.ts > suite-common/wallet-core/src/transactions/transactionsThunks.ts
|
||||
|
||||
Reference in New Issue
Block a user