From f03f774c36ce8ea9ac73476d0bf54be320b48300 Mon Sep 17 00:00:00 2001 From: salimtb Date: Thu, 3 Oct 2024 16:12:13 +0200 Subject: [PATCH] fix: add migration ui for network controller v21 --- app/actions/security/index.ts | 16 +- .../CellSelectWithMenu/CellSelectWithMenu.tsx | 16 +- .../CellSelectWithMenu.test.tsx.snap | 10 +- .../ListItemMultiSelectButton.styles.ts | 5 +- .../ListItemMultiSelectButton.tsx | 40 +- .../ListItemMultiSelectButton.types.ts | 14 + .../ListItemMultiSelectButton.test.tsx.snap | 10 +- app/components/Nav/App/index.js | 10 +- app/components/UI/AssetIcon/index.test.tsx | 1 + .../MultiRpcModal/MultiRpcModal.constants.ts | 30 + .../MultiRpcModal/MultiRpcModal.styles.ts | 42 + .../MultiRpcModal/MultiRpcModal.test.tsx | 61 ++ .../Views/MultiRpcModal/MultiRpcModal.tsx | 138 +++ .../__snapshots__/MultiRpcModal.test.tsx.snap | 595 +++++++++++ app/components/Views/MultiRpcModal/index.ts | 1 + app/components/Views/Wallet/index.tsx | 3 +- app/constants/navigation/Routes.ts | 1 + app/core/Analytics/MetaMetrics.events.ts | 6 + app/images/networks1.png | Bin 0 -> 5923 bytes app/selectors/preferencesController.ts | 6 + app/util/test/initial-background-state.json | 1 + index.js | 1 - locales/languages/en.json | 5 + ...tamask+preferences-controller+11.0.0.patch | 974 ++++++++++++++++-- yarn.lock | 4 +- 25 files changed, 1861 insertions(+), 129 deletions(-) create mode 100644 app/components/Views/MultiRpcModal/MultiRpcModal.constants.ts create mode 100644 app/components/Views/MultiRpcModal/MultiRpcModal.styles.ts create mode 100644 app/components/Views/MultiRpcModal/MultiRpcModal.test.tsx create mode 100644 app/components/Views/MultiRpcModal/MultiRpcModal.tsx create mode 100644 app/components/Views/MultiRpcModal/__snapshots__/MultiRpcModal.test.tsx.snap create mode 100644 app/components/Views/MultiRpcModal/index.ts create mode 100644 app/images/networks1.png diff --git a/app/actions/security/index.ts b/app/actions/security/index.ts index e0e87a0ef550..661c1d1119d0 100644 --- a/app/actions/security/index.ts +++ b/app/actions/security/index.ts @@ -8,6 +8,7 @@ export enum ActionType { SET_AUTOMATIC_SECURITY_CHECKS_MODAL_OPEN = 'SET_AUTOMATIC_SECURITY_CHECKS_MODAL_OPEN', SET_DATA_COLLECTION_FOR_MARKETING = 'SET_DATA_COLLECTION_FOR_MARKETING', SET_NFT_AUTO_DETECTION_MODAL_OPEN = 'SET_NFT_AUTO_DETECTION_MODAL_OPEN', + SET_MULTI_RPC_MIGRATION_MODAL_OPEN = 'SET_MULTI_RPC_MIGRATION_MODAL_OPEN', } export interface AllowLoginWithRememberMeUpdated @@ -35,6 +36,11 @@ export interface SetNftAutoDetectionModalOpen open: boolean; } +export interface SetMultiRpcMigrationModalOpen + extends ReduxAction { + open: boolean; +} + export interface SetDataCollectionForMarketing extends ReduxAction { enabled: boolean; @@ -46,7 +52,8 @@ export type Action = | UserSelectedAutomaticSecurityChecksOptions | SetAutomaticSecurityChecksModalOpen | SetDataCollectionForMarketing - | SetNftAutoDetectionModalOpen; + | SetNftAutoDetectionModalOpen + | SetMultiRpcMigrationModalOpen; export const setAllowLoginWithRememberMe = ( enabled: boolean, @@ -82,6 +89,13 @@ export const setNftAutoDetectionModalOpen = ( open, }); +export const setMultiRpcMigrationModalOpen = ( + open: boolean, +): SetMultiRpcMigrationModalOpen => ({ + type: ActionType.SET_MULTI_RPC_MIGRATION_MODAL_OPEN, + open, +}); + export const setDataCollectionForMarketing = (enabled: boolean) => ({ type: ActionType.SET_DATA_COLLECTION_FOR_MARKETING, enabled, diff --git a/app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.tsx b/app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.tsx index ff8df60913ae..e18ed0465956 100644 --- a/app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.tsx +++ b/app/component-library/components-temp/CellSelectWithMenu/CellSelectWithMenu.tsx @@ -33,6 +33,7 @@ const CellSelectWithMenu = ({ tagLabel, isSelected = false, children, + withAvatar = true, ...props }: CellSelectWithMenuProps) => { const { styles } = useStyles(styleSheet, { style }); @@ -46,12 +47,15 @@ const CellSelectWithMenu = ({ > {/* DEV Note: Account Avatar should be replaced with Avatar with Badge whenever available */} - + {withAvatar ? ( + + ) : null} + - + = ({ style, @@ -27,7 +33,9 @@ const ListItemMultiSelectButton: React.FC = ({ isDisabled = false, children, gap = DEFAULT_LISTITEMMULTISELECT_GAP, + showButtonIcon = true, buttonIcon = IconName.MoreVertical, + textButton = null, ...props }) => { const { styles } = useStyles(styleSheet, { @@ -55,15 +63,29 @@ const ListItemMultiSelectButton: React.FC = ({ )} - - - + {showButtonIcon ? ( + + + + ) : null} + {textButton ? ( + +