Skip to content

Commit

Permalink
cleaning up all linting problems
Browse files Browse the repository at this point in the history
  • Loading branch information
Defi-Moses committed Jul 29, 2024
1 parent 8a9a087 commit 3108c06
Show file tree
Hide file tree
Showing 17 changed files with 228 additions and 336 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export const BridgeTransactionTable = ({ queryResult }) => {
}) || fromInfo.tokenSymbol
}
iconSize="w-4 h-4 rounded-full"
textSize="text-sm"
styledCoin={true}
// textSize="text-sm"
// styledCoin={true}
/>
</div>
<div className="relative">
Expand Down Expand Up @@ -99,8 +99,8 @@ export const BridgeTransactionTable = ({ queryResult }) => {
}) || (pending ? fromInfo.tokenSymbol : toInfo?.tokenSymbol)
}
iconSize="w-4 h-4 rounded-full"
textSize="text-sm"
styledCoin={true}
// textSize="text-sm"
// styledCoin={true}
/>
</div>
<div className="text-gray-400">
Expand Down
6 changes: 3 additions & 3 deletions packages/explorer-ui/components/ChainChart/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const OverviewChart: React.FC<OverviewChartProps> = ({
active,
payload,
label,
isUSD,
isUSD: isUSDTooltip,
}: {
active: boolean
payload: any[]
Expand All @@ -123,7 +123,7 @@ export const OverviewChart: React.FC<OverviewChartProps> = ({
label={toolTipLabelRef.current}
names={toolTipNamesRef.current}
values={toolTipValuesRef.current}
isUSD={isUSD}
isUSD={isUSDTooltip}
dailyStatisticType={dailyStatisticType}
platform={platform}
singleChain={singleChain}
Expand All @@ -137,7 +137,7 @@ export const OverviewChart: React.FC<OverviewChartProps> = ({
label={toolTipLabelRef.current}
names={toolTipNamesRef.current}
values={toolTipValuesRef.current}
isUSD={isUSD}
isUSD={isUSDTooltip}
dailyStatisticType={dailyStatisticType}
platform={platform}
singleChain={singleChain}
Expand Down
3 changes: 1 addition & 2 deletions packages/explorer-ui/components/GetCsvButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ export const GetCsvButton = ({ address }) => {
useEffect(() => {
if (data) {
setUrl(data.getCsv.ipfsGatewayUrl)
const { getCsv } = data
window.open(getCsv.ipfsGatewayUrl)
window.open(data.getCsv.ipfsGatewayUrl)
}
}, [data, ipfsGatewayUrl, click])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,15 @@ const TopBarNavLink: React.FC<TopBarNavLinkProps> = ({
to,
className,
}) => {
// const location = useLocation()

// const match =
// location.pathname.split('/')[1] === to.split('/')[1] && to !== '#'
const isInternal = to[0] === '/' || to[0] === '#'
const linkContent = (
<div className={`py-2 px-2 ${className}`}>
<span
className={`
text-gray-300
transform-gpu transition-all duration-75
${
// !match &&
`
`
}
`}
>
{labelText}
{/* {!isInternal && <ExternalLinkIcon className="h-4 w-4 inline ml-2 -mt-0.5" />} */}
</span>
</div>
)
Expand All @@ -41,23 +30,6 @@ const TopBarNavLink: React.FC<TopBarNavLinkProps> = ({
dark:hover:text-gray-300
dark:hover:bg-gray-800
`

// if (isInternal) {
// return (
// <NavLink
// exact={BASE_PATH === to && to !== '#'}
// to={to}
// className={linkClassName}
// activeclassname={`
// !font-medium
// !text-opacity-100
// `}
// activestyle={{ textShadow: '0px 0px #00000000' }}
// >
// {linkContent}
// </NavLink>
// )
// } else {
return (
<a href={to} target="_blank" className={linkClassName}>
{linkContent}
Expand Down
37 changes: 9 additions & 28 deletions packages/explorer-ui/components/misc/HolisticStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,14 @@ interface HolisticStatsProps {
export const HolisticStats = ({
platform: parentPlatform,
setPlatform: parentSetPlatform,
loading,
chainID,

baseVariables,
noMessaging,
}: HolisticStatsProps) => {
const [volume, setVolume] = useState<string>('--')
const [fee, setFee] = useState<string>('--')
const [addresses, setAddresses] = useState<string>('--')
const [txs, setTxs] = useState<string>('--')
const [useCache, setUseCache] = useState<boolean>(true)
const [skip, setSkip] = useState<boolean>(false)
const [variables, setVariables] = useState<any>({})

const [platform, setPlatform] = useState<any>(true)
Expand All @@ -45,11 +42,7 @@ export const HolisticStats = ({
return queryVariables
}

const {
loading: loadingVolume,
error: errorVolume,
data: dataVolume,
} = useQuery(AMOUNT_STATISTIC, {
const { loading: loadingVolume } = useQuery(AMOUNT_STATISTIC, {
fetchPolicy: 'network-only',
variables: baseVariables
? handleVariable('TOTAL_VOLUME_USD')
Expand All @@ -65,11 +58,7 @@ export const HolisticStats = ({
},
})

const {
loading: loadingFee,
error: errorFee,
data: dataFee,
} = useQuery(AMOUNT_STATISTIC, {
const { loading: loadingFee } = useQuery(AMOUNT_STATISTIC, {
fetchPolicy: 'network-only',
variables: baseVariables
? handleVariable('TOTAL_FEE_USD')
Expand All @@ -84,38 +73,30 @@ export const HolisticStats = ({
},
})

const {
loading: loadingAddresses,
error: errorAddresses,
data: dataAddresses,
} = useQuery(AMOUNT_STATISTIC, {
const { loading: loadingAddresses } = useQuery(AMOUNT_STATISTIC, {
fetchPolicy: 'network-only',
variables: baseVariables
? handleVariable('COUNT_ADDRESSES')
: {
platform,
duration: 'ALL_TIME',
type: 'COUNT_ADDRESSES',
useCache,
useCache: true,
},
onCompleted: (data: any) => {
setAddresses(data.amountStatistic.value)
},
})

const {
loading: loadingTxs,
error: errorTxs,
data: dataTxs,
} = useQuery(AMOUNT_STATISTIC, {
const { loading: loadingTxs } = useQuery(AMOUNT_STATISTIC, {
fetchPolicy: 'network-only',
variables: baseVariables
? handleVariable('COUNT_TRANSACTIONS')
: {
platform,
duration: 'ALL_TIME',
type: 'COUNT_TRANSACTIONS',
useCache,
useCache: true,
},
onCompleted: (data: any) => {
setTxs(data.amountStatistic.value)
Expand Down Expand Up @@ -144,15 +125,15 @@ export const HolisticStats = ({
},
{
title: 'Transactions',
loading: false,
loading: loadingTxs,
usd: false,
value: formatUSD(txs),
},
parentPlatform === 'MESSAGE_BUS'
? null
: {
title: 'Addresses',
loading: false,
loading: loadingAddresses,
usd: false,
value: formatUSD(addresses),
},
Expand Down
28 changes: 1 addition & 27 deletions packages/explorer-ui/components/misc/IconAndAmount.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,26 @@
import { tokenAddressToToken } from 'synapse-constants'
import { Tooltip as ReactTooltip } from 'react-tooltip'
import { getCoinTextColor } from '@styles/coins'
import { AssetImage } from '@components/misc/AssetImage'
import { formatAmount } from '@utils/formatAmount'
import { addressToSymbol } from '@utils/addressToSymbol'
import { addressToDecimals } from '@utils/addressToDecimals'

export const IconAndAmount = ({
formattedValue,
tokenAddress,
chainId,
tokenSymbol,
textSize = 'text-2xl',
iconSize = 'w-4 h-4 rounded-full',
styledCoin = false,
className = '',
}) => {
const t =
chainId && tokenAddress && tokenAddressToToken(chainId, tokenAddress)

let styledCoinClass
if (styledCoin === true) {
styledCoinClass =
'bg-gray-700 rounded-xl text-[10px] text-white items-center ml-2 pl-[5px] pr-[5px] pt-[2px] pb-[2px]'
} else {
styledCoinClass = t && `${getCoinTextColor(t)} ${textSize}`
}
2
let amount
let showToken
if (tokenSymbol) {
const displaySymbol =
addressToSymbol({ tokenAddress, chainId }) || tokenSymbol
showToken = <div className={styledCoinClass}>{displaySymbol}</div>
const dec = 10 ** addressToDecimals({ tokenAddress, chainId })
// Need a cleaner way of doing this.
if (formattedValue > 10000000) {
amount = formattedValue / (dec / 10 ** 6)
} else {
amount = formattedValue
}
} else {
const displaySymbol = addressToSymbol({ tokenAddress, chainId })
showToken = displaySymbol ? (
<div className={styledCoinClass}>{displaySymbol}</div>
) : (
<span className={`${textSize} text-slate-400`}>--</span>
)
const dec = 10 ** addressToDecimals({ tokenAddress, chainId })
amount = formattedValue / (dec / 10 ** 6)
}
Expand All @@ -56,7 +30,7 @@ export const IconAndAmount = ({
<div className="flex flex-row items-center text-white">
<AssetImage
tokenAddress={tokenAddress}
tokenSymbol={tokenSymbol}
// tokenSymbol={tokenSymbol}
chainId={chainId}
className={`${iconSize} min-w-[1rem] min-h-[1rem] inline rounded-full`}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
export const SearchBox = ({
searchField,
setSearchField,
inputType,
placeholder,
extraStyling,
}) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import _ from 'lodash'
import { useState } from 'react'
import { CHAINS } from 'synapse-constants'
import TextField from '@mui/material/TextField'
Expand All @@ -21,7 +20,6 @@ const ChainId = CHAINS.ChainId
const CHAIN_ENUM_BY_ID = CHAINS.CHAIN_ENUM_BY_ID

export const UniversalSearch = ({
placeholder,
setPending,
pending,
loading,
Expand All @@ -31,30 +29,23 @@ export const UniversalSearch = ({
minSize,
setMaxSize,
maxSize,

setStartDate,
startDate,
setEndDate,
endDate,
setToTx,
toTx,
setFromTx,
fromTx,
setKappa,
kappa,
executeSearch,
chains,
setChains,
tokens,
setTokens,
chainsLocale,
setChainsLocale,
walletLocale,
setWalletLocale,
}) => {
// const search = useSearchParams()

const [searchField, setSearchField] = useState('')
const [searchField] = useState('')
const [showText, setShowText] = useState(false)
// const [startDate, setStartDate] = useState("s");
const handleChains = (event) => {
Expand All @@ -67,15 +58,6 @@ export const UniversalSearch = ({
)
}

const handleTokens = (event) => {
const {
target: { value },
} = event
setTokens(
// On autofill we get a stringified value.
typeof value === 'string' ? value.split(',') : value
)
}
const unSelectStyle =
'transition ease-out border-l-0 border-gray-700 border-opacity-30 text-gray-500 bg-gray-700 bg-opacity-30 hover:bg-opacity-20 hover:text-white'
const selectStyle = 'text-white border-[#BE78FF] bg-synapse-radial'
Expand All @@ -90,27 +72,27 @@ export const UniversalSearch = ({
setChains([])
setKappa('')
}
let isValid
let error
let inputType
let searchLink
// let isValid
// let error
// let inputType
// let searchLink
if (!searchField || searchField === '') {
error = 'Field cannot be empty.'
// error = 'Field cannot be empty.'
} else if (validateAndParseAddress(searchField)) {
isValid = true
inputType = 'ADDRESS'
searchLink = '/txs?account=' + searchField
// isValid = true
// inputType = 'ADDRESS'
// searchLink = '/txs?account=' + searchField
} else if (validateAndParseHash(searchField)) {
isValid = true
inputType = 'TRANSACTION'
// isValid = true
// inputType = 'TRANSACTION'
// searchLink = '/tx/' + searchField
// @ts-ignore
} else if (_.values(ChainId).includes(searchField)) {
isValid = true
inputType = 'CHAIN'
searchLink = '/txs?chainId=' + searchField
} else if (Object.values(ChainId).includes(searchField as ChainId)) {
// isValid = true
// inputType = 'CHAIN'
// searchLink = '/txs?chainId=' + searchField
} else {
error = 'Not a valid address or transaction hash'
// error = 'Not a valid address or transaction hash'
}

return (
Expand Down
Loading

0 comments on commit 3108c06

Please sign in to comment.