Skip to content

Commit f9fa421

Browse files
committed
chore(nav): type remaining shell navigators
1 parent 04d6822 commit f9fa421

6 files changed

Lines changed: 280 additions & 35 deletions

File tree

app/components/Nav/Main/types/navigation.ts

Lines changed: 153 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import type { NavigatorScreenParams } from '@react-navigation/native';
2-
import type { AssetViewParams } from '../../../Views/Asset/Asset.types';
2+
import type {
3+
AssetLoaderParams,
4+
AssetViewParams,
5+
} from '../../../Views/Asset/Asset.types';
36
import type { TokenDetailsRouteParams } from '../../../UI/TokenDetails/constants/constants';
47
import type {
58
CreatePriceAlertRouteParams,
@@ -10,14 +13,24 @@ import type { NetworkDetailsViewParams } from '../../../Views/NetworksManagement
1013
import type { ContactFormParams } from '../../../Views/Settings/Contacts/ContactForm.types';
1114
import type { NotificationSettingsSectionProps } from '../../../Views/Settings/NotificationsSettings/NotificationSettingsSection';
1215
import type { RegionSelectorParams } from '../../../Views/Modals/Modals.types';
13-
import type {
14-
ManualBackupStep1Params,
15-
ManualBackupStep2Params,
16-
} from '../../../Views/ManualBackupStep1/ManualBackupStep1.types';
1716
import type {
1817
AccountBackupParams,
1918
ManualBackupStep3Params,
2019
} from '../../../Views/AccountBackup/AccountBackup.types';
20+
import type {
21+
ManualBackupStep1Params,
22+
ManualBackupStep2Params,
23+
} from '../../../Views/ManualBackupStep1/ManualBackupStep1.types';
24+
import type { BrowserParams } from '../../../Views/Browser/Browser.types';
25+
import type { SimpleWebviewParams } from '../../../Views/Webview/Webview.types';
26+
import type { ExploreFeedRouteParams } from '../../../Views/TrendingView/TrendingView';
27+
import type { ChoosePasswordRouteParams } from '../../../Views/ChoosePassword/ChoosePassword.types';
28+
import type { OptinMetricsRouteParams } from '../../../UI/OptinMetrics/OptinMetrics.types';
29+
import type { QRTabSwitcherParams } from '../../../Views/QRTabSwitcher/QRTabSwitcher';
30+
import type { TransactionsViewParams } from '../../../Views/TransactionsView/TransactionsView.types';
31+
import type { RampOrderDetailsParams } from '../../../UI/Ramp/Aggregator/types/navigation';
32+
import type { RampNavigationParamList } from '../../../UI/Ramp/types/navigation';
33+
import type { BridgeTransactionDetailsParams } from '../../../UI/Bridge/Bridge.types';
2134

2235
/**
2336
* Param list for screens inside `AssetStackFlow` (token details + alerts).
@@ -95,3 +108,138 @@ export type SettingsStackParamList = {
95108
SettingsRegionSelector: RegionSelectorParams | undefined;
96109
SnapsSettingsList: undefined;
97110
};
111+
112+
/**
113+
* Param list for screens inside `ExploreHome` (`TrendingView` tab).
114+
*/
115+
// ParamListBase requires `type`; `interface` cannot satisfy it.
116+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
117+
export type TrendingViewStackParamList = {
118+
TrendingFeed: ExploreFeedRouteParams | undefined;
119+
};
120+
121+
/**
122+
* Param list for screens inside `BrowserFlow` (`BrowserTabHome`).
123+
*/
124+
// ParamListBase requires `type`; `interface` cannot satisfy it.
125+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
126+
export type BrowserTabHomeParamList = {
127+
BrowserView: BrowserParams | undefined;
128+
AssetLoader: AssetLoaderParams | undefined;
129+
AssetView: AssetViewParams | undefined;
130+
};
131+
132+
/**
133+
* Param list for screens inside the `Webview` stack.
134+
*/
135+
// ParamListBase requires `type`; `interface` cannot satisfy it.
136+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
137+
export type WebviewStackParamList = {
138+
SimpleWebview: SimpleWebviewParams | undefined;
139+
};
140+
141+
/**
142+
* Param list for screens inside `SetPasswordFlow`.
143+
*/
144+
// ParamListBase requires `type`; `interface` cannot satisfy it.
145+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
146+
export type SetPasswordFlowParamList = {
147+
ChoosePassword: ChoosePasswordRouteParams | undefined;
148+
AccountBackupStep1: AccountBackupParams | undefined;
149+
AccountBackupStep1B: AccountBackupParams | undefined;
150+
ManualBackupStep1: ManualBackupStep1Params | undefined;
151+
ManualBackupStep2: ManualBackupStep2Params | undefined;
152+
ManualBackupStep3: ManualBackupStep3Params;
153+
OptinMetrics: OptinMetricsRouteParams | undefined;
154+
};
155+
156+
/**
157+
* Param list for screens inside `ImportPrivateKeyView` (App root stack).
158+
*/
159+
// ParamListBase requires `type`; `interface` cannot satisfy it.
160+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
161+
export type ImportPrivateKeyStackParamList = {
162+
ImportPrivateKey: undefined;
163+
ImportPrivateKeySuccess: undefined;
164+
QRTabSwitcher: QRTabSwitcherParams | undefined;
165+
};
166+
167+
/**
168+
* Param list for screens inside `MoneyTabScreenStack` (Money tab under Home).
169+
*/
170+
// ParamListBase requires `type`; `interface` cannot satisfy it.
171+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
172+
export type MoneyTabStackParamList = {
173+
MoneyHome: undefined;
174+
MoneyActivity: undefined;
175+
MoneyHowItWorks: undefined;
176+
};
177+
178+
/**
179+
* Param list for screens inside `TransactionsHome` (Activity tab under Home).
180+
*/
181+
// ParamListBase requires `type`; `interface` cannot satisfy it.
182+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
183+
export type TransactionsHomeParamList = {
184+
TransactionsView: TransactionsViewParams | undefined;
185+
OrderDetails: RampOrderDetailsParams | undefined;
186+
RampsOrderDetails: RampNavigationParamList['RampsOrderDetails'];
187+
DepositOrderDetails: undefined;
188+
RampBankDetailsStandalone: RampNavigationParamList['RampBankDetailsStandalone'];
189+
SendTransaction: undefined;
190+
BridgeTransactionDetails: BridgeTransactionDetailsParams | undefined;
191+
};
192+
193+
/**
194+
* Param list for screens inside `RewardsHome` (Rewards tab under Home).
195+
*/
196+
// ParamListBase requires `type`; `interface` cannot satisfy it.
197+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
198+
export type RewardsHomeParamList = {
199+
RewardsOnboardingFlow: undefined;
200+
RewardsDashboard: undefined;
201+
};
202+
203+
/**
204+
* Param list for tabs inside `HomeTabs` (`Home`).
205+
*
206+
* Trade tab reuses `WalletTabStackFlow` as a placeholder component under
207+
* `TradeWalletActions`; Money vs Activity tabs are mutually exclusive at runtime.
208+
*/
209+
// ParamListBase requires `type`; `interface` cannot satisfy it.
210+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
211+
export type HomeTabsParamList = {
212+
WalletTabHome: NavigatorScreenParams<WalletTabHomeParamList> | undefined;
213+
TrendingView: NavigatorScreenParams<TrendingViewStackParamList> | undefined;
214+
BrowserTabHome: NavigatorScreenParams<BrowserTabHomeParamList> | undefined;
215+
TradeWalletActions:
216+
| NavigatorScreenParams<WalletTabStackParamList>
217+
| undefined;
218+
MoneyScreens: NavigatorScreenParams<MoneyTabStackParamList> | undefined;
219+
TransactionsView:
220+
| NavigatorScreenParams<TransactionsHomeParamList>
221+
| undefined;
222+
RewardsView: NavigatorScreenParams<RewardsHomeParamList> | undefined;
223+
};
224+
225+
/**
226+
* Param list for `MainNavigator` (`ConnectedMain`).
227+
*
228+
* Phase 3 types the Home tab host used for nested deeplink / reset state.
229+
* Sibling MainNavigator screens remain typed flat on `RootStackParamList`.
230+
*/
231+
// ParamListBase requires `type`; `interface` cannot satisfy it.
232+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
233+
export type MainStackParamList = {
234+
Home: NavigatorScreenParams<HomeTabsParamList> | undefined;
235+
};
236+
237+
/**
238+
* Param list for `MainFlow` (`Routes.MAIN_FLOW` / `Main` on the root stack).
239+
*/
240+
// ParamListBase requires `type`; `interface` cannot satisfy it.
241+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
242+
export type MainFlowParamList = {
243+
Main: NavigatorScreenParams<MainStackParamList> | undefined;
244+
ReviewModal: undefined;
245+
};

app/components/Views/Modals/Modals.types.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { TransactionMeta } from '@metamask/transaction-controller';
2+
13
/**
24
* Modal navigation parameters
35
*/
@@ -43,9 +45,29 @@ export interface SeedphraseModalParams {
4345
seedPhrase?: string[];
4446
}
4547

46-
/** Transaction details sheet parameters */
48+
/** Transaction details sheet parameters (matches TransactionDetailsSheet route). */
4749
export interface TransactionDetailsSheetParams {
48-
transactionId?: string;
50+
tx: TransactionMeta;
51+
transactionElement: {
52+
actionKey: string;
53+
value?: string;
54+
[key: string]: unknown;
55+
};
56+
transactionDetails: {
57+
hash?: string;
58+
renderFrom?: string;
59+
renderTo?: string;
60+
renderValue?: string;
61+
summaryAmount?: string;
62+
summaryFee?: string;
63+
summaryTotalAmount?: string;
64+
summarySecondaryTotalAmount?: string;
65+
transactionType?: string;
66+
txChainId?: string;
67+
[key: string]: unknown;
68+
};
69+
showSpeedUpModal: () => void;
70+
showCancelModal: () => void;
4971
}
5072

5173
/** Show NFT display media parameters */

app/components/Views/MultichainAccounts/MultichainAccounts.types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
*/
44

55
import { InternalAccount } from '@metamask/keyring-internal-api';
6+
import type { Transaction } from '@metamask/keyring-api';
7+
import type { MultichainTransactionDisplayData } from '../../hooks/useMultichainTransactionDisplay';
68

79
export interface AccountParams {
810
account?: InternalAccount;
@@ -16,7 +18,8 @@ export interface MultichainAccountDetailActionsParams {
1618

1719
/** Multichain transaction details parameters */
1820
export interface MultichainTransactionDetailsParams {
19-
transactionId?: string;
21+
displayData: MultichainTransactionDisplayData;
22+
transaction: Transaction;
2023
}
2124

2225
/** Multichain account actions parameters */

app/components/Views/Onboarding/index.test.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,6 @@ describe('Onboarding', () => {
745745
'error_sheet.no_internet_connection_description',
746746
),
747747
descriptionAlign: 'left',
748-
buttonLabel: strings('error_sheet.no_internet_connection_button'),
749748
primaryButtonLabel: strings(
750749
'error_sheet.no_internet_connection_button',
751750
),
@@ -1459,7 +1458,7 @@ describe('Onboarding', () => {
14591458
title: strings('error_sheet.user_cancelled_title'),
14601459
description: strings('error_sheet.user_cancelled_description'),
14611460
descriptionAlign: 'center',
1462-
buttonLabel: strings('error_sheet.user_cancelled_button'),
1461+
primaryButtonLabel: strings('error_sheet.user_cancelled_button'),
14631462
type: 'error',
14641463
}),
14651464
}),
@@ -1506,7 +1505,7 @@ describe('Onboarding', () => {
15061505
title: strings('error_sheet.oauth_error_title'),
15071506
description: strings('error_sheet.oauth_error_description'),
15081507
descriptionAlign: 'center',
1509-
buttonLabel: strings('error_sheet.oauth_error_button'),
1508+
primaryButtonLabel: strings('error_sheet.oauth_error_button'),
15101509
type: 'error',
15111510
}),
15121511
}),
@@ -3341,7 +3340,7 @@ describe('Onboarding', () => {
33413340
title: strings('error_sheet.oauth_error_title'),
33423341
description: strings('error_sheet.oauth_error_description'),
33433342
descriptionAlign: 'center',
3344-
buttonLabel: strings('error_sheet.oauth_error_button'),
3343+
primaryButtonLabel: strings('error_sheet.oauth_error_button'),
33453344
type: 'error',
33463345
}),
33473346
}),

