Skip to content

Commit d56a56c

Browse files
adderpositivetomasklim
authored andcommitted
feat(trade): extended swap network tabs
1 parent 360b22b commit d56a56c

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

packages/product-components/src/components/SelectAssetModal/NetworkTabs.tsx

+6-19
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@ import { FormattedMessage } from 'react-intl';
22

33
import styled from 'styled-components';
44

5-
import { AssetLogo, Row, Tooltip, useElevation } from '@trezor/components';
5+
import { Row, Tooltip, useElevation } from '@trezor/components';
66
import { Elevation, mapElevationToBorder, spacings, spacingsPx } from '@trezor/theme';
7-
import {
8-
getNetworkDisplaySymbol,
9-
type NetworkSymbol,
10-
type Network,
11-
} from '@suite-common/wallet-config';
7+
import { type NetworkSymbol, type Network } from '@suite-common/wallet-config';
128

139
import { CheckableTag } from './CheckableTag';
10+
import { CoinLogo } from '../CoinLogo/CoinLogo';
1411

1512
const NetworkTabsWrapper = styled.div<{ $elevation: Elevation }>`
1613
margin-left: -${spacingsPx.md};
@@ -27,10 +24,7 @@ export type NetworkFilterCategory = {
2724
coingeckoNativeId?: Network['coingeckoNativeId'];
2825
};
2926

30-
export type SelectAssetSearchCategory = {
31-
coingeckoId: string;
32-
coingeckoNativeId?: string;
33-
} | null;
27+
export type SelectAssetSearchCategory = NetworkFilterCategory | null;
3428

3529
interface NetworkTabsProps {
3630
tabs: NetworkFilterCategory[];
@@ -95,21 +89,14 @@ export const NetworkTabs = ({
9589
}
9690

9791
if (network.coingeckoId) {
98-
setActiveTab({
99-
coingeckoId: network.coingeckoId,
100-
coingeckoNativeId: network.coingeckoNativeId,
101-
});
92+
setActiveTab(network);
10293
}
10394
}}
10495
key={network.coingeckoId}
10596
>
10697
<Row gap={spacings.xxs}>
10798
{network.coingeckoNativeId && (
108-
<AssetLogo
109-
size={20}
110-
coingeckoId={network.coingeckoNativeId}
111-
placeholder={getNetworkDisplaySymbol(network.symbol)}
112-
/>
99+
<CoinLogo size={20} symbol={network.symbol} />
113100
)}
114101
{network.name}
115102
</Row>

packages/product-components/src/components/SelectAssetModal/SelectAssetModal.storiesData.ts

+6
Original file line numberDiff line numberDiff line change
@@ -478,4 +478,10 @@ export const selectAssetModalNetworks: NetworkFilterCategory[] = [
478478
coingeckoId: 'binance-smart-chain',
479479
coingeckoNativeId: 'binancecoin',
480480
},
481+
{
482+
name: 'Base',
483+
symbol: 'base',
484+
coingeckoId: 'base',
485+
coingeckoNativeId: 'ethereum',
486+
},
481487
];

packages/suite/src/views/wallet/coinmarket/common/CoinmarketForm/CoinmarketFormInput/CoinmarketFormInputCryptoSelect.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export const CoinmarketFormInputCryptoSelect = <
155155
};
156156

157157
const getNetworks = () => {
158-
const networksToSelect: NetworkSymbol[] = ['eth', 'sol', 'pol', 'bsc'];
158+
const networksToSelect: NetworkSymbol[] = ['eth', 'sol', 'pol', 'bsc', 'base', 'op', 'arb'];
159159
const networkKeys = networkSymbolCollection.filter(item => networksToSelect.includes(item));
160160
const networksSelected: NetworkFilterCategory[] = networkKeys.map(networkKey => {
161161
const network = getNetwork(networkKey);
@@ -177,7 +177,7 @@ export const CoinmarketFormInputCryptoSelect = <
177177
if (
178178
activeTab &&
179179
item.coingeckoId !== activeTab.coingeckoId &&
180-
item.coingeckoId !== activeTab.coingeckoNativeId
180+
item.symbol !== activeTab.symbol
181181
) {
182182
return false;
183183
}

0 commit comments

Comments
 (0)