From de0e61a32224b76be83097ad235ed4aabda05ced Mon Sep 17 00:00:00 2001 From: robhyrk Date: Thu, 23 May 2024 16:00:18 -0400 Subject: [PATCH 1/2] style: add dropdown icon, remove old styling --- components/account/AccountSelect.tsx | 53 ++++++++++------------- components/account/AccountSelectValue.tsx | 28 +++++++----- components/ui/CopyIcon.tsx | 2 +- 3 files changed, 40 insertions(+), 43 deletions(-) diff --git a/components/account/AccountSelect.tsx b/components/account/AccountSelect.tsx index dc5e89125..44f16925d 100644 --- a/components/account/AccountSelect.tsx +++ b/components/account/AccountSelect.tsx @@ -9,6 +9,7 @@ import Select, { SingleValueProps, StylesConfig, } from "react-select"; +import { IoIosArrowDropdownCircle } from "react-icons/io"; import CopyIcon from "../ui/CopyIcon"; import AccountSelectOption from "./AccountSelectOption"; @@ -19,7 +20,7 @@ export type AccountOption = { label: string; value: string }; const Control = ({ children, ...rest }: ControlProps) => { return ( -
+
{children}
@@ -28,7 +29,6 @@ const Control = ({ children, ...rest }: ControlProps) => { const Option = (props: OptionProps) => { const { label, value } = props.data; - return ( @@ -47,7 +47,7 @@ const DropdownIndicator = () => { }; const IndicatorSeparator = () => { - return <>; + return null; }; const customStyles: StylesConfig = { @@ -98,34 +98,25 @@ const AccountSelect: FC = ({ const wallet = useWallet(); return ( -
-
- + {wallet.activeAccount?.address && }
); }; diff --git a/components/account/AccountSelectValue.tsx b/components/account/AccountSelectValue.tsx index 57887ba1f..fe8522563 100644 --- a/components/account/AccountSelectValue.tsx +++ b/components/account/AccountSelectValue.tsx @@ -1,30 +1,36 @@ import Avatar from "components/ui/Avatar"; import { shortenAddress } from "lib/util"; - +import CopyIcon from "../ui/CopyIcon"; import React, { FC } from "react"; - +import { useWallet } from "lib/state/wallet"; export interface AccountSelectValueProps { name: string; address: string; } const AccountSelectValue: FC = ({ name, address }) => { + const wallet = useWallet(); return ( -
-
-
+
+
+
-
-
- {name} -
-
+
+
{name}
+
{shortenAddress(address, 8, 12)}
-
+
{address} + {wallet.activeAccount?.address && ( + + )}
diff --git a/components/ui/CopyIcon.tsx b/components/ui/CopyIcon.tsx index 8bb71e534..24333b85e 100644 --- a/components/ui/CopyIcon.tsx +++ b/components/ui/CopyIcon.tsx @@ -39,7 +39,7 @@ const CopyIcon: FC = ({ }, [recentlyCopied]); return ( -
+
Date: Fri, 24 May 2024 16:01:44 -0400 Subject: [PATCH 2/2] styles: remove old styling, add dropdown icon, update styles --- components/account/AccountModalContent.tsx | 29 +++++++++++----------- components/account/AccountModalHead.tsx | 4 +-- components/account/AccountSelect.tsx | 12 ++++++--- components/account/AccountSelectValue.tsx | 12 ++++----- components/ui/CopyIcon.tsx | 2 +- 5 files changed, 31 insertions(+), 28 deletions(-) diff --git a/components/account/AccountModalContent.tsx b/components/account/AccountModalContent.tsx index 03cfb56ec..4b716fa29 100644 --- a/components/account/AccountModalContent.tsx +++ b/components/account/AccountModalContent.tsx @@ -5,6 +5,7 @@ import { useWallet } from "lib/state/wallet"; import { useZtgBalance } from "lib/hooks/queries/useZtgBalance"; import { ZTG } from "@zeitgeistpm/sdk"; import { useChainConstants } from "lib/hooks/queries/useChainConstants"; +import { formatNumberLocalized } from "lib/util"; const AccountModalContent: FC = () => { const { activeAccount, disconnectWallet, accounts, selectAccount } = @@ -38,26 +39,26 @@ const AccountModalContent: FC = () => { value={value} onChange={onAccountChange} /> -
-
-
-
-
-
+
+
+
+
+
+
Account balance
-
-
+
+
balance
-
- {`${activeBalance?.div(ZTG).toFixed(4)} ${ +
+ {`${formatNumberLocalized(Number(activeBalance?.div(ZTG)))} ${ constants?.tokenSymbol ?? "" }` ?? "---"}
@@ -65,13 +66,13 @@ const AccountModalContent: FC = () => {
{ disconnectWallet(); }} > -
disconnect
- +
disconnect
+
diff --git a/components/account/AccountModalHead.tsx b/components/account/AccountModalHead.tsx index 26a1b4540..4260f15fd 100644 --- a/components/account/AccountModalHead.tsx +++ b/components/account/AccountModalHead.tsx @@ -9,9 +9,9 @@ const AccountModalHead = () => { return (
-
Account
+
Account
{ switchExtension(); }} diff --git a/components/account/AccountSelect.tsx b/components/account/AccountSelect.tsx index 44f16925d..80fce4785 100644 --- a/components/account/AccountSelect.tsx +++ b/components/account/AccountSelect.tsx @@ -9,8 +9,6 @@ import Select, { SingleValueProps, StylesConfig, } from "react-select"; -import { IoIosArrowDropdownCircle } from "react-icons/io"; - import CopyIcon from "../ui/CopyIcon"; import AccountSelectOption from "./AccountSelectOption"; import AccountSelectValue from "./AccountSelectValue"; @@ -98,7 +96,7 @@ const AccountSelect: FC = ({ const wallet = useWallet(); return ( -
+