Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: re-organize files under assets folder #25897

Merged
merged 9 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ui/components/app/app-components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
@import 'alert-system/alert-modal/index';
@import 'alert-system/inline-alert/index';
@import 'import-token/index';
@import 'nfts-items/index';
@import 'nfts-tab/index';
@import 'nft-details/index';
@import 'nft-default-image/index';
@import 'nft-options/index';
@import 'assets/nfts/nfts-items/index';
@import 'assets/nfts/nfts-tab/index';
@import 'assets/nfts/nft-details/index';
@import 'assets/nfts/nft-default-image/index';
@import 'assets/nfts/nft-options/index';
@import 'connected-accounts-list/index';
@import 'connected-accounts-permissions/index';
@import 'connected-sites-list/index';
Expand Down Expand Up @@ -46,13 +46,13 @@
@import 'recovery-phrase-reminder/index';
@import 'step-progress-bar/index.scss';
@import 'selected-account/index';
@import 'auto-detect-token/index';
@import 'assets/auto-detect-token/index';
@import 'smart-transactions/index';
@import 'srp-input/srp-input';
@import 'snaps/snap-privacy-warning/index';
@import 'tab-bar/index';
@import 'token-cell/token-cell';
@import 'token-list-display/token-list-display';
@import 'assets/token-cell/token-cell';
@import 'assets/token-list-display/token-list-display';
@import 'transaction-activity-log/index';
@import 'transaction-breakdown/index';
@import 'transaction-icon/transaction-icon';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import React, { useContext, useState } from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import TokenList from '../token-list';
import { PRIMARY, SECONDARY } from '../../../helpers/constants/common';
import { useUserPreferencedCurrency } from '../../../hooks/useUserPreferencedCurrency';
import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common';
import { useUserPreferencedCurrency } from '../../../../hooks/useUserPreferencedCurrency';
import {
getDetectedTokensInCurrentNetwork,
getIstokenDetectionInactiveOnNonMainnetSupportedNetwork,
getShouldHideZeroBalanceTokens,
getSelectedAccount,
getPreferences,
} from '../../../selectors';
} from '../../../../selectors';
import {
getMultichainCurrentNetwork,
getMultichainNativeCurrency,
Expand All @@ -23,33 +23,33 @@ import {
getMultichainIsBitcoin,
///: END:ONLY_INCLUDE_IF
getMultichainSelectedAccountCachedBalanceIsZero,
} from '../../../selectors/multichain';
import { useCurrencyDisplay } from '../../../hooks/useCurrencyDisplay';
import { MetaMetricsContext } from '../../../contexts/metametrics';
} from '../../../../selectors/multichain';
import { useCurrencyDisplay } from '../../../../hooks/useCurrencyDisplay';
import { MetaMetricsContext } from '../../../../contexts/metametrics';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import DetectedToken from '../detected-token/detected-token';
} from '../../../../../shared/constants/metametrics';
import DetectedToken from '../../detected-token/detected-token';
import {
DetectedTokensBanner,
TokenListItem,
ImportTokenLink,
ReceiveTokenLink,
} from '../../multichain';
import { useAccountTotalFiatBalance } from '../../../hooks/useAccountTotalFiatBalance';
import { useIsOriginalNativeTokenSymbol } from '../../../hooks/useIsOriginalNativeTokenSymbol';
} from '../../../multichain';
import { useAccountTotalFiatBalance } from '../../../../hooks/useAccountTotalFiatBalance';
import { useIsOriginalNativeTokenSymbol } from '../../../../hooks/useIsOriginalNativeTokenSymbol';
import {
showPrimaryCurrency,
showSecondaryCurrency,
} from '../../../../shared/modules/currency-display.utils';
import { roundToDecimalPlacesRemovingExtraZeroes } from '../../../helpers/utils/util';
} from '../../../../../shared/modules/currency-display.utils';
import { roundToDecimalPlacesRemovingExtraZeroes } from '../../../../helpers/utils/util';
///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask)
import {
RAMPS_CARD_VARIANT_TYPES,
RampsCard,
} from '../../multichain/ramps-card/ramps-card';
import { getIsNativeTokenBuyable } from '../../../ducks/ramps';
} from '../../../multichain/ramps-card/ramps-card';
import { getIsNativeTokenBuyable } from '../../../../ducks/ramps';
///: END:ONLY_INCLUDE_IF

