From ae402be895b57bf44f65c193ef16be1a3fe21b79 Mon Sep 17 00:00:00 2001 From: Usame Algan Date: Thu, 19 Dec 2024 11:50:49 +0100 Subject: [PATCH 1/3] fix: React props errors --- .yarnrc | 5 ++ .../common/AddressBookInput/index.tsx | 13 ++-- .../common/ExplorerButton/index.tsx | 4 +- src/components/common/NavTabs/index.tsx | 64 ++++++------------- .../NetworkSelector/NetworkMultiSelector.tsx | 18 ++++-- .../tx-flow/common/TxNonce/index.tsx | 6 +- 6 files changed, 51 insertions(+), 59 deletions(-) create mode 100644 .yarnrc diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 0000000000..85b738b8db --- /dev/null +++ b/.yarnrc @@ -0,0 +1,5 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +yarn-path ".yarn/releases/yarn-1.22.22.cjs" diff --git a/src/components/common/AddressBookInput/index.tsx b/src/components/common/AddressBookInput/index.tsx index 77be19a660..9cc9c28099 100644 --- a/src/components/common/AddressBookInput/index.tsx +++ b/src/components/common/AddressBookInput/index.tsx @@ -80,11 +80,14 @@ const AddressBookInput = ({ name, canAdd, ...props }: AddressInputProps & { canA elevation: 2, }, }} - renderOption={(props, option) => ( - - - - )} + renderOption={(props, option) => { + const { key, ...rest } = props + return ( + + + + ) + }} renderInput={(params) => ( { +}: ExplorerButtonProps): ReactElement | null => { + if (!href) return null + return isCompact ? ( (function NextComposedLink(props: Props, ref) { - const { href, as, replace, scroll, shallow, prefetch, legacyBehavior = true, locale, ...other } = props - - return ( - - {/* @ts-ignore */} - - - ) -}) - const NavTabs = ({ tabs }: { tabs: NavItem[] }) => { const router = useRouter() const activeTab = Math.max(0, tabs.map((tab) => tab.href).indexOf(router.pathname)) @@ -38,22 +13,23 @@ const NavTabs = ({ tabs }: { tabs: NavItem[] }) => { return ( {tabs.map((tab, idx) => ( - - {tab.label} - - } - /> + + + {tab.label} + + } + /> + ))} ) diff --git a/src/components/common/NetworkSelector/NetworkMultiSelector.tsx b/src/components/common/NetworkSelector/NetworkMultiSelector.tsx index 085f2bb21e..f9605ab4b1 100644 --- a/src/components/common/NetworkSelector/NetworkMultiSelector.tsx +++ b/src/components/common/NetworkSelector/NetworkMultiSelector.tsx @@ -1,7 +1,7 @@ import useChains, { useCurrentChain } from '@/hooks/useChains' import useSafeAddress from '@/hooks/useSafeAddress' import { useCallback, useEffect, type ReactElement } from 'react' -import { Checkbox, Autocomplete, TextField, Chip } from '@mui/material' +import { Checkbox, Autocomplete, TextField, Chip, Box } from '@mui/material' import type { ChainInfo } from '@safe-global/safe-gateway-typescript-sdk' import ChainIndicator from '../ChainIndicator' import css from './styles.module.css' @@ -138,12 +138,16 @@ const NetworkMultiSelector = ({ > )) } - renderOption={(props, chain, { selected }) => ( -
  • - - -
  • - )} + renderOption={(props, chain, { selected }) => { + const { key, ...rest } = props + + return ( + + + + + ) + }} getOptionLabel={(option) => option.chainName} getOptionDisabled={isOptionDisabled} renderInput={(params) => ( diff --git a/src/components/tx-flow/common/TxNonce/index.tsx b/src/components/tx-flow/common/TxNonce/index.tsx index 5d3f243e39..4fc8915a3b 100644 --- a/src/components/tx-flow/common/TxNonce/index.tsx +++ b/src/components/tx-flow/common/TxNonce/index.tsx @@ -217,11 +217,13 @@ const TxNonceForm = ({ nonce, recommendedNonce }: { nonce: string; recommendedNo const isRecommendedNonce = option === recommendedNonce const isInitialPreviousNonce = option === previousNonces[0] + const { key, ...rest } = props + return ( -
    +
    {isRecommendedNonce && Recommended nonce} {isInitialPreviousNonce && Replace existing} - +
    ) }} From b786db8ce973b143a3deedbe253bd7f58e5a3b4b Mon Sep 17 00:00:00 2001 From: Usame Algan Date: Thu, 19 Dec 2024 12:22:49 +0100 Subject: [PATCH 2/3] chore: Update snapshots --- .../BatchTransactions.test.tsx.snap | 19 +-- .../SettingsChange.test.tsx.snap | 57 +------- .../ConfirmationView.test.tsx.snap | 133 +----------------- 3 files changed, 11 insertions(+), 198 deletions(-) diff --git a/src/components/tx/confirmation-views/BatchTransactions/__snapshots__/BatchTransactions.test.tsx.snap b/src/components/tx/confirmation-views/BatchTransactions/__snapshots__/BatchTransactions.test.tsx.snap index 549ada2e01..16587a18a0 100644 --- a/src/components/tx/confirmation-views/BatchTransactions/__snapshots__/BatchTransactions.test.tsx.snap +++ b/src/components/tx/confirmation-views/BatchTransactions/__snapshots__/BatchTransactions.test.tsx.snap @@ -194,24 +194,7 @@ exports[`BatchTransactions should render a list of batch transactions 1`] = `
    - -
    + /> -
    + /> @@ -180,24 +163,7 @@ exports[`SettingsChange should display the SettingsChange component with newOwne
    - -
    + /> @@ -288,24 +254,7 @@ exports[`SettingsChange should display the SettingsChange component with owner d
    - -
    + /> diff --git a/src/components/tx/confirmation-views/__snapshots__/ConfirmationView.test.tsx.snap b/src/components/tx/confirmation-views/__snapshots__/ConfirmationView.test.tsx.snap index 020fbf231e..fba68e0efc 100644 --- a/src/components/tx/confirmation-views/__snapshots__/ConfirmationView.test.tsx.snap +++ b/src/components/tx/confirmation-views/__snapshots__/ConfirmationView.test.tsx.snap @@ -80,24 +80,7 @@ exports[`ConfirmationView should display a confirmation screen for a SETTINGS_CH
    - -
    + /> @@ -272,24 +255,7 @@ exports[`ConfirmationView should display a confirmation screen for a SETTINGS_CH
    - -
    + /> @@ -429,24 +395,7 @@ exports[`ConfirmationView should display a confirmation screen for a SETTINGS_CH
    - -
    + /> @@ -601,24 +550,7 @@ exports[`ConfirmationView should display a confirmation screen for a SETTINGS_CH
    - -
    + /> @@ -828,24 +760,7 @@ exports[`ConfirmationView should display a confirmation with method call when th
    - -
    + /> @@ -985,24 +900,7 @@ exports[`ConfirmationView should display a confirmation with method call when th
    - -
    + /> @@ -1157,24 +1055,7 @@ exports[`ConfirmationView should display a confirmation with method call when th
    - -
    + /> From 70a9c29ec766ba3de0f7c47498b4d29c25fdb7b0 Mon Sep 17 00:00:00 2001 From: Usame Algan Date: Thu, 19 Dec 2024 15:25:58 +0100 Subject: [PATCH 3/3] fix: Use NextLink inside Tab component instead of wrapping --- .yarnrc | 5 ---- src/components/common/NavTabs/index.tsx | 34 ++++++++++++------------- 2 files changed, 17 insertions(+), 22 deletions(-) delete mode 100644 .yarnrc diff --git a/.yarnrc b/.yarnrc deleted file mode 100644 index 85b738b8db..0000000000 --- a/.yarnrc +++ /dev/null @@ -1,5 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -yarn-path ".yarn/releases/yarn-1.22.22.cjs" diff --git a/src/components/common/NavTabs/index.tsx b/src/components/common/NavTabs/index.tsx index 89fbef4fd3..2d498ea7b9 100644 --- a/src/components/common/NavTabs/index.tsx +++ b/src/components/common/NavTabs/index.tsx @@ -13,23 +13,23 @@ const NavTabs = ({ tabs }: { tabs: NavItem[] }) => { return ( {tabs.map((tab, idx) => ( - - - {tab.label} - - } - /> - + + {tab.label} + + } + /> ))} )