From 9e7166c480bdc8f01765a68e32f148d3cb523088 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Fri, 13 Dec 2024 16:49:32 +0100 Subject: [PATCH 1/4] fix: update fallback prop for Image component in WalletConnectors --- src/components/dapp/WalletConnectors.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/dapp/WalletConnectors.tsx b/src/components/dapp/WalletConnectors.tsx index b907431d0..634666555 100644 --- a/src/components/dapp/WalletConnectors.tsx +++ b/src/components/dapp/WalletConnectors.tsx @@ -23,7 +23,7 @@ export default function WalletConnectors() { bold className="gap-sm*2" key={connector.id}> - {connector.name} + {connector.name} {connector.name} From 597f14bc254f767fcf7453c591d7c0fc7417c565 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Mon, 16 Dec 2024 12:04:48 +0100 Subject: [PATCH 2/4] fix: update Tooltip component styles for improved layout and responsiveness --- src/components/primitives/Tooltip.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/primitives/Tooltip.tsx b/src/components/primitives/Tooltip.tsx index 5e3995f1a..2f4a1ada0 100644 --- a/src/components/primitives/Tooltip.tsx +++ b/src/components/primitives/Tooltip.tsx @@ -16,7 +16,7 @@ export default function Tooltip({ helper, children, icon = true }: TooltipProps) - +
{children}
{!!icon && }
@@ -24,9 +24,9 @@ export default function Tooltip({ helper, children, icon = true }: TooltipProps) - + {helper} From f3d8de72144a7fe3b5eb4885bc64336e418c8aa2 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Mon, 16 Dec 2024 12:54:46 +0100 Subject: [PATCH 3/4] Sort wallets and add icons for walletconnect and coinbase --- src/assets/walletCoinbase.svg | 4 +++ src/assets/walletConnect.svg | 20 +++++++++++ src/components/dapp/WalletConnectors.tsx | 45 ++++++++++++++++++++++-- 3 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 src/assets/walletCoinbase.svg create mode 100644 src/assets/walletConnect.svg diff --git a/src/assets/walletCoinbase.svg b/src/assets/walletCoinbase.svg new file mode 100644 index 000000000..c47fdf94b --- /dev/null +++ b/src/assets/walletCoinbase.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/assets/walletConnect.svg b/src/assets/walletConnect.svg new file mode 100644 index 000000000..64b078c4f --- /dev/null +++ b/src/assets/walletConnect.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + diff --git a/src/components/dapp/WalletConnectors.tsx b/src/components/dapp/WalletConnectors.tsx index 634666555..8f0625e67 100644 --- a/src/components/dapp/WalletConnectors.tsx +++ b/src/components/dapp/WalletConnectors.tsx @@ -6,24 +6,52 @@ import Icon from "../primitives/Icon"; import Image from "../primitives/Image"; import Input from "../primitives/Input"; import Text from "../primitives/Text"; +import type { Connector } from "wagmi"; +import walletConnectIcon from "../../assets/walletConnect.svg"; +import walletCoinbaseIcon from "../../assets/walletCoinbase.svg"; +import { useMemo } from "react"; export default function WalletConnectors() { const { config, connect, connector: _connected } = useWalletContext(); + const sortedConnectors = useMemo( + () => + [...config.connectors].sort((a, b) => { + const priority = (connector: Connector) => { + switch (connector.name.toLowerCase()) { + case "metamask": + return 0; + case "rabby wallet": + return 1; + case "walletconnect": + return 2; + default: + return 3; + } + }; + return priority(a) - priority(b); + }), + [config.connectors], + ); + return (
- {config.connectors.map(connector => { + {sortedConnectors.map(connector => { return ( @@ -38,3 +66,14 @@ export default function WalletConnectors() { ); } + +const overrideIcons = (connector: Connector) => { + switch (connector.name.toLowerCase()) { + case "coinbase wallet": + return walletCoinbaseIcon; + case "walletconnect": + return walletConnectIcon; + default: + return connector.icon; + } +}; From abd702875d06097e19e30ce92c77db395b897559 Mon Sep 17 00:00:00 2001 From: Hugo Lextrait Date: Mon, 16 Dec 2024 12:58:08 +0100 Subject: [PATCH 4/4] lint --- src/components/dapp/WalletConnectors.tsx | 8 ++++---- src/components/extenders/Select.tsx | 3 ++- src/utils/types.ts | 1 - 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/dapp/WalletConnectors.tsx b/src/components/dapp/WalletConnectors.tsx index 8f0625e67..05d009926 100644 --- a/src/components/dapp/WalletConnectors.tsx +++ b/src/components/dapp/WalletConnectors.tsx @@ -1,3 +1,7 @@ +import { useMemo } from "react"; +import type { Connector } from "wagmi"; +import walletCoinbaseIcon from "../../assets/walletCoinbase.svg"; +import walletConnectIcon from "../../assets/walletConnect.svg"; import { useWalletContext } from "../../context/Wallet.context"; import Group from "../extenders/Group"; import Button from "../primitives/Button"; @@ -6,10 +10,6 @@ import Icon from "../primitives/Icon"; import Image from "../primitives/Image"; import Input from "../primitives/Input"; import Text from "../primitives/Text"; -import type { Connector } from "wagmi"; -import walletConnectIcon from "../../assets/walletConnect.svg"; -import walletCoinbaseIcon from "../../assets/walletCoinbase.svg"; -import { useMemo } from "react"; export default function WalletConnectors() { const { config, connect, connector: _connected } = useWalletContext(); diff --git a/src/components/extenders/Select.tsx b/src/components/extenders/Select.tsx index e32560b7b..2c896899b 100644 --- a/src/components/extenders/Select.tsx +++ b/src/components/extenders/Select.tsx @@ -236,7 +236,8 @@ export default function Select< // resetValueOnHide setValue={value => { setSearch(value); - }}> + }} + > setValue(v as Value)} value={value as string} diff --git a/src/utils/types.ts b/src/utils/types.ts index 67b117fb9..16104e3e8 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -1,4 +1,3 @@ -import type { Dispatch, SetStateAction } from "react"; import type { Coloring, Mode, State } from "../theming/variables"; /**