const AssetList = ({ onClickAsset, showTokensLinks }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import React from 'react';
import { renderWithProvider } from '../../../../test/jest';
import configureStore from '../../../store/store';
import mockState from '../../../../test/data/mock-state.json';
import { CHAIN_IDS, NETWORK_TYPES } from '../../../../shared/constants/network';
import { useIsOriginalNativeTokenSymbol } from '../../../hooks/useIsOriginalNativeTokenSymbol';
import { getSelectedInternalAccountFromMockState } from '../../../../test/jest/mocks';
import { renderWithProvider } from '../../../../../test/jest';
import configureStore from '../../../../store/store';
import mockState from '../../../../../test/data/mock-state.json';
import {
CHAIN_IDS,
NETWORK_TYPES,
} from '../../../../../shared/constants/network';
import { useIsOriginalNativeTokenSymbol } from '../../../../hooks/useIsOriginalNativeTokenSymbol';
import { getSelectedInternalAccountFromMockState } from '../../../../../test/jest/mocks';
import AssetList from './asset-list';

// Specific to just the ETH FIAT conversion
const ETH_BALANCE = '0x041173b2c0e57d'; // 0.0011 ETH ($1.83)

jest.mock('../../../hooks/useIsOriginalNativeTokenSymbol', () => {
jest.mock('../../../../hooks/useIsOriginalNativeTokenSymbol', () => {
return {
useIsOriginalNativeTokenSymbol: jest.fn(),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React from 'react';
import { screen, act, waitFor } from '@testing-library/react';
import { renderWithProvider } from '../../../../test/jest';
import configureStore from '../../../store/store';
import mockState from '../../../../test/data/mock-state.json';
import { CHAIN_IDS, NETWORK_TYPES } from '../../../../shared/constants/network';
import { useIsOriginalNativeTokenSymbol } from '../../../hooks/useIsOriginalNativeTokenSymbol';
import { getTokenSymbol } from '../../../store/actions';
import { getSelectedInternalAccountFromMockState } from '../../../../test/jest/mocks';
import { renderWithProvider } from '../../../../../test/jest';
import configureStore from '../../../../store/store';
import mockState from '../../../../../test/data/mock-state.json';
import {
CHAIN_IDS,
NETWORK_TYPES,
} from '../../../../../shared/constants/network';
import { useIsOriginalNativeTokenSymbol } from '../../../../hooks/useIsOriginalNativeTokenSymbol';
import { getTokenSymbol } from '../../../../store/actions';
import { getSelectedInternalAccountFromMockState } from '../../../../../test/jest/mocks';
import AssetList from './asset-list';

// Specific to just the ETH FIAT conversion
Expand Down Expand Up @@ -44,7 +47,7 @@ let mockTokens = [
},
];

jest.mock('../../../hooks/useTokenTracker', () => {
jest.mock('../../../../hooks/useTokenTracker', () => {
return {
useTokenTracker: () => ({
loading: false,
Expand All @@ -54,13 +57,13 @@ jest.mock('../../../hooks/useTokenTracker', () => {
};
});

jest.mock('../../../hooks/useIsOriginalNativeTokenSymbol', () => {
jest.mock('../../../../hooks/useIsOriginalNativeTokenSymbol', () => {
return {
useIsOriginalNativeTokenSymbol: jest.fn(),
};
});

jest.mock('../../../store/actions', () => {
jest.mock('../../../../store/actions', () => {
return {
getTokenSymbol: jest.fn(),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Provider } from 'react-redux';
import testData from '../../../../.storybook/test-data';
import configureStore from '../../../store/store';
import testData from '../../../../../.storybook/test-data';
import configureStore from '../../../../store/store';
import AutoDetectNftModal from './auto-detect-nft-modal';

const customData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import { useDispatch } from 'react-redux';
import configureMockStore from 'redux-mock-store';
import mockState from '../../../../test/data/mock-state.json';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import mockState from '../../../../../test/data/mock-state.json';
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
import AutoDetectNftModal from './auto-detect-nft-modal';

// Mock store setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
Text,
ModalBody,
ModalFooter,
} from '../../component-library';
import { useI18nContext } from '../../../hooks/useI18nContext';
} from '../../../component-library';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import {
AlignItems,
BorderRadius,
Expand All @@ -20,15 +20,18 @@ import {
JustifyContent,
TextAlign,
TextVariant,
} from '../../../helpers/constants/design-system';
import { setOpenSeaEnabled, setUseNftDetection } from '../../../store/actions';
import { MetaMetricsContext } from '../../../contexts/metametrics';
} from '../../../../helpers/constants/design-system';
import {
setOpenSeaEnabled,
setUseNftDetection,
} from '../../../../store/actions';
import { MetaMetricsContext } from '../../../../contexts/metametrics';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import { getProviderConfig } from '../../../ducks/metamask/metamask';
import { ORIGIN_METAMASK } from '../../../../shared/constants/app';
} from '../../../../../shared/constants/metametrics';
import { getProviderConfig } from '../../../../ducks/metamask/metamask';
import { ORIGIN_METAMASK } from '../../../../../shared/constants/app';

type AutoDetectNftModalProps = {
isOpen: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Provider } from 'react-redux';
import testData from '../../../../.storybook/test-data';
import configureStore from '../../../store/store';
import testData from '../../../../../.storybook/test-data';
import configureStore from '../../../../store/store';
import AutoDetectTokenModal from './auto-detect-token-modal';

const customData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import { useDispatch } from 'react-redux';
import configureMockStore from 'redux-mock-store';
import mockState from '../../../../test/data/mock-state.json';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import mockState from '../../../../../test/data/mock-state.json';
import { renderWithProvider } from '../../../../../test/lib/render-helpers';
import AutoDetectTokenModal from './auto-detect-token-modal';

// Mock store setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
Text,
ModalBody,
ModalFooter,
} from '../../component-library';
import { useI18nContext } from '../../../hooks/useI18nContext';
} from '../../../component-library';
import { useI18nContext } from '../../../../hooks/useI18nContext';
import {
AlignItems,
BorderRadius,
Expand All @@ -20,16 +20,16 @@ import {
JustifyContent,
TextAlign,
TextVariant,
} from '../../../helpers/constants/design-system';
import { setUseTokenDetection } from '../../../store/actions';
import { MetaMetricsContext } from '../../../contexts/metametrics';
} from '../../../../helpers/constants/design-system';
import { setUseTokenDetection } from '../../../../store/actions';
import { MetaMetricsContext } from '../../../../contexts/metametrics';
import {
MetaMetricsEventCategory,
MetaMetricsEventName,
} from '../../../../shared/constants/metametrics';
import { getProviderConfig } from '../../../ducks/metamask/metamask';
import { getCurrentLocale } from '../../../ducks/locale/locale';
import { ORIGIN_METAMASK } from '../../../../shared/constants/app';
} from '../../../../../shared/constants/metametrics';
import { getProviderConfig } from '../../../../ducks/metamask/metamask';
import { getCurrentLocale } from '../../../../ducks/locale/locale';
import { ORIGIN_METAMASK } from '../../../../../shared/constants/app';

type AutoDetectTokenModalProps = {
isOpen: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import {
AlignItems,
JustifyContent,
BorderRadius,
} from '../../../helpers/constants/design-system';
import { useI18nContext } from '../../../hooks/useI18nContext';
import { ButtonLink, Box } from '../../component-library';
import { showIpfsModal } from '../../../store/actions';
} from '../../../../../helpers/constants/design-system';
import { useI18nContext } from '../../../../../hooks/useI18nContext';
import { ButtonLink, Box } from '../../../../component-library';
import { showIpfsModal } from '../../../../../store/actions';

export default function NftDefaultImage({ className, clickable }) {
const t = useI18nContext();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import configureStore from 'redux-mock-store';
import { renderWithProvider } from '../../../../test/lib/render-helpers';
import mockState from '../../../../test/data/mock-state.json';
import { renderWithProvider } from '../../../../../../test/lib/render-helpers';
import mockState from '../../../../../../test/data/mock-state.json';
import NftDefaultImage from '.';

describe('NFT Default Image', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ import {
Modal,
ModalOverlay,
Text,
} from '../../component-library';
import { ModalContent } from '../../component-library/modal-content/deprecated';
import { ModalHeader } from '../../component-library/modal-header/deprecated';
import { useI18nContext } from '../../../hooks/useI18nContext';
} from '../../../../component-library';
import { ModalContent } from '../../../../component-library/modal-content/deprecated';
import { ModalHeader } from '../../../../component-library/modal-header/deprecated';
import { useI18nContext } from '../../../../../hooks/useI18nContext';
import {
hideIpfsModal,
setIpfsGateway,
setIsIpfsGatewayEnabled,
} from '../../../store/actions';
import { IPFS_DEFAULT_GATEWAY_URL } from '../../../../shared/constants/network';
} from '../../../../../store/actions';
import { IPFS_DEFAULT_GATEWAY_URL } from '../../../../../../shared/constants/network';
import {
Size,
TextColor,
TextVariant,
} from '../../../helpers/constants/design-system';
} from '../../../../../helpers/constants/design-system';

export const ToggleIpfsModal = ({ onClose }) => {
const t = useI18nContext();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import React, { useState } from 'react';
import useIsOverflowing from '../../../hooks/snaps/useIsOverflowing';
import { Box, Button, ButtonVariant, Text } from '../../component-library';
import { useI18nContext } from '../../../hooks/useI18nContext';
import useIsOverflowing from '../../../../../hooks/snaps/useIsOverflowing';
import {
Box,
Button,
ButtonVariant,
Text,
} from '../../../../component-library';
import { useI18nContext } from '../../../../../hooks/useI18nContext';
import {
FontWeight,
TextColor,
TextVariant,
} from '../../../helpers/constants/design-system';
} from '../../../../../helpers/constants/design-system';

const NftDetailDescription = ({ value }: { value: string | null }) => {
const t = useI18nContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
TextAlign,
TextColor,
TextVariant,
} from '../../../helpers/constants/design-system';
import { ButtonIcon, IconName, IconSize } from '../../component-library';
} from '../../../../../helpers/constants/design-system';
import { ButtonIcon, IconName, IconSize } from '../../../../component-library';
import NftDetailInformationFrame from './nft-detail-information-frame';

export default {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';

import { Box, Text } from '../../component-library';
import { Box, Text } from '../../../../component-library';
import {
AlignItems,
Display,
JustifyContent,
} from '../../../helpers/constants/design-system';
} from '../../../../../helpers/constants/design-system';

type NftDetailInformationFrameProps = {
title?: string;
Expand Down
Loading
Loading