diff --git a/src/components/DepositsTable/HeadRow.tsx b/src/components/DepositsTable/HeadRow.tsx index 6bad3bbae..c29f59a86 100644 --- a/src/components/DepositsTable/HeadRow.tsx +++ b/src/components/DepositsTable/HeadRow.tsx @@ -1,11 +1,8 @@ import styled from "@emotion/styled"; - import { Text } from "components/Text"; - import { COLORS } from "utils"; export type HeaderCells = typeof headerCells; - export type ColumnKey = keyof HeaderCells; export const headerCells = { diff --git a/src/components/Tooltip/Tooltip.tsx b/src/components/Tooltip/Tooltip.tsx index b96929956..9639fd591 100644 --- a/src/components/Tooltip/Tooltip.tsx +++ b/src/components/Tooltip/Tooltip.tsx @@ -16,13 +16,17 @@ import { ReactComponent as ReferrerIcon } from "assets/icons/referrer.svg"; import { ReactComponent as SelfReferralIcon } from "assets/icons/self-referral.svg"; import { ReactComponent as ClockIcon } from "assets/icons/clock.svg"; -export type TooltipIcon = - | "green-checkmark" - | "grey-checkmark" - | "referee" - | "referral" - | "self-referral" - | "clock"; +const iconMap = { + "green-checkmark": , + "grey-checkmark": , + "self-referral": , + referral: , + referee: , + clock: , +}; + +export type TooltipIcon = keyof typeof iconMap; + export interface TooltipProps { tooltipId?: string; icon?: TooltipIcon | ReactNode; @@ -49,6 +53,8 @@ export const Tooltip: React.FC = ({ if (!children) return null; + const iconElement = iconMap[icon as TooltipIcon] || icon; + return ( <> @@ -58,13 +64,7 @@ export const Tooltip: React.FC = ({ {title && ( - {typeof icon === "object" && icon} - {icon === "green-checkmark" && } - {icon === "grey-checkmark" && } - {icon === "self-referral" && } - {icon === "referral" && } - {icon === "referee" && } - {icon === "clock" && } + {iconElement} {title} {titleSecondary && ( {titleSecondary} diff --git a/src/hooks/useTokenConversion.ts b/src/hooks/useTokenConversion.ts deleted file mode 100644 index b72b16e25..000000000 --- a/src/hooks/useTokenConversion.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { utils } from "@across-protocol/sdk-v2"; -import { useCoingeckoPrice } from "./useCoingeckoPrice"; -import { BigNumber } from "ethers"; -import { useCallback } from "react"; -import { fixedPointAdjustment, getToken, getTokenByAddress } from "utils"; -import { ConvertDecimals } from "utils/convertdecimals"; - -export function useTokenConversion(symbol: string, baseCurrency: string) { - const token = getToken(symbol); - const l1Token = token.mainnetAddress!; - const query = useCoingeckoPrice( - l1Token, - baseCurrency, - utils.isDefined(l1Token) - ); - const convertTokenToBaseCurrency = useCallback( - (amount?: BigNumber) => { - const price = query.data?.price; - if (!utils.isDefined(price) || !utils.isDefined(amount)) { - return undefined; - } - const { decimals } = getTokenByAddress(l1Token); - const convertedAmount = ConvertDecimals(decimals, 18)(amount); - return price.mul(convertedAmount).div(fixedPointAdjustment); - }, - [l1Token, query.data?.price] - ); - return { - convertTokenToBaseCurrency, - baseCurrency, - }; -} diff --git a/src/views/DepositStatus/components/DepositStatusUpperCard.tsx b/src/views/DepositStatus/components/DepositStatusUpperCard.tsx index 2cc78b896..0493db7db 100644 --- a/src/views/DepositStatus/components/DepositStatusUpperCard.tsx +++ b/src/views/DepositStatus/components/DepositStatusUpperCard.tsx @@ -15,8 +15,8 @@ import { ReactComponent as BaseGrayscaleLogo } from "assets/grayscale-logos/base import { Text, Badge } from "components"; import { ChainId, QUERIESV2, COLORS, NoFundsDepositedLogError } from "utils"; +import { useElapsedSeconds } from "hooks/useElapsedSeconds"; -import { useElapsedSeconds } from "../../../hooks/useElapsedSeconds"; import { useDepositTracking } from "../hooks/useDepositTracking"; import { DepositTimesCard } from "./DepositTimesCard"; import { ElapsedTime } from "./ElapsedTime";