From a06bb790397bc369299123e73ba08d0a234342cb Mon Sep 17 00:00:00 2001 From: Vignesh Mohankumar Date: Thu, 1 Dec 2022 17:13:07 -0500 Subject: [PATCH] chore: remove all remaining unused exports (#5510) chore: remove unused tokens/core variables --- src/components/Card/index.tsx | 4 ---- src/components/SearchModal/styleds.tsx | 13 ------------- src/components/Tokens/constants.ts | 1 - src/components/swap/styleds.tsx | 6 ------ src/hooks/Tokens.ts | 10 ---------- src/hooks/useColor.ts | 23 ----------------------- src/nft/utils/transactionResponse.ts | 8 -------- src/state/application/hooks.ts | 5 ----- src/state/user/hooks.tsx | 11 ----------- src/theme/components/index.tsx | 12 ------------ src/utils/formatChartTimes.ts | 6 ------ src/utils/index.ts | 6 ------ 12 files changed, 105 deletions(-) diff --git a/src/components/Card/index.tsx b/src/components/Card/index.tsx index d3756f6237..f7bad99633 100644 --- a/src/components/Card/index.tsx +++ b/src/components/Card/index.tsx @@ -14,10 +14,6 @@ export const LightCard = styled(Card)` background-color: ${({ theme }) => theme.deprecated_bg1}; ` -export const LightGrayCard = styled(Card)` - background-color: ${({ theme }) => theme.deprecated_bg2}; -` - export const GrayCard = styled(Card)` background-color: ${({ theme }) => theme.deprecated_bg3}; ` diff --git a/src/components/SearchModal/styleds.tsx b/src/components/SearchModal/styleds.tsx index 9340fc901b..c356980086 100644 --- a/src/components/SearchModal/styleds.tsx +++ b/src/components/SearchModal/styleds.tsx @@ -5,13 +5,6 @@ import styled from 'styled-components/macro' import { AutoColumn } from '../Column' import { RowBetween } from '../Row' -export const TextDot = styled.div` - height: 3px; - width: 3px; - background-color: ${({ theme }) => theme.deprecated_text2}; - border-radius: 50%; -` - export const Checkbox = styled.input` border: 1px solid ${({ theme }) => theme.deprecated_red3}; height: 20px; @@ -77,12 +70,6 @@ export const Separator = styled.div` background-color: ${({ theme }) => theme.backgroundOutline}; ` -export const SeparatorDark = styled.div` - width: 100%; - height: 1px; - background-color: ${({ theme }) => theme.deprecated_bg3}; -` - export const LoadingRows = styled(BaseLoadingRows)` grid-column-gap: 0.5em; grid-template-columns: repeat(12, 1fr); diff --git a/src/components/Tokens/constants.ts b/src/components/Tokens/constants.ts index 75e53947c0..d779d500e0 100644 --- a/src/components/Tokens/constants.ts +++ b/src/components/Tokens/constants.ts @@ -5,4 +5,3 @@ export const MEDIUM_MEDIA_BREAKPOINT = '720px' export const SMALL_MEDIA_BREAKPOINT = '540px' export const MOBILE_MEDIA_BREAKPOINT = '420px' export const SMALL_MOBILE_MEDIA_BREAKPOINT = '390px' -export const SMALLEST_MOBILE_MEDIA_BREAKPOINT = '320px' diff --git a/src/components/swap/styleds.tsx b/src/components/swap/styleds.tsx index ce2fcb7d85..7e28415174 100644 --- a/src/components/swap/styleds.tsx +++ b/src/components/swap/styleds.tsx @@ -57,12 +57,6 @@ export const ArrowWrapper = styled.div<{ clickable: boolean }>` : null} ` -export const SectionBreak = styled.div` - height: 1px; - width: 100%; - background-color: ${({ theme }) => theme.deprecated_bg3}; -` - export const ErrorText = styled(Text)<{ severity?: 0 | 1 | 2 | 3 | 4 }>` color: ${({ theme, severity }) => severity === 3 || severity === 4 diff --git a/src/hooks/Tokens.ts b/src/hooks/Tokens.ts index efee00d4ae..36db93648e 100644 --- a/src/hooks/Tokens.ts +++ b/src/hooks/Tokens.ts @@ -133,16 +133,6 @@ export function useSearchInactiveTokenLists(search: string | undefined, minResul }, [activeTokens, chainId, inactiveUrls, lists, minResults, search]) } -export function useIsTokenActive(token: Token | undefined | null): boolean { - const activeTokens = useAllTokens() - - if (!activeTokens || !token) { - return false - } - - return !!activeTokens[token.address] -} - // Check if currency is included in custom list from user storage export function useIsUserAddedToken(currency: Currency | undefined | null): boolean { const userAddedTokens = useUserAddedTokens() diff --git a/src/hooks/useColor.ts b/src/hooks/useColor.ts index bd8458b9d7..229732248d 100644 --- a/src/hooks/useColor.ts +++ b/src/hooks/useColor.ts @@ -89,26 +89,3 @@ export function useColor(token?: Token) { return color } - -export function useListColor(listImageUri?: string) { - const [color, setColor] = useState('#2172E5') - - useEffect(() => { - let stale = false - - if (listImageUri) { - getColorFromUriPath(listImageUri).then((color) => { - if (!stale && color !== null) { - setColor(color) - } - }) - } - - return () => { - stale = true - setColor('#2172E5') - } - }, [listImageUri]) - - return color -} diff --git a/src/nft/utils/transactionResponse.ts b/src/nft/utils/transactionResponse.ts index d635bd962f..30da6566e8 100644 --- a/src/nft/utils/transactionResponse.ts +++ b/src/nft/utils/transactionResponse.ts @@ -3,14 +3,6 @@ import { formatEther } from '@ethersproject/units' import { TxResponse, UpdatedGenieAsset } from 'nft/types' import { getTotalNftValue } from 'nft/utils' -// Shortens a given txHash. With standard charsToShorten var of 4, a hash will become 0x1234...1234 -export const shortenTxHash = (txHash: string, charsToShorten = 4, addCharsToBack = 0): string => { - return `${txHash.substring(0, charsToShorten + 2)}...${txHash.substring( - txHash.length - charsToShorten, - txHash.length - (charsToShorten + addCharsToBack) - )}` -} - export const parseTransactionResponse = (transactionResponse: TxResponse | undefined, ethPrice: number) => { let nftsPurchased: UpdatedGenieAsset[] = [] let nftsNotPurchased: UpdatedGenieAsset[] = [] diff --git a/src/state/application/hooks.ts b/src/state/application/hooks.ts index cce7e667d9..442866ddb4 100644 --- a/src/state/application/hooks.ts +++ b/src/state/application/hooks.ts @@ -16,11 +16,6 @@ export function useToggleModal(modal: ApplicationModal): () => void { return useCallback(() => dispatch(setOpenModal(isOpen ? null : modal)), [dispatch, modal, isOpen]) } -export function useOpenModal(modal: ApplicationModal): () => void { - const dispatch = useAppDispatch() - return useCallback(() => dispatch(setOpenModal(modal)), [dispatch, modal]) -} - export function useCloseModal(_modal: ApplicationModal): () => void { const dispatch = useAppDispatch() return useCallback(() => dispatch(setOpenModal(null)), [dispatch]) diff --git a/src/state/user/hooks.tsx b/src/state/user/hooks.tsx index caf9d50bc1..5c92492e74 100644 --- a/src/state/user/hooks.tsx +++ b/src/state/user/hooks.tsx @@ -17,7 +17,6 @@ import { AppState } from '../index' import { addSerializedPair, addSerializedToken, - removeSerializedToken, updateHideClosedPositions, updateHideNFTWelcomeModal, updateShowNftPromoBanner, @@ -234,16 +233,6 @@ export function useAddUserToken(): (token: Token) => void { ) } -export function useRemoveUserAddedToken(): (chainId: number, address: string) => void { - const dispatch = useAppDispatch() - return useCallback( - (chainId: number, address: string) => { - dispatch(removeSerializedToken({ chainId, address })) - }, - [dispatch] - ) -} - export function useUserAddedTokensOnChain(chainId: number | undefined | null): Token[] { const serializedTokensMap = useAppSelector(({ user: { tokens } }) => tokens) diff --git a/src/theme/components/index.tsx b/src/theme/components/index.tsx index 33a7ef5385..8726141591 100644 --- a/src/theme/components/index.tsx +++ b/src/theme/components/index.tsx @@ -9,7 +9,6 @@ import { Copy, ExternalLink as ExternalLinkIconFeather, Link as LinkIconFeather, - Trash, X, } from 'react-feather' import { Link } from 'react-router-dom' @@ -136,17 +135,6 @@ const CopyIcon = styled(Copy)` stroke: ${({ theme }) => theme.accentAction}; ` -export const TrashIcon = styled(Trash)` - ${ClickableStyle} - ${IconStyle} - stroke: ${({ theme }) => theme.deprecated_text3}; - - cursor: pointer; - align-items: center; - justify-content: center; - display: flex; -` - const rotateImg = keyframes` 0% { transform: perspective(1000px) rotateY(0deg); diff --git a/src/utils/formatChartTimes.ts b/src/utils/formatChartTimes.ts index 269d09ec1f..0caebadc1c 100644 --- a/src/utils/formatChartTimes.ts +++ b/src/utils/formatChartTimes.ts @@ -28,12 +28,6 @@ export const monthDayFormatter = (locale: string) => (timestamp: NumberValue) => day: 'numeric', }) -export const monthYearFormatter = (locale: string) => (timestamp: NumberValue) => - createDateFormatter(timestamp, locale, { - month: 'long', - year: 'numeric', - }) - export const monthYearDayFormatter = (locale: string) => (timestamp: NumberValue) => createDateFormatter(timestamp, locale, { month: 'short', diff --git a/src/utils/index.ts b/src/utils/index.ts index 98165c9474..adbd1ad728 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -2,8 +2,6 @@ import { getAddress } from '@ethersproject/address' import { AddressZero } from '@ethersproject/constants' import { Contract } from '@ethersproject/contracts' import type { JsonRpcProvider, JsonRpcSigner } from '@ethersproject/providers' -import { Token } from '@uniswap/sdk-core' -import { ChainTokenMap } from 'lib/hooks/useTokenList/utils' // returns the checksummed address if the address is valid, otherwise returns false export function isAddress(value: any): string | false { @@ -47,7 +45,3 @@ export function getContract(address: string, ABI: any, provider: JsonRpcProvider export function escapeRegExp(string: string): string { return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // $& means the whole matched string } - -export function isTokenOnList(chainTokenMap: ChainTokenMap, token?: Token): boolean { - return Boolean(token?.isToken && chainTokenMap[token.chainId]?.[token.address]) -}