app/components/Views/Onboarding/index.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ const Onboarding = () => {
706706
title: strings('error_sheet.oauth_error_title'),
707707
description: strings('error_sheet.oauth_error_description'),
708708
descriptionAlign: 'center',
709-
buttonLabel: strings('error_sheet.oauth_error_button'),
709+
primaryButtonLabel: strings('error_sheet.oauth_error_button'),
710710
type: 'error',
711711
},
712712
});
@@ -722,7 +722,7 @@ const Onboarding = () => {
722722
title: strings('error_sheet.oauth_error_title'),
723723
description: strings('error_sheet.oauth_error_description'),
724724
descriptionAlign: 'center',
725-
buttonLabel: strings('error_sheet.oauth_error_button'),
725+
primaryButtonLabel: strings('error_sheet.oauth_error_button'),
726726
type: 'error',
727727
},
728728
});
@@ -753,7 +753,7 @@ const Onboarding = () => {
753753
title: strings(`error_sheet.${errorMessage}_title`),
754754
description: strings(`error_sheet.${errorMessage}_description`),
755755
descriptionAlign: 'center',
756-
buttonLabel: strings(`error_sheet.${errorMessage}_button`),
756+
primaryButtonLabel: strings(`error_sheet.${errorMessage}_button`),
757757
type: 'error',
758758
},
759759
});
@@ -783,9 +783,6 @@ const Onboarding = () => {
783783
`error_sheet.no_internet_connection_description`,
784784
),
785785
descriptionAlign: 'left',
786-
buttonLabel: strings(
787-
`error_sheet.no_internet_connection_button`,
788-
),
789786
primaryButtonLabel: strings(
790787
`error_sheet.no_internet_connection_button`,
791788
),

0 commit comments

Comments
 (0)