Skip to content

Commit

Permalink
Remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
samchuk-vlad committed Jan 19, 2024
1 parent 5b16aa0 commit ac2f434
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const PreviewAccountsGrid: FC = () => {
return (
<div>
<Row justify='space-between'>
<Col className={clsx({['w-100']: isMobile})}>
<Col className={clsx({ ['w-100']: isMobile })}>
<SectionTitle
title={t('interestingAccounts.title')}
/>
Expand Down
4 changes: 0 additions & 4 deletions src/components/table/balancesTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import clsx from 'clsx'
import styles from '../Table.module.sass'
import {
BALANCE_SHOW_ZERO_BALANCES,
BALANCE_TABLE_VARIANT,
BALANCE_TABLE_VIEW,
BalancePart,
} from '../utils'
Expand All @@ -13,9 +12,6 @@ import {
} from '../customTable/TableContext'
import { useTranslation } from 'react-i18next'
import { useIsMyConnectedAddress } from 'src/components/providers/MyExtensionAccountsContext'
import { useState } from 'react'
import { BalanceVariant } from './types'
import store from 'store'
import { useGetTableData } from './utils/useGetTableData'
import ActionPannel from './utils/ActionPannel'
import TransferModal from 'src/components/transfer/TransferModal'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const parseBalancesEntities = (
) => {
const balancesInfoByKey: Record<string, any> = {}

Object.entries(balancesEntities).forEach(([account, { balances }]) => {
Object.entries(balancesEntities).forEach(([ account, { balances } ]) => {
balances?.forEach((balance) => {
const { network, info: balanceInfo } = balance || {}

Expand All @@ -79,7 +79,7 @@ const parseBalancesEntities = (

const balanceInfoBySymbol: Record<string, any> = {}

Object.entries(balanceInfo || {}).forEach(([symbol, info]) => {
Object.entries(balanceInfo || {}).forEach(([ symbol, info ]) => {
const { decimal } = getDecimalsAndSymbol(chainInfo, symbol)

if (!decimal) return
Expand Down Expand Up @@ -169,7 +169,7 @@ export const parseBalancesTableInfo = ({
tokenPrices
)

const parsedData = [...supportedNetworks, ...evmLikeNetworks].map(
const parsedData = [ ...supportedNetworks, ...evmLikeNetworks ].map(
(supportedNetwork) => {
const chainInfo = chainsInfo[supportedNetwork]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type NonTokenImageProps = {
tokenId: string
}

const excludedTokensPrefixes = ['xc', 'a', 't', '3', 'vs', 'wa']
const excludedTokensPrefixes = [ 'xc', 'a', 't', '3', 'vs', 'wa' ]

const NonTokenImage = ({ tokenId }: NonTokenImageProps) => {
const excludedTokenPrefix = excludedTokensPrefixes.find((prefix) =>
Expand Down Expand Up @@ -186,7 +186,7 @@ export const parseTokenCentricView = ({
})

if (nonEmptyArr(children)) {
childrenBalances.children = [...children]
childrenBalances.children = [ ...children ]
}

const chainInfo = chainsInfo[firstNetwork]
Expand Down Expand Up @@ -343,14 +343,14 @@ type BalanceByToken = {

type BalancesByTokenId = Record<string, BalanceByToken>

function parseBalancesByToken(
function parseBalancesByToken (
balancesEntities: BalanceEntityRecord,
multiChainInfo: MultiChainInfo
) {
const balancesByToken: BalancesByTokenId = {}
const tokenIds = new Set<string>()

Object.entries(balancesEntities).forEach(([address, balancesEntity]) => {
Object.entries(balancesEntities).forEach(([ address, balancesEntity ]) => {
balancesEntity.balances?.forEach(({ network, info }) => {
if (!info || isEmptyObj(info)) return

Expand All @@ -359,7 +359,7 @@ function parseBalancesByToken(

const { ss58Format } = chainInfo

Object.entries(info).forEach(([tokenId, balances]) => {
Object.entries(info).forEach(([ tokenId, balances ]) => {
const encodedTokenId = encodeTokenId(address, tokenId)

if ((allowedTokens && !allowedTokens.includes(tokenId)) || !tokenId)
Expand Down Expand Up @@ -418,7 +418,7 @@ type GetChildrenBalanceParams = {
t: TFunction
}

function getChildrenBalances({
function getChildrenBalances ({
balancesByNetwork,
isMulti,
chainsInfo,
Expand All @@ -431,7 +431,7 @@ function getChildrenBalances({
const balancesByNetworkEntries = Object.entries(balancesByNetwork)
const networkIcons: string[] = []

const result = balancesByNetworkEntries.map(([network, balances]) => {
const result = balancesByNetworkEntries.map(([ network, balances ]) => {
const { totalBalance, accountId, ...otherBalances } = balances

const chainInfo = chainsInfo[network]
Expand Down Expand Up @@ -468,7 +468,7 @@ function getChildrenBalances({
decimal,
})

childrenBalances.children = [...accountData.reverse()]
childrenBalances.children = [ ...accountData.reverse() ]

const chain = (
<ChainData
Expand Down Expand Up @@ -549,7 +549,7 @@ type GetAccountDataValuesParams = BalancesStruct & {
t: TFunction
}

function getAccountDataValues({ t, ...info }: GetAccountDataValuesParams) {
function getAccountDataValues ({ t, ...info }: GetAccountDataValuesParams) {
const { reservedBalance, freeBalance, lockedBalance } = info

return [
Expand Down Expand Up @@ -579,7 +579,7 @@ type GetAccountDataRowsParams = GetAccountDataValuesParams & {
isMulti?: boolean
}

function getAccountDataRows({
function getAccountDataRows ({
decimal,
price,
priceValue,
Expand Down
5 changes: 2 additions & 3 deletions src/components/table/balancesTable/utils/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Image from 'next/image'
import styles from './Index.module.sass'
import clsx from 'clsx'
import {
AppstoreOutlined,
LineChartOutlined,
MenuOutlined,
} from '@ant-design/icons'
Expand Down Expand Up @@ -44,7 +43,7 @@ export const allowedTokensByNetwork: Record<string, string[]> = {
'PHA',
'PARA',
],
statemint: ['WETH', 'WBTC', 'BTC', 'DOT', 'USDC', 'USDT', 'BUSD'],
statemint: [ 'WETH', 'WBTC', 'BTC', 'DOT', 'USDC', 'USDT', 'BUSD' ],
}

const BALANCES_KEY = 'balances'
Expand Down Expand Up @@ -84,7 +83,7 @@ export const encodeTokenId = (address: string, tokenId: string) =>
`${address}-and-${tokenId}`

export const decodeTokenId = (tokenId: string) => {
const [address, id] = tokenId.split('-and-')
const [ address, id ] = tokenId.split('-and-')
return { address, id }
}

Expand Down
6 changes: 3 additions & 3 deletions src/components/table/customCard/BalancesSectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const BalancesSectionCard = <T extends TableInfo>({
value,
isLastElement,
}: BalancesSectionCardProps<T>) => {
const [open, setOpen] = useState<boolean>(false)
const [ open, setOpen ] = useState<boolean>(false)
const balanceInfoRef = React.useRef<HTMLDivElement>(null)

const isMulti = useIsMulti()
Expand Down Expand Up @@ -162,7 +162,7 @@ const InnerChildrenBalances = <T extends TableInfo>({
leftOffset,
isLastElement,
}: InnerCildrenBalancesProps<T>) => {
const [open, setOpen] = useState<boolean>(false)
const [ open, setOpen ] = useState<boolean>(false)
const { balancesVariant } = useTableContext()

const {
Expand All @@ -187,7 +187,7 @@ const InnerChildrenBalances = <T extends TableInfo>({

const childrenOffsetLeft = childrenRowContentRef.current?.offsetLeft || 0

let childrenOffset = ['reserved', 'locked', 'free'].includes(key)
let childrenOffset = [ 'reserved', 'locked', 'free' ].includes(key)
? leftOffset + (balancesVariant === 'tokens' || isMulti ? 56 : 8)
: leftOffset + 7

Expand Down
4 changes: 2 additions & 2 deletions src/components/table/customCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const CustomCard = <T extends TableInfo>({
balanceKind,
isLastElement,
}: BalanceCardProps<T>) => {
const [open, setOpen] = useState<boolean>(false)
const [ open, setOpen ] = useState<boolean>(false)
const { isMobile } = useResponsiveSize()
const isMulti = useIsMulti()
let level = 0
Expand Down Expand Up @@ -236,7 +236,7 @@ const InnerChildrenBalances = <T extends TableInfo>({
className,
balanceKind,
}: InnerChildrenBalancesProps<T>) => {
const [open, setOpen] = useState<boolean>(false)
const [ open, setOpen ] = useState<boolean>(false)
const haveChildren = child?.children || child.cardChildren

const balances = (
Expand Down
4 changes: 2 additions & 2 deletions src/components/table/customTable/TableContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export const TableContextWrapper: React.FC<TableContextProps> = ({
const showZeroBalancesFromStorage = store.get(storeShowZeroBalance)
const tableVariantFromStore = store.get(BALANCE_TABLE_VARIANT)

const [tableView, setTableView] = useState<TableView>(
const [ tableView, setTableView ] = useState<TableView>(
tableViewFromStorage || 'table'
)
const [showZeroBalances, setShowZeroBalances] = useState<boolean>(
const [ showZeroBalances, setShowZeroBalances ] = useState<boolean>(
showZeroBalancesFromStorage !== undefined
? showZeroBalancesFromStorage
: true
Expand Down
10 changes: 5 additions & 5 deletions src/components/table/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ const { TabPane } = Tabs

export type TableKind = 'balances' | 'crowdloans' | 'assets'

export const relayChains: RelayChain[] = ['kusama', 'polkadot']
export const relayChains: RelayChain[] = [ 'kusama', 'polkadot' ]

export const disableContributionButton = ['acala']
export const disableContributionButton = [ 'acala' ]

export const tailsViewOpt: TableViewOption[] = [
{ label: <MenuOutlined />, value: 'table' },
Expand Down Expand Up @@ -317,11 +317,11 @@ export const BalancePart = <T extends TableInfo>({

useEffect(() => {
store.set(storeTableView, tableView)
}, [tableView])
}, [ tableView ])

useEffect(() => {
store.set(storeShowZeroBalance, showZeroBalances)
}, [showZeroBalances])
}, [ showZeroBalances ])

if (!data || !skeleton) return <TableLoading loadingLabel={loadingLabel} />

Expand Down Expand Up @@ -786,7 +786,7 @@ export const AccountPreview = ({
nameClassName,
identityLoadNotRequired,
}: AccountPreviewProps) => {
useFetchIdentities([account], identityLoadNotRequired)
useFetchIdentities([ account ], identityLoadNotRequired)
const identities = useIdentities(account)

const address = (
Expand Down

0 comments on commit ac2f434

Please sign in to comment.