Skip to content

Commit dcf67aa

Browse files
authored
chore: update network info component for non evm networks (#13734)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR adds new copy and support for the NetworkInfo modal supports non-evm networks. This PR also adds a few [proposed design changes](https://www.figma.com/design/fVhz69fbI9RWonNRN9MaYi/Mobile-network-education-modal?node-id=1-21&t=Pr6c0xsM0vZmZpQw-1) ![image](https://github.com/user-attachments/assets/889998d5-88ed-4507-9bf3-b023b47e43ad) ![image](https://github.com/user-attachments/assets/6951645e-3490-49e3-9a20-a0b44fbba5c6) Also it creates a `selectEvmTicker` for get the ticker of evm current selected network, and a `selectTicker` for the current overall selected network. ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
1 parent 38d58a6 commit dcf67aa

File tree

35 files changed

+1196
-213
lines changed

35 files changed

+1196
-213
lines changed

.eslintrc.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,11 @@ module.exports = {
7878
'app/components/UI/Name/**/*.{js,ts,tsx}',
7979
'app/components/UI/SimulationDetails/**/*.{js,ts,tsx}',
8080
'app/components/hooks/DisplayName/**/*.{js,ts,tsx}',
81-
'app/components/Views/confirmations/**/*.{js,ts,tsx}'
81+
'app/components/Views/confirmations/**/*.{js,ts,tsx}',
8282
],
8383
excludedFiles: [
84-
'app/components/Views/confirmations/components/WatchAssetRequest/**/*.{js,ts,tsx}'],
84+
'app/components/Views/confirmations/components/WatchAssetRequest/**/*.{js,ts,tsx}',
85+
],
8586
rules: {
8687
'no-restricted-syntax': [
8788
'error',
@@ -97,7 +98,7 @@ module.exports = {
9798
'selectProviderType',
9899
'selectRpcUrl',
99100
'selectSelectedNetworkClientId',
100-
'selectTicker',
101+
'selectEvmTicker',
101102
]
102103
.map((method) => `^${method}$`)
103104
.join('|')}/]`,

app/components/Base/RemoteImage/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Badge, {
2323
import { useSelector } from 'react-redux';
2424
import {
2525
selectChainId,
26-
selectTicker,
26+
selectEvmTicker,
2727
} from '../../../selectors/networkController';
2828
import {
2929
getTestNetImageByChainId,
@@ -66,7 +66,7 @@ const RemoteImage = (props) => {
6666
const ipfsGateway = useIpfsGateway();
6767
const styles = createStyles();
6868
const chainId = useSelector(selectChainId);
69-
const ticker = useSelector(selectTicker);
69+
const ticker = useSelector(selectEvmTicker);
7070
const networkName = useSelector(selectNetworkName);
7171
const [resolvedIpfsUrl, setResolvedIpfsUrl] = useState(false);
7272

app/components/UI/AccountFromToInfoCard/AccountFromToInfoCard.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import TransactionTypes from '../../../core/TransactionTypes';
66
import { strings } from '../../../../locales/i18n';
77
import {
88
selectEvmChainId,
9-
selectTicker,
9+
selectEvmTicker,
1010
} from '../../../selectors/networkController';
1111
import { collectConfusables } from '../../../util/confusables';
1212
import { decodeTransferData } from '../../../util/transactions';
@@ -195,7 +195,7 @@ const AccountFromToInfoCard = (props: AccountFromToInfoCardProps) => {
195195
const mapStateToProps = (state: RootState) => ({
196196
internalAccounts: selectInternalAccounts(state),
197197
chainId: selectEvmChainId(state),
198-
ticker: selectTicker(state),
198+
ticker: selectEvmTicker(state),
199199
});
200200

201201
export default connect(mapStateToProps)(AccountFromToInfoCard);

app/components/UI/AccountInfoCard/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
selectConversionRate,
1414
selectCurrentCurrency,
1515
} from '../../../selectors/currencyRateController';
16-
import { selectTicker } from '../../../selectors/networkController';
16+
import { selectEvmTicker } from '../../../selectors/networkController';
1717
import { fontStyles } from '../../../styles/common';
1818
import {
1919
getLabelTextByAddress,
@@ -247,7 +247,7 @@ const mapStateToProps = (state) => ({
247247
internalAccounts: selectInternalAccounts(state),
248248
conversionRate: selectConversionRate(state),
249249
currentCurrency: selectCurrentCurrency(state),
250-
ticker: selectTicker(state),
250+
ticker: selectEvmTicker(state),
251251
transaction: getNormalizedTxState(state),
252252
activeTabUrl: getActiveTabUrl(state),
253253
});

app/components/UI/AssetOverview/AssetOverview.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
selectEvmChainId,
1414
selectNativeCurrencyByChainId,
1515
selectSelectedNetworkClientId,
16-
selectTicker,
16+
selectEvmTicker,
1717
} from '../../../selectors/networkController';
1818
import {
1919
selectConversionRate,
@@ -104,7 +104,9 @@ const AssetOverview: React.FC<AssetOverviewProps> = ({
104104
const tokenBalances = useSelector(selectContractBalances);
105105
const selectedChainId = useSelector(selectEvmChainId);
106106

107-
const selectedTicker = useSelector((state: RootState) => selectTicker(state));
107+
const selectedTicker = useSelector((state: RootState) =>
108+
selectEvmTicker(state),
109+
);
108110

109111
const nativeCurrency = useSelector((state: RootState) =>
110112
selectNativeCurrencyByChainId(state, asset.chainId as Hex),

app/components/UI/AssetOverview/TokenDetails/TokenDetails.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
} from '../../../../selectors/currencyRateController';
1313
import {
1414
selectProviderConfig,
15-
selectTicker,
15+
selectEvmTicker,
1616
} from '../../../../selectors/networkController';
1717
// eslint-disable-next-line import/no-namespace
1818
import * as reactRedux from 'react-redux';
@@ -214,7 +214,7 @@ describe('TokenDetails', () => {
214214
return mockCurrentCurrency;
215215
case selectProviderConfig:
216216
return { ticker: 'ETH' };
217-
case selectTicker:
217+
case selectEvmTicker:
218218
return 'ETH';
219219
default:
220220
return undefined;

app/components/UI/DrawerView/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ import {
7474
selectChainId,
7575
selectNetworkConfigurations,
7676
selectProviderConfig,
77-
selectTicker,
77+
selectEvmTicker,
7878
} from '../../../selectors/networkController';
7979
import { selectCurrentCurrency } from '../../../selectors/currencyRateController';
8080
import { selectTokens } from '../../../selectors/tokensController';
@@ -1245,11 +1245,7 @@ class DrawerView extends PureComponent {
12451245
backdropColor={colors.overlay.default}
12461246
backdropOpacity={1}
12471247
>
1248-
<NetworkInfo
1249-
onClose={this.onInfoNetworksModalClose}
1250-
type={providerConfig.type}
1251-
ticker={providerConfig.ticker}
1252-
/>
1248+
<NetworkInfo onClose={this.onInfoNetworksModalClose} />
12531249
</Modal>
12541250

12551251
{this.renderProtectModal()}
@@ -1270,7 +1266,7 @@ const mapStateToProps = (state) => ({
12701266
infoNetworkModalVisible: state.modals.infoNetworkModalVisible,
12711267
passwordSet: state.user.passwordSet,
12721268
wizard: state.wizard,
1273-
ticker: selectTicker(state),
1269+
ticker: selectEvmTicker(state),
12741270
tokens: selectTokens(state),
12751271
tokenBalances: selectContractBalances(state),
12761272
collectibles: collectiblesSelector(state),

app/components/UI/NetworkInfo/InfoDescription/infoDescription.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ const createStyles = (colors: {
1313
StyleSheet.create({
1414
descriptionContainer: {
1515
marginBottom: 10,
16-
borderBottomWidth: StyleSheet.hairlineWidth,
17-
borderColor: colors.border.muted,
1816
},
1917
contentContainer: {
2018
flexDirection: 'row',
21-
alignItems: 'center',
19+
alignItems: 'flex-start',
2220
marginBottom: 4,
2321
},
2422
numberStyle: {

0 commit comments

Comments
 (